create-pmos 0.562.0 → 0.564.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 +27 -27
- 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 +26 -0
- package/workspace/guide/cli.md +16 -1
- package/workspace/lib/blueprint-cli.js +146 -0
- package/workspace/lib/blueprint.js +344 -0
- package/workspace/lib/kit-update.js +8 -1
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/test-lists/blueprint.json +9 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.564.0",
|
|
4
4
|
"description": "Scaffold the PMOS portable kit — run the PMOS product-management workflow (initiative → lane-fit spec → contract → build → three gates, with work-type lanes for features, research, maintenance, incidents, and content) entirely inside your own repo, with all state as git-versioned files. Includes `workflow-sweep`, which audits the state every board derives from and separates real defects from work you simply have not done. `create-pmos workspace` also installs + launches the local Terminal Workspace GUI. No database, no network, no telemetry.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -33,6 +33,32 @@
|
|
|
33
33
|
"audit"
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
|
+
{
|
|
37
|
+
"v": "0.564.0",
|
|
38
|
+
"at": "2026-11-11T14:08:23.553Z",
|
|
39
|
+
"f": 4,
|
|
40
|
+
"prs": [
|
|
41
|
+
{
|
|
42
|
+
"n": 1295,
|
|
43
|
+
"t": "Pmos blueprint on a shallow clone warns and shows Unknown, never a merged PR as In build",
|
|
44
|
+
"s": "Pmos blueprint on a shallow clone warns and shows Unknown, never a merged PR as In build",
|
|
45
|
+
"k": "fix"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
"v": "0.563.0",
|
|
51
|
+
"at": "2026-11-11T12:32:19.496Z",
|
|
52
|
+
"f": 4,
|
|
53
|
+
"prs": [
|
|
54
|
+
{
|
|
55
|
+
"n": 1294,
|
|
56
|
+
"t": "The feature registry and pmos blueprint, each status derived from evidence",
|
|
57
|
+
"s": "The feature registry and pmos blueprint, each status derived from evidence",
|
|
58
|
+
"k": "new"
|
|
59
|
+
}
|
|
60
|
+
]
|
|
61
|
+
},
|
|
36
62
|
{
|
|
37
63
|
"v": "0.562.0",
|
|
38
64
|
"at": "2026-11-11T11:26:34.804Z",
|
|
@@ -278,32 +304,6 @@
|
|
|
278
304
|
"k": "new"
|
|
279
305
|
}
|
|
280
306
|
]
|
|
281
|
-
},
|
|
282
|
-
{
|
|
283
|
-
"v": "0.544.0",
|
|
284
|
-
"at": "2026-11-08T14:45:01.680Z",
|
|
285
|
-
"f": 4,
|
|
286
|
-
"prs": [
|
|
287
|
-
{
|
|
288
|
-
"n": 1272,
|
|
289
|
-
"t": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
290
|
-
"s": "Claude calls and sign-in advice follow the chosen Claude profile; a session stuck at sign-in ends",
|
|
291
|
-
"k": "fix"
|
|
292
|
-
}
|
|
293
|
-
]
|
|
294
|
-
},
|
|
295
|
-
{
|
|
296
|
-
"v": "0.543.0",
|
|
297
|
-
"at": "2026-11-08T10:18:52.684Z",
|
|
298
|
-
"f": 4,
|
|
299
|
-
"prs": [
|
|
300
|
-
{
|
|
301
|
-
"n": 1271,
|
|
302
|
-
"t": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
303
|
-
"s": "✕ reasons become memory; each team role reads a notebook of its earlier work",
|
|
304
|
-
"k": "new"
|
|
305
|
-
}
|
|
306
|
-
]
|
|
307
307
|
}
|
|
308
308
|
]
|
|
309
309
|
}
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T14:08:19Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T14:08:19Z"}
|
|
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-
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-11T14:08:19Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,4 +1,30 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"v": "0.564.0",
|
|
4
|
+
"at": "2026-11-11T14:08:23.553Z",
|
|
5
|
+
"f": 4,
|
|
6
|
+
"prs": [
|
|
7
|
+
{
|
|
8
|
+
"n": 1295,
|
|
9
|
+
"t": "Pmos blueprint on a shallow clone warns and shows Unknown, never a merged PR as In build",
|
|
10
|
+
"s": "Pmos blueprint on a shallow clone warns and shows Unknown, never a merged PR as In build",
|
|
11
|
+
"k": "fix"
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"v": "0.563.0",
|
|
17
|
+
"at": "2026-11-11T12:32:19.496Z",
|
|
18
|
+
"f": 4,
|
|
19
|
+
"prs": [
|
|
20
|
+
{
|
|
21
|
+
"n": 1294,
|
|
22
|
+
"t": "The feature registry and pmos blueprint, each status derived from evidence",
|
|
23
|
+
"s": "The feature registry and pmos blueprint, each status derived from evidence",
|
|
24
|
+
"k": "new"
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
},
|
|
2
28
|
{
|
|
3
29
|
"v": "0.562.0",
|
|
4
30
|
"at": "2026-11-11T11:26:34.804Z",
|
package/workspace/guide/cli.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Command reference: every pmos command, by area"
|
|
4
4
|
description: "Every pmos command of the workspace in one page, grouped by area, with its flags, examples and exit codes."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-11
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Command reference
|
|
@@ -596,6 +596,21 @@ The fields of a schedule:
|
|
|
596
596
|
|
|
597
597
|
## Knowledge
|
|
598
598
|
|
|
599
|
+
### pmos blueprint: every feature and its status
|
|
600
|
+
|
|
601
|
+
`pmos blueprint` lists every feature of the product, by surface, with a status. The status is never typed in: the command works it out from the evidence each feature cites in `planning/blueprint/features.json` (its PRs, its files, its experiment record), from git and from the `gitHead` that npm records for each published version. `planning/blueprint/blueprint.md` gives the rules.
|
|
602
|
+
|
|
603
|
+
| Command | What it does |
|
|
604
|
+
|---|---|
|
|
605
|
+
| `pmos blueprint list [--surface <id>] [--status <status>]` | Lists every feature with its status: Idea, Exploring, Agreed, In build, Live <version> or Retired, and Unknown on a shallow clone. `pmos blueprint` alone does the same. |
|
|
606
|
+
| `pmos blueprint show <feature-id>` | Prints one feature: its status and why, its PRs, files, record, guide sections and design. |
|
|
607
|
+
| `pmos blueprint unplaced [--all]` | Lists the guide sections and the feature changes since the first release of the range that no feature cites. `--all` also lists the fixes, chores and docs. |
|
|
608
|
+
| `pmos blueprint check` | Checks the registry: no `status` key anywhere, known surfaces, known guide sections, one id each. The exit code is 1 when it finds a problem. |
|
|
609
|
+
|
|
610
|
+
Every command takes `--json`, `--root <dir>` and `--offline`. Live <version> is the first version whose `gitHead` contains the feature. The command reads the versions from npm and saves the read. With `--offline`, or when npm does not answer, it uses the saved read and says so. With no saved read, a merged feature shows `Live ?`.
|
|
611
|
+
|
|
612
|
+
On a shallow clone (a cloud session, CI, `git clone --depth`) the command warns that the history is shallow. A status that depends on the missing history shows Unknown, and a Live version that may be earlier shows as `Live ≤<version>`. Run `git fetch --unshallow`, then the command again, for the full answer.
|
|
613
|
+
|
|
599
614
|
### pmos kg: find knowledge without reading whole files
|
|
600
615
|
|
|
601
616
|
| Command | What it does |
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* blueprint-cli.js — `pmos blueprint`: every feature of the product with its derived status (lib/blueprint.js).
|
|
3
|
+
*
|
|
4
|
+
* pmos blueprint [list] [--surface <id>] [--status <s>] [--json] every feature by surface, with its status
|
|
5
|
+
* pmos blueprint show <id> [--json] one feature: its evidence and why it has its status
|
|
6
|
+
* pmos blueprint unplaced [--all] [--json] guide sections and release changes no feature cites
|
|
7
|
+
* pmos blueprint check [--json] the registry's own rules (no status key, known surfaces, …)
|
|
8
|
+
* every command: [--offline] [--root <dir>]
|
|
9
|
+
* On a shallow clone every command but check warns, and a status the missing history decides shows Unknown (lib/blueprint.js).
|
|
10
|
+
* The command never fetches: git's network verbs live only in lib/sync.js (D70), so the warning names `git fetch --unshallow`. Exit codes: 0 done, 1 refused (no registry, unknown feature, check found problems), 2 usage. Reads only; writes nothing
|
|
11
|
+
* but the saved read of the releases (pmos/state/blueprint-releases.json, gitignored).
|
|
12
|
+
*/
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { execFileSync } = require('child_process');
|
|
15
|
+
const B = require('./blueprint.js');
|
|
16
|
+
|
|
17
|
+
const COMMANDS = { blueprint: ['list', 'show', 'unplaced', 'check'] };
|
|
18
|
+
const USAGE = [
|
|
19
|
+
'usage: pmos blueprint [list|show|unplaced|check] — every feature of the product, with a status worked out from its evidence',
|
|
20
|
+
' pmos blueprint list [--surface <id>] [--status <status>] [--json] (the default) every feature by surface',
|
|
21
|
+
' pmos blueprint show <feature-id> [--json] one feature: its evidence and why it has its status',
|
|
22
|
+
' pmos blueprint unplaced [--all] [--json] guide sections and release changes that no feature cites',
|
|
23
|
+
' pmos blueprint check [--json] the registry\'s own rules',
|
|
24
|
+
' every command: [--offline] (no npm read; use the saved one) [--root <dir>]',
|
|
25
|
+
'Statuses: Idea, Exploring, Agreed, In build, Live <version>, Retired, and Unknown on a shallow clone. The registry is planning/blueprint/features.json.',
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
function parse(args) {
|
|
29
|
+
const pos = []; const flags = {};
|
|
30
|
+
for (let i = 0; i < args.length; i++) {
|
|
31
|
+
const a = args[i];
|
|
32
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
33
|
+
const k = a.slice(2);
|
|
34
|
+
if (['json', 'offline', 'all'].includes(k)) { flags[k] = true; continue; }
|
|
35
|
+
flags[k] = args[i + 1] !== undefined && !String(args[i + 1]).startsWith('--') ? args[++i] : '';
|
|
36
|
+
}
|
|
37
|
+
return { pos, flags };
|
|
38
|
+
}
|
|
39
|
+
function repoRoot(cwd) { try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; } }
|
|
40
|
+
|
|
41
|
+
function releaseLine(r) {
|
|
42
|
+
if (r.source === 'registry') return `Releases: ${r.list.length} versions of the package, read from npm now.`;
|
|
43
|
+
if (r.source === 'saved') return `Releases: ${r.offline ? 'offline' : 'npm did not answer'}; using the saved read from ${String(r.at || 'an earlier run').slice(0, 10)} (${r.list.length} versions).`;
|
|
44
|
+
return `Releases: unknown (${r.error}). A merged feature shows "Live ?": its version cannot be worked out.`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function shallowLine(d, unknown) {
|
|
48
|
+
return `⚠ This clone's git history is shallow (${d.commits} commit${d.commits === 1 ? '' : 's'}), so ${unknown} status${unknown === 1 ? ' is' : 'es are'} Unknown and a Live version marked ≤ may be earlier. Run \`git fetch --unshallow\`, then this command again, for the full answer.`;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), readReleases = B.readReleases, git } = {}) {
|
|
52
|
+
const args = argv[0] === 'blueprint' ? argv.slice(1) : argv.slice();
|
|
53
|
+
if (['help', '--help', '-h'].includes(args[0])) { for (const l of USAGE) say(l); return 0; }
|
|
54
|
+
const verb = args[0] && !args[0].startsWith('--') ? args[0] : 'list';
|
|
55
|
+
if (!COMMANDS.blueprint.includes(verb)) { say(`unknown blueprint command "${verb}" — one of ${COMMANDS.blueprint.join(', ')}`); return 2; }
|
|
56
|
+
const { pos, flags } = parse(args[0] === verb ? args.slice(1) : args);
|
|
57
|
+
const root = flags.root ? path.resolve(cwd, flags.root) : repoRoot(cwd);
|
|
58
|
+
const loaded = B.load(root);
|
|
59
|
+
if (!loaded.ok) { if (flags.json) say(JSON.stringify({ ok: false, error: loaded.error })); else say('✗ ' + loaded.error); return 1; }
|
|
60
|
+
const reg = loaded.registry;
|
|
61
|
+
|
|
62
|
+
if (verb === 'check') {
|
|
63
|
+
const problems = B.check(reg, { root });
|
|
64
|
+
if (flags.json) say(JSON.stringify({ ok: problems.length === 0, problems }));
|
|
65
|
+
else if (!problems.length) say(`✓ ${B.REGISTRY}: ${reg.features.length} features on ${reg.surfaces.length} surfaces, no status written by hand.`);
|
|
66
|
+
else { say(`✗ ${B.REGISTRY}: ${problems.length} problem${problems.length === 1 ? '' : 's'}`); for (const p of problems) say(' ' + p); }
|
|
67
|
+
return problems.length ? 1 : 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
const problems = B.check(reg, { root }).filter((p) => /derived, never written|surface ".*" is not in/.test(p));
|
|
71
|
+
if (problems.length) { say('✗ the registry breaks its own rules; run `pmos blueprint check`.'); for (const p of problems) say(' ' + p); return 1; }
|
|
72
|
+
const rels = { ...readReleases({ root, pkg: reg.package, offline: !!flags.offline }), offline: !!flags.offline };
|
|
73
|
+
const opts = { root, releases: rels.list }; if (git) opts.git = git;
|
|
74
|
+
const derived = B.derive(reg, opts);
|
|
75
|
+
const { features } = derived;
|
|
76
|
+
const nUnknown = features.filter((f) => f.status === 'Unknown').length;
|
|
77
|
+
const shallowJson = { shallow: !!derived.shallow, commits: derived.commits };
|
|
78
|
+
|
|
79
|
+
if (verb === 'show') {
|
|
80
|
+
const f = features.find((x) => x.id === pos[0]);
|
|
81
|
+
if (!f) { say(pos[0] ? `✗ no feature "${pos[0]}" — \`pmos blueprint\` lists them` : 'usage: pmos blueprint show <feature-id>'); return pos[0] ? 1 : 2; }
|
|
82
|
+
if (flags.json) { say(JSON.stringify({ ok: true, releases: rels.source, ...shallowJson, feature: f })); return 0; }
|
|
83
|
+
const surface = reg.surfaces.find((s) => s.id === f.surface);
|
|
84
|
+
say(`${f.name} (${f.id})`);
|
|
85
|
+
say(` Status: ${B.label(f)} — ${f.why.join('; ')}`);
|
|
86
|
+
say(` Surface: ${surface ? surface.name : f.surface}`);
|
|
87
|
+
if (f.what) say(` What: ${f.what}`);
|
|
88
|
+
if (f.prs && f.prs.length) say(` PRs: ${f.prs.map((n) => '#' + n).join(' ')}`);
|
|
89
|
+
if (f.retired_by && f.retired_by.length) say(` Retired by: ${f.retired_by.map((n) => '#' + n).join(' ')}`);
|
|
90
|
+
if (f.files && f.files.length) say(` Files: ${f.files.join(', ')}`);
|
|
91
|
+
if (f.initiative) say(` Record: planning/initiatives/${f.initiative}.md`);
|
|
92
|
+
for (const g of f.guide || []) say(` Guide: ${(reg.sources && reg.sources.guide) || 'workspace/guide'}/${g}`);
|
|
93
|
+
for (const d of f.design || []) say(` Design: ${d}`);
|
|
94
|
+
if (f.note) say(` Note: ${f.note}`);
|
|
95
|
+
say(' ' + releaseLine(rels));
|
|
96
|
+
if (derived.shallow) say(' ' + shallowLine(derived, nUnknown));
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (verb === 'unplaced') {
|
|
101
|
+
const u = B.unplaced(reg, opts);
|
|
102
|
+
if (flags.json) { say(JSON.stringify({ ok: true, releases: rels.source, ...shallowJson, range: u.range, guide: u.guide, changes: u.changes, other: flags.all ? u.other : u.other.length })); return 0; }
|
|
103
|
+
say(`Guide sections no feature cites: ${u.guide.length}`);
|
|
104
|
+
for (const g of u.guide) say(' ' + g);
|
|
105
|
+
if (!u.range) say(derived.shallow ? 'Release changes: not checked — this shallow clone does not hold the release the range starts from. Run `git fetch --unshallow` first.'
|
|
106
|
+
: 'Release changes: not checked — no release data, so the first release of the range is unknown.');
|
|
107
|
+
else {
|
|
108
|
+
say(`Feature changes since ${u.range.from} that no feature cites: ${u.changes.length}`);
|
|
109
|
+
for (const c of u.changes) say(` ${c.sha} ${c.subject}`);
|
|
110
|
+
say(`Other changes (fixes, chores, docs, tests) since ${u.range.from}: ${u.other.length}. They change no feature's status${flags.all ? ':' : '; --all lists them.'}`);
|
|
111
|
+
if (flags.all) for (const c of u.other) say(` ${c.sha} ${c.subject}`);
|
|
112
|
+
}
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
// list
|
|
117
|
+
let shown = features;
|
|
118
|
+
if (flags.surface) shown = shown.filter((f) => f.surface === flags.surface);
|
|
119
|
+
if (flags.status) shown = shown.filter((f) => f.status.toLowerCase() === String(flags.status).toLowerCase());
|
|
120
|
+
const u = B.unplaced(reg, opts);
|
|
121
|
+
const counts = {}; for (const s of B.STATUSES) counts[s] = features.filter((f) => f.status === s).length;
|
|
122
|
+
if (flags.json) {
|
|
123
|
+
say(JSON.stringify({ ok: true, what: reg.what, releases: { source: rels.source, at: rels.at, count: rels.list.length }, ...shallowJson,
|
|
124
|
+
counts, unplaced: { guide: u.guide.length, changes: u.range ? u.changes.length : null },
|
|
125
|
+
features: shown.map((f) => ({ id: f.id, name: f.name, surface: f.surface, status: f.status, version: f.version, ...(f.atMost ? { version_at_most: true } : {}), why: f.why })) }));
|
|
126
|
+
return 0;
|
|
127
|
+
}
|
|
128
|
+
say(`${reg.name || 'Product'} blueprint — ${features.length} features`);
|
|
129
|
+
say(' ' + B.STATUSES.filter((s) => counts[s]).map((s) => `${s} ${counts[s]}`).join(' · '));
|
|
130
|
+
if (derived.shallow) say(shallowLine(derived, nUnknown));
|
|
131
|
+
for (const s of reg.surfaces) {
|
|
132
|
+
const rows = shown.filter((f) => f.surface === s.id);
|
|
133
|
+
if (!rows.length) continue;
|
|
134
|
+
say('');
|
|
135
|
+
say(s.name);
|
|
136
|
+
for (const f of rows) say(` ${B.label(f).padEnd(15)} ${f.name} (${f.id})`);
|
|
137
|
+
}
|
|
138
|
+
say('');
|
|
139
|
+
say(releaseLine(rels));
|
|
140
|
+
const unp = u.guide.length + (u.range ? u.changes.length : 0);
|
|
141
|
+
say(unp ? `Not placed yet: ${u.guide.length} guide section${u.guide.length === 1 ? '' : 's'}${u.range ? `, ${u.changes.length} release change${u.changes.length === 1 ? '' : 's'}` : ''} — \`pmos blueprint unplaced\` lists them.`
|
|
142
|
+
: `Every guide section${u.range ? ' and every feature change since ' + u.range.from : ''} is placed.`);
|
|
143
|
+
return 0;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* blueprint.js — the product blueprint: every feature of the product with a status DERIVED from evidence
|
|
3
|
+
* (initiative product-blueprint-registry, batch 30 item 1, proposals P1 and P3).
|
|
4
|
+
*
|
|
5
|
+
* load(root) → { ok, registry, file } | { ok:false, error }
|
|
6
|
+
* check(registry, { root }) → [problem] the registry's own rules (no status key, known surfaces, …)
|
|
7
|
+
* derive(registry, { root, releases }) → { features, releases, shallow, commits } every feature with { status, version, why }
|
|
8
|
+
* unplaced(registry, { root, releases }) → { guide, changes, other, range }
|
|
9
|
+
* readReleases({ root, pkg, npmView, offline, now }) → { list, source, at, error } npm `gitHead` per version, cached
|
|
10
|
+
* STATUSES
|
|
11
|
+
*
|
|
12
|
+
* The registry (planning/blueprint/features.json) holds EVIDENCE, never a status: the PRs that built a feature, the PRs that
|
|
13
|
+
* retired it, the files that carry it, its experiment record and the guide sections that explain it. A status typed into the
|
|
14
|
+
* registry by hand would be a board that lies the first week nobody updates it, so check() refuses a `status` or `stage` key
|
|
15
|
+
* anywhere in the file. The rules, strongest first:
|
|
16
|
+
*
|
|
17
|
+
* Retired a `retired_by` PR is merged on the default line, or every cited file is gone now and was in a release
|
|
18
|
+
* Live <v> a cited PR is in a published release (or a cited file is); <v> is the FIRST release whose npm gitHead has it
|
|
19
|
+
* In build a cited PR is merged but in no release yet, or a cited PR is not merged yet
|
|
20
|
+
* Agreed its experiment record has a done test (D107: the done test is the agreed spec)
|
|
21
|
+
* Exploring its experiment record has no done test yet, or a cited prototype/ path exists
|
|
22
|
+
* Idea nothing above: the entry alone
|
|
23
|
+
* Unknown a SHALLOW clone (cloud sessions, CI, `git clone --depth`) lacks the history the status depends on: a cited
|
|
24
|
+
* PR whose merge is older than the clone's first commit reads as "not merged" there, so it would show In build
|
|
25
|
+
* although it shipped long ago. derive() never guesses in that case. It never fetches the history itself:
|
|
26
|
+
* git's network verbs live only in lib/sync.js (D70), so the CLI names `git fetch --unshallow` instead. A Live version that older, missing releases could precede is marked `atMost` (≤).
|
|
27
|
+
*
|
|
28
|
+
* "In a release" means: the release's gitHead (from `npm view <pkg> version gitHead`) has the commit as an ancestor, or
|
|
29
|
+
* has the file in its tree. Without release data (no network and no saved read) a merged feature says `Live ?`.
|
|
30
|
+
*/
|
|
31
|
+
const fs = require('fs');
|
|
32
|
+
const path = require('path');
|
|
33
|
+
const cp = require('child_process');
|
|
34
|
+
|
|
35
|
+
const STATUSES = Object.freeze(['Idea', 'Exploring', 'Agreed', 'In build', 'Live', 'Retired', 'Unknown']);
|
|
36
|
+
const REGISTRY = path.join('planning', 'blueprint', 'features.json');
|
|
37
|
+
const CACHE = path.join('pmos', 'state', 'blueprint-releases.json');
|
|
38
|
+
const FORBIDDEN_KEYS = ['status', 'stage', 'state'];
|
|
39
|
+
const FEATURE_KEYS = ['id', 'name', 'surface', 'what', 'prs', 'retired_by', 'files', 'initiative', 'guide', 'design', 'note'];
|
|
40
|
+
const ID_RE = /^[a-z0-9][a-z0-9-]*$/;
|
|
41
|
+
const FEATURE_CHANGE = /^(feat|perf)(\([^)]*\))?!?:|^Batch \d+\b/;
|
|
42
|
+
|
|
43
|
+
function load(root) {
|
|
44
|
+
const file = path.join(root, REGISTRY);
|
|
45
|
+
let text;
|
|
46
|
+
try { text = fs.readFileSync(file, 'utf8'); } catch { return { ok: false, error: `No registry at ${REGISTRY}. The blueprint reads its features from that file.` }; }
|
|
47
|
+
try { return { ok: true, registry: JSON.parse(text), file }; } catch (e) { return { ok: false, error: `${REGISTRY} is not valid JSON: ${e.message}` }; }
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/* ---------- git ---------- */
|
|
51
|
+
|
|
52
|
+
/** The PR numbers a commit title names: a squash title's `(#123)`, or a merge commit's `Merge pull request #123`. */
|
|
53
|
+
function prNumbers(subject) {
|
|
54
|
+
const nums = [...String(subject).matchAll(/\(#(\d+)\)/g)].map((m) => +m[1]);
|
|
55
|
+
const merge = /^Merge pull request #(\d+)\b/.exec(String(subject));
|
|
56
|
+
if (merge) nums.push(+merge[1]);
|
|
57
|
+
return nums;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function gitIn(root) {
|
|
61
|
+
const run = (args, input) => {
|
|
62
|
+
try { return cp.execFileSync('git', args, { cwd: root, encoding: 'utf8', input, maxBuffer: 64 * 1024 * 1024, stdio: ['pipe', 'pipe', 'ignore'] }); } catch { return null; }
|
|
63
|
+
};
|
|
64
|
+
let line = null;
|
|
65
|
+
const mainLine = () => {
|
|
66
|
+
if (line) return line;
|
|
67
|
+
const out = run(['log', '--first-parent', '--format=%H%x09%s', 'HEAD']) || '';
|
|
68
|
+
const list = out.split('\n').filter(Boolean).map((l, idx) => { const t = l.indexOf('\t'); return { sha: l.slice(0, t), subject: l.slice(t + 1), idx }; });
|
|
69
|
+
const bySha = new Map(list.map((c) => [c.sha, c]));
|
|
70
|
+
const byPr = new Map();
|
|
71
|
+
for (const c of list) for (const n of prNumbers(c.subject)) if (!byPr.has(n)) byPr.set(n, c);
|
|
72
|
+
line = { list, bySha, byPr };
|
|
73
|
+
return line;
|
|
74
|
+
};
|
|
75
|
+
const reach = new Map();
|
|
76
|
+
/** The commits a ref holds, as a position on the first-parent line when it is on it, else as the set of its
|
|
77
|
+
* ancestors (one `git rev-list` per such ref, never one git call per query). */
|
|
78
|
+
const reachOf = (ref) => {
|
|
79
|
+
if (!reach.has(ref)) {
|
|
80
|
+
const L = mainLine();
|
|
81
|
+
if (L.bySha.has(ref)) reach.set(ref, { idx: L.bySha.get(ref).idx });
|
|
82
|
+
else reach.set(ref, { set: new Set((run(['rev-list', ref]) || '').split('\n').filter(Boolean)) });
|
|
83
|
+
}
|
|
84
|
+
return reach.get(ref);
|
|
85
|
+
};
|
|
86
|
+
/** Does `ref` contain commit `sha`? */
|
|
87
|
+
const contains = (ref, sha) => {
|
|
88
|
+
const r = reachOf(ref);
|
|
89
|
+
if (r.set) return r.set.has(sha);
|
|
90
|
+
const b = mainLine().bySha.get(sha);
|
|
91
|
+
if (b) return r.idx <= b.idx;
|
|
92
|
+
return run(['merge-base', '--is-ancestor', sha, ref]) !== null;
|
|
93
|
+
};
|
|
94
|
+
/** Which of `pairs` ([ref, path]) exist? One `git cat-file --batch-check` for all of them. */
|
|
95
|
+
const present = (pairs) => {
|
|
96
|
+
if (!pairs.length) return [];
|
|
97
|
+
const out = run(['cat-file', '--batch-check'], pairs.map(([r, p]) => `${r}:${p}`).join('\n') + '\n');
|
|
98
|
+
if (out === null) return pairs.map(() => false);
|
|
99
|
+
const lines = out.split('\n');
|
|
100
|
+
return pairs.map((_, i) => !!lines[i] && !/ missing$/.test(lines[i]) && !/ ambiguous$/.test(lines[i]));
|
|
101
|
+
};
|
|
102
|
+
/** Which of `shas` are commits in this clone? One `git cat-file --batch-check`. */
|
|
103
|
+
const knownAll = (shas) => {
|
|
104
|
+
if (!shas.length) return [];
|
|
105
|
+
const out = run(['cat-file', '--batch-check'], shas.map((x) => `${x}^{commit}`).join('\n') + '\n');
|
|
106
|
+
if (out === null) return shas.map(() => false);
|
|
107
|
+
const lines = out.split('\n');
|
|
108
|
+
return shas.map((_, i) => / commit \d+$/.test(lines[i] || ''));
|
|
109
|
+
};
|
|
110
|
+
/** Is this a shallow clone? Its history stops at a cut-off, so a merge older than that is invisible here. */
|
|
111
|
+
let shallowAns = null;
|
|
112
|
+
const shallow = () => {
|
|
113
|
+
if (shallowAns === null) shallowAns = (run(['rev-parse', '--is-shallow-repository']) || '').trim() === 'true';
|
|
114
|
+
return shallowAns;
|
|
115
|
+
};
|
|
116
|
+
return { mainLine, contains, present, knownAll, shallow };
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
/* ---------- releases (npm gitHead) ---------- */
|
|
121
|
+
|
|
122
|
+
function semverCmp(a, b) {
|
|
123
|
+
const pa = String(a).split(/[.-]/).map((x) => (/^\d+$/.test(x) ? +x : x));
|
|
124
|
+
const pb = String(b).split(/[.-]/).map((x) => (/^\d+$/.test(x) ? +x : x));
|
|
125
|
+
for (let i = 0; i < Math.max(pa.length, pb.length); i++) {
|
|
126
|
+
const x = pa[i]; const y = pb[i];
|
|
127
|
+
if (x === undefined) return -1; if (y === undefined) return 1;
|
|
128
|
+
if (x === y) continue;
|
|
129
|
+
if (typeof x === 'number' && typeof y === 'number') return x - y;
|
|
130
|
+
return String(x) < String(y) ? -1 : 1;
|
|
131
|
+
}
|
|
132
|
+
return 0;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function cleanReleases(raw) {
|
|
136
|
+
const arr = Array.isArray(raw) ? raw : raw && typeof raw === 'object' ? [raw] : [];
|
|
137
|
+
return arr.filter((r) => r && /^\d+\.\d+\.\d+$/.test(r.version) && /^[0-9a-f]{40}$/.test(r.gitHead || ''))
|
|
138
|
+
.map((r) => ({ version: r.version, gitHead: r.gitHead })).sort((a, b) => semverCmp(a.version, b.version));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/** Every published version with its gitHead: from npm now, else from the last saved read, else none. Never throws. */
|
|
142
|
+
function readReleases({ root, pkg, npmView = (name) => require('./kit-update.js').releaseHeads(name), offline = false, now = Date.now() } = {}) {
|
|
143
|
+
const cacheFile = path.join(root, CACHE);
|
|
144
|
+
if (!offline && pkg) {
|
|
145
|
+
try {
|
|
146
|
+
const list = cleanReleases(JSON.parse(npmView(pkg)));
|
|
147
|
+
if (list.length) {
|
|
148
|
+
try { fs.mkdirSync(path.dirname(cacheFile), { recursive: true }); fs.writeFileSync(cacheFile, JSON.stringify({ pkg, at: new Date(now).toISOString(), releases: list }) + '\n'); } catch { /* a read-only checkout still answers */ }
|
|
149
|
+
return { list, source: 'registry', at: new Date(now).toISOString() };
|
|
150
|
+
}
|
|
151
|
+
} catch { /* fall back to the saved read */ }
|
|
152
|
+
}
|
|
153
|
+
try {
|
|
154
|
+
const saved = JSON.parse(fs.readFileSync(cacheFile, 'utf8'));
|
|
155
|
+
const list = cleanReleases(saved.releases);
|
|
156
|
+
if (list.length && (!pkg || saved.pkg === pkg)) return { list, source: 'saved', at: saved.at || null };
|
|
157
|
+
} catch { /* none saved */ }
|
|
158
|
+
return { list: [], source: 'none', at: null, error: offline ? 'offline, and no saved read of the releases' : 'npm did not answer, and no saved read of the releases' };
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* ---------- the registry's own rules ---------- */
|
|
162
|
+
|
|
163
|
+
function findKeys(obj, keys, at = '') {
|
|
164
|
+
const hits = [];
|
|
165
|
+
if (Array.isArray(obj)) obj.forEach((v, i) => hits.push(...findKeys(v, keys, `${at}[${i}]`)));
|
|
166
|
+
else if (obj && typeof obj === 'object') for (const [k, v] of Object.entries(obj)) {
|
|
167
|
+
if (keys.includes(k.toLowerCase())) hits.push(`${at}.${k}`.replace(/^\./, ''));
|
|
168
|
+
hits.push(...findKeys(v, keys, `${at}.${k}`));
|
|
169
|
+
}
|
|
170
|
+
return hits;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function guideSections(root, dir) {
|
|
174
|
+
const out = new Map(); // page → [heading]
|
|
175
|
+
let names = [];
|
|
176
|
+
try { names = fs.readdirSync(path.join(root, dir)).filter((n) => n.endsWith('.md') && n !== 'index.md' && n !== 'log.md').sort(); } catch { return out; }
|
|
177
|
+
for (const n of names) {
|
|
178
|
+
const text = fs.readFileSync(path.join(root, dir, n), 'utf8');
|
|
179
|
+
out.set(n, text.split('\n').filter((l) => /^## /.test(l)).map((l) => l.slice(3).trim()));
|
|
180
|
+
}
|
|
181
|
+
return out;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function check(registry, { root } = {}) {
|
|
185
|
+
const problems = [];
|
|
186
|
+
const r = registry || {};
|
|
187
|
+
for (const k of findKeys(r, FORBIDDEN_KEYS)) problems.push(`${k}: a status is derived, never written. Remove the key and cite evidence instead.`);
|
|
188
|
+
if (!r.what || typeof r.what !== 'string') problems.push('what: say in one or two sentences what the product is.');
|
|
189
|
+
const surfaces = Array.isArray(r.surfaces) ? r.surfaces : [];
|
|
190
|
+
if (!surfaces.length) problems.push('surfaces: list the product\'s surfaces.');
|
|
191
|
+
const sIds = new Set();
|
|
192
|
+
for (const s of surfaces) { if (!s || !ID_RE.test(s.id || '')) problems.push(`surface ${JSON.stringify(s && s.id)}: an id is lowercase words with hyphens.`); else if (sIds.has(s.id)) problems.push(`surface ${s.id}: listed twice.`); else sIds.add(s.id); }
|
|
193
|
+
const feats = Array.isArray(r.features) ? r.features : [];
|
|
194
|
+
if (!feats.length) problems.push('features: the registry lists no feature.');
|
|
195
|
+
const ids = new Set();
|
|
196
|
+
const guide = root && r.sources && r.sources.guide ? guideSections(root, r.sources.guide) : null;
|
|
197
|
+
for (const f of feats) {
|
|
198
|
+
const id = f && f.id;
|
|
199
|
+
const at = `feature ${id || '(no id)'}`;
|
|
200
|
+
if (!ID_RE.test(id || '')) { problems.push(`${at}: an id is lowercase words with hyphens.`); continue; }
|
|
201
|
+
if (ids.has(id)) problems.push(`${at}: the id is used twice.`); ids.add(id);
|
|
202
|
+
for (const k of Object.keys(f)) if (!FEATURE_KEYS.includes(k)) problems.push(`${at}: unknown key "${k}" (keys: ${FEATURE_KEYS.join(', ')}).`);
|
|
203
|
+
if (!f.name) problems.push(`${at}: give it a name.`);
|
|
204
|
+
if (!sIds.has(f.surface)) problems.push(`${at}: surface "${f.surface}" is not in surfaces.`);
|
|
205
|
+
for (const k of ['prs', 'retired_by']) if (f[k] !== undefined && (!Array.isArray(f[k]) || !f[k].every((n) => Number.isInteger(n) && n > 0))) problems.push(`${at}: ${k} is a list of PR numbers.`);
|
|
206
|
+
for (const k of ['files', 'guide', 'design']) if (f[k] !== undefined && (!Array.isArray(f[k]) || !f[k].every((x) => typeof x === 'string' && x))) problems.push(`${at}: ${k} is a list of strings.`);
|
|
207
|
+
if (f.initiative !== undefined && !/^[a-z0-9][a-z0-9._-]*$/.test(f.initiative)) problems.push(`${at}: initiative is an experiment record id.`);
|
|
208
|
+
if (root && f.initiative && !fs.existsSync(path.join(root, 'planning', 'initiatives', f.initiative + '.md'))) problems.push(`${at}: no record planning/initiatives/${f.initiative}.md.`);
|
|
209
|
+
if (guide) for (const g of f.guide || []) {
|
|
210
|
+
const [page, heading] = g.split('#');
|
|
211
|
+
if (!guide.has(page)) problems.push(`${at}: guide page ${page} is not in ${r.sources.guide}.`);
|
|
212
|
+
else if (heading !== undefined && !guide.get(page).includes(heading)) problems.push(`${at}: ${page} has no section "## ${heading}".`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return problems;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
/* ---------- derivation ---------- */
|
|
219
|
+
|
|
220
|
+
function recordOf(root, id) {
|
|
221
|
+
try {
|
|
222
|
+
const text = fs.readFileSync(path.join(root, 'planning', 'initiatives', id + '.md'), 'utf8');
|
|
223
|
+
const fm = (text.match(/^---\n([\s\S]*?)\n---/) || [])[1] || '';
|
|
224
|
+
const dt = (fm.match(/^done_test_path:\s*["']?([^"'\n]+?)["']?\s*$/m) || [])[1];
|
|
225
|
+
return { exists: true, doneTest: !!dt && fs.existsSync(path.join(root, dt.trim())), doneTestPath: dt || null };
|
|
226
|
+
} catch { return { exists: false }; }
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function derive(registry, { root, releases = [], git = gitIn(root) } = {}) {
|
|
230
|
+
const known = git.knownAll(releases.map((r) => r.gitHead));
|
|
231
|
+
const rel = releases.filter((_, i) => known[i]);
|
|
232
|
+
const L = git.mainLine();
|
|
233
|
+
const shallow = typeof git.shallow === 'function' && git.shallow();
|
|
234
|
+
const relMissing = shallow && rel.length < releases.length; // older releases whose commits this clone does not hold
|
|
235
|
+
const cut = 'older than this shallow clone\'s history';
|
|
236
|
+
const firstReleaseWith = (sha) => { for (const r of rel) if (git.contains(r.gitHead, sha)) return r.version; return null; };
|
|
237
|
+
const unknown = (out, reason) => { out.status = 'Unknown'; out.version = null; out.why.push(reason); return out; };
|
|
238
|
+
const feats = (registry.features || []).map((f) => {
|
|
239
|
+
const why = [];
|
|
240
|
+
const prs = (f.prs || []).map((n) => ({ n, c: L.byPr.get(n) || null }));
|
|
241
|
+
const merged = prs.filter((p) => p.c);
|
|
242
|
+
const open = prs.filter((p) => !p.c);
|
|
243
|
+
const files = (f.files || []).filter((p) => !p.startsWith('prototype/'));
|
|
244
|
+
const protos = (f.files || []).filter((p) => p.startsWith('prototype/'));
|
|
245
|
+
const headHas = git.present(files.map((p) => ['HEAD', p]));
|
|
246
|
+
const out = { ...f, status: 'Idea', version: null, why };
|
|
247
|
+
const missing = shallow ? open : []; // on a shallow clone a PR not found may simply be merged before the cut-off
|
|
248
|
+
const list = (ps) => ps.map((p) => '#' + p.n).join(', ');
|
|
249
|
+
|
|
250
|
+
// Retired: a retiring PR is merged, or every cited file is gone now and was in a release.
|
|
251
|
+
const retiringAll = (f.retired_by || []).map((n) => ({ n, c: L.byPr.get(n) || null }));
|
|
252
|
+
const retiring = retiringAll.filter((p) => p.c);
|
|
253
|
+
if (!retiring.length && shallow && retiringAll.length) return unknown(out, `retiring ${list(retiringAll)} not found: it may be ${cut}`);
|
|
254
|
+
if (retiring.length) {
|
|
255
|
+
const first = retiring.sort((a, b) => b.c.idx - a.c.idx)[0];
|
|
256
|
+
out.status = 'Retired'; out.version = rel.length ? firstReleaseWith(first.c.sha) : null;
|
|
257
|
+
why.push(`#${first.n} retired it${out.version ? `, released in ${out.version}` : rel.length ? ', not released yet' : ''}`);
|
|
258
|
+
return out;
|
|
259
|
+
}
|
|
260
|
+
if (files.length && headHas.every((x) => !x) && rel.length) {
|
|
261
|
+
const inRel = git.present(rel.flatMap((r) => files.map((p) => [r.gitHead, p])));
|
|
262
|
+
let last = -1; inRel.forEach((x, i) => { if (x) last = Math.floor(i / files.length); });
|
|
263
|
+
if (last >= 0) {
|
|
264
|
+
out.status = 'Retired'; out.version = rel[last + 1] ? rel[last + 1].version : null;
|
|
265
|
+
why.push(`its files are gone; last in ${rel[last].version}`);
|
|
266
|
+
return out;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
if (shallow && files.length && headHas.every((x) => !x) && relMissing) return unknown(out, `its files are gone and in no release this clone holds: they may have shipped ${cut}`);
|
|
270
|
+
|
|
271
|
+
// Live / In build: merged PRs and files present now.
|
|
272
|
+
const built = merged.length > 0 || headHas.some(Boolean);
|
|
273
|
+
if (built) {
|
|
274
|
+
if (!rel.length && relMissing) return unknown(out, 'merged, but this shallow clone holds none of the releases, so release or build cannot be told');
|
|
275
|
+
if (!rel.length) { out.status = 'Live'; out.version = '?'; why.push('merged; no release data, so the version is unknown'); return out; }
|
|
276
|
+
let best = null;
|
|
277
|
+
for (const p of merged) { const v = firstReleaseWith(p.c.sha); if (v && (!best || semverCmp(v, best.v) < 0)) best = { v, by: `#${p.n}` }; }
|
|
278
|
+
if (files.length) { // a file can predate every cited PR: the feature was live from the first release that had it
|
|
279
|
+
const inRel = git.present(rel.flatMap((r) => files.map((p) => [r.gitHead, p])));
|
|
280
|
+
const i = inRel.findIndex(Boolean);
|
|
281
|
+
if (i >= 0) { const v = rel[Math.floor(i / files.length)].version; if (!best || semverCmp(v, best.v) < 0) best = { v, by: files[i % files.length] }; }
|
|
282
|
+
}
|
|
283
|
+
if (best) {
|
|
284
|
+
out.status = 'Live'; out.version = best.v; why.push(`${best.by} first shipped in ${best.v}`);
|
|
285
|
+
// Older releases are missing here: a cited PR outside the history, or a file, may have shipped in one of them.
|
|
286
|
+
if (relMissing && (missing.length || files.length)) { out.atMost = true; why.push(`it may have shipped earlier, in a release ${cut}`); }
|
|
287
|
+
const later = merged.filter((p) => !firstReleaseWith(p.c.sha)).map((p) => '#' + p.n);
|
|
288
|
+
if (later.length) why.push(`${later.join(', ')} merged, not released yet`);
|
|
289
|
+
if (open.length) why.push(shallow ? `${list(open)} not in this clone's history` : `${list(open)} not merged yet`);
|
|
290
|
+
return out;
|
|
291
|
+
}
|
|
292
|
+
if (missing.length) return unknown(out, `${list(merged) || 'its files'} merged, in no release yet; ${list(missing)} not found: it may be ${cut}`);
|
|
293
|
+
out.status = 'In build'; why.push(`${merged.map((p) => '#' + p.n).join(', ') || 'its files'} merged, in no release yet`);
|
|
294
|
+
return out;
|
|
295
|
+
}
|
|
296
|
+
if (missing.length) return unknown(out, `${list(missing)} not found: it may be merged ${cut}`);
|
|
297
|
+
if (open.length) { out.status = 'In build'; why.push(`${open.map((p) => '#' + p.n).join(', ')} not merged yet`); return out; }
|
|
298
|
+
|
|
299
|
+
// Agreed / Exploring: the experiment record, or a prototype.
|
|
300
|
+
const rec = f.initiative ? recordOf(root, f.initiative) : { exists: false };
|
|
301
|
+
if (rec.exists && rec.doneTest) { out.status = 'Agreed'; why.push(`record ${f.initiative} has its done test`); return out; }
|
|
302
|
+
const protoNow = git.present(protos.map((p) => ['HEAD', p])).some(Boolean);
|
|
303
|
+
if (rec.exists || protoNow) { out.status = 'Exploring'; why.push(rec.exists ? `record ${f.initiative} has no done test yet` : `prototype ${protos[0]}`); return out; }
|
|
304
|
+
why.push('no record, PR or file yet');
|
|
305
|
+
return out;
|
|
306
|
+
});
|
|
307
|
+
return { features: feats, releases: rel, shallow, commits: L.list.length };
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
function label(f) { return f.status === 'Live' || (f.status === 'Retired' && f.version) ? `${f.status} ${f.atMost ? '≤' : ''}${f.version || ''}`.trim() : f.status; }
|
|
311
|
+
|
|
312
|
+
/** What no feature cites: guide sections, and feature changes on the default line since the release before `from`. */
|
|
313
|
+
function unplaced(registry, { root, releases = [], git = gitIn(root) } = {}) {
|
|
314
|
+
const feats = registry.features || [];
|
|
315
|
+
const cites = new Set(feats.flatMap((f) => f.guide || []));
|
|
316
|
+
const guide = [];
|
|
317
|
+
const src = registry.sources || {};
|
|
318
|
+
for (const [page, heads] of guideSections(root, src.guide || 'workspace/guide')) {
|
|
319
|
+
if (cites.has(page)) continue;
|
|
320
|
+
for (const h of heads) if (!cites.has(`${page}#${h}`)) guide.push(`${page}#${h}`);
|
|
321
|
+
}
|
|
322
|
+
const prs = new Set(feats.flatMap((f) => [...(f.prs || []), ...(f.retired_by || [])]));
|
|
323
|
+
const from = src.releases && src.releases.from;
|
|
324
|
+
const changes = []; const other = [];
|
|
325
|
+
let range = null;
|
|
326
|
+
const older = from ? releases.filter((r) => semverCmp(r.version, from) < 0) : [];
|
|
327
|
+
const okOlder = git.knownAll(older.map((r) => r.gitHead));
|
|
328
|
+
const before = older.filter((_, i) => okOlder[i]).pop() || null;
|
|
329
|
+
if (from && before) {
|
|
330
|
+
range = { from, base: before.version };
|
|
331
|
+
const L = git.mainLine();
|
|
332
|
+
const base = L.bySha.get(before.gitHead);
|
|
333
|
+
for (const c of L.list) {
|
|
334
|
+
if (base && c.idx >= base.idx) break;
|
|
335
|
+
if (!base && git.contains(before.gitHead, c.sha)) break;
|
|
336
|
+
const nums = prNumbers(c.subject);
|
|
337
|
+
const row = { sha: c.sha.slice(0, 8), prs: nums, subject: c.subject };
|
|
338
|
+
if (FEATURE_CHANGE.test(c.subject)) { if (!nums.some((n) => prs.has(n))) changes.push(row); } else other.push(row);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
return { guide, changes, other, range };
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
module.exports = { STATUSES, REGISTRY, CACHE, FEATURE_KEYS, load, check, derive, unplaced, readReleases, label, gitIn, prNumbers, semverCmp, cleanReleases, guideSections };
|
|
@@ -345,4 +345,11 @@ function upgradeApp(root, { version, logFile, spawn = cp.spawn, env = updateEnv(
|
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
|
|
348
|
-
|
|
348
|
+
/** Every published version with its gitHead, as npm's JSON text (`pmos blueprint`, lib/blueprint.js). A terminal command
|
|
349
|
+
* the PM runs; read-only; the one other caller of npm besides Settings › Updates, kept here so npm stays in one module. */
|
|
350
|
+
function releaseHeads(pkg = PKG_NAME, { exec = cp.execFileSync } = {}) {
|
|
351
|
+
return String(exec(NPM, ['view', `${pkg}@>=0.0.0`, 'version', 'gitHead', '--json'],
|
|
352
|
+
{ encoding: 'utf8', timeout: 20000, stdio: ['ignore', 'pipe', 'ignore'], windowsHide: true, shell: IS_WIN }));
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
module.exports = { PKG_NAME, releaseHeads, windowsHop, appUpdateCommand, cmpVer, readChanges, readLastCheck, writeLastCheck, notServedYet, validVersion, source, npxArgs, readKit, fromCheckout, status, compare, latest, updateKit, updateEnv, upgradeApp, whereFrom };
|
|
@@ -76,6 +76,9 @@ const VERBS = Object.freeze({
|
|
|
76
76
|
task: Object.freeze({ module: 'task-cli.js', run: null, guide: 'cli.md',
|
|
77
77
|
help: 'pmos task add|list|state|set … — an initiative\'s tasks: add one, list them, set their state or group them under a stage when the PM asks (pmos task help)' }),
|
|
78
78
|
// Not a pm-os-absorb verb (run: null): feedback batch 4 item 6 (Claude suggests program milestones) added it through the same table.
|
|
79
|
+
// Not a pm-os-absorb verb (run: null): product-blueprint-registry (batch 30 item 1, round 2) added it through the same table.
|
|
80
|
+
blueprint: Object.freeze({ module: 'blueprint-cli.js', run: null, guide: 'cli.md',
|
|
81
|
+
help: 'pmos blueprint [list|show|unplaced|check] — every feature of the product with a status worked out from its evidence (pmos blueprint help)' }),
|
|
79
82
|
program: Object.freeze({ module: 'program-cli.js', run: null, guide: 'cli.md',
|
|
80
83
|
help: 'pmos program suggest — Claude\'s milestone suggestions for a program, filed by its review run (pmos program help)' }),
|
|
81
84
|
// Not a pm-os-absorb verb (run: null): c3-meet-extension added it through the same table.
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.564.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.564.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_comment": "Batch 30 item 1 round 2, the product blueprint (initiative product-blueprint-registry): lib/blueprint.js derives each feature's status from git, the experiment records and npm gitHead; lib/blueprint-cli.js is `pmos blueprint`. A scratch git repository; no network, no server, no browser.",
|
|
3
|
+
"modules": [
|
|
4
|
+
"blueprint.test.js"
|
|
5
|
+
],
|
|
6
|
+
"seconds": {
|
|
7
|
+
"blueprint.test.js": 3
|
|
8
|
+
}
|
|
9
|
+
}
|