create-pmos 0.848.0 → 0.850.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-pmos",
3
- "version": "0.848.0",
3
+ "version": "0.850.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,71 @@
33
33
  "audit"
34
34
  ],
35
35
  "pmosChanges": [
36
+ {
37
+ "v": "0.850.0",
38
+ "at": "2026-11-25T20:45:33.395Z",
39
+ "f": 4,
40
+ "prs": [
41
+ {
42
+ "n": 1950,
43
+ "t": "Compare two items side by side, the differences marked (job #1919, A421)",
44
+ "s": "Compare two items side by side, the differences marked (job #1919, A421)",
45
+ "k": "new",
46
+ "h": "Compare two items side by side, the differences marked (job #1919, A421)",
47
+ "try": {
48
+ "steps": [
49
+ "Open Work and tick exactly two tasks",
50
+ "Press the Compare icon in the bar under them",
51
+ "Read the rows that differ, press the swap icon, then fold open the rows that are the same"
52
+ ],
53
+ "see": "One compare panel opens beside the list: the two titles at the top, each field on one row, the rows that differ with a dot and a tint, and one line that says how many rows are the same. With one or…",
54
+ "open": "/premium-board.html"
55
+ },
56
+ "i": "compare-items"
57
+ },
58
+ {
59
+ "n": 1957,
60
+ "t": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
61
+ "s": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
62
+ "k": "new",
63
+ "h": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
64
+ "try": {
65
+ "steps": [
66
+ "Open Library: the This week block sits above the list by itself, with no ask",
67
+ "Press the wrench on a row to add a task that fixes the code, or the page to add a task that updates the spec",
68
+ "Open Work, open the spec's initiative and find the new task"
69
+ ],
70
+ "see": "One row per mismatch with what the spec says, what the code does and both dates. The press adds a task to the initiative and the row says task added, with Undo. With no mismatch, there is no block",
71
+ "open": "/premium-library.html"
72
+ },
73
+ "i": "spec-code-drift"
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "v": "0.849.0",
79
+ "at": "2026-11-25T18:55:50.990Z",
80
+ "f": 4,
81
+ "prs": [
82
+ {
83
+ "n": 2057,
84
+ "t": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
85
+ "s": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
86
+ "k": "new",
87
+ "i": "balance-rebalance",
88
+ "h": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
89
+ "try": {
90
+ "steps": [
91
+ "On Today, find the row in Your move that proposes a target mix for the top of your roadmap, drawn from the roadmap itself. Press its ✦ to…",
92
+ "The row then names the rank move that closes the most gap. Press its ✦, check the Roadmap on Work, then press Undo",
93
+ "Open the chat (Ask PMOS). On a desk the chat opens from the menu button at the bottom left, then the speech bubble. Say: set my roadmap…"
94
+ ],
95
+ "see": "When the top of the roadmap leans one way, Today proposes a target mix by itself and ✦ saves it. Then a Today row names the one rank move that closes the most gap. ✦ makes that rank move and Undo…",
96
+ "open": "/today.html"
97
+ }
98
+ }
99
+ ]
100
+ },
36
101
  {
37
102
  "v": "0.848.0",
38
103
  "at": "2026-11-25T18:33:59.152Z",
@@ -43,6 +108,7 @@
43
108
  "t": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
44
109
  "s": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
45
110
  "k": "new",
111
+ "i": "change-requests",
46
112
  "h": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
47
113
  "try": {
48
114
  "steps": [
@@ -52,8 +118,7 @@
52
118
  ],
53
119
  "see": "Each open change request is a Today row by itself, naming who asked and what it would break. Approve records your answer and Undo takes it back. A new ask from the chat is recorded with an id and…",
54
120
  "open": "/today.html"
55
- },
56
- "i": "change-requests"
121
+ }
57
122
  }
58
123
  ]
59
124
  },
@@ -954,142 +1019,6 @@
954
1019
  "i": "arch-warns"
955
1020
  }
956
1021
  ]
957
- },
958
- {
959
- "v": "0.826.0",
960
- "at": "2026-11-25T11:36:40.845Z",
961
- "f": 4,
962
- "prs": [
963
- {
964
- "n": 1973,
965
- "t": "What PMOS can do lists every pmos verb (A540)",
966
- "s": "What PMOS can do lists every pmos verb (A540)",
967
- "k": "new",
968
- "i": "directory-all-verbs"
969
- },
970
- {
971
- "n": 1944,
972
- "t": "A map of the product's code on Work, one box per main part (job #1900, A176)",
973
- "s": "A map of the product's code on Work, one box per main part (job #1900, A176)",
974
- "k": "new",
975
- "i": "code-map",
976
- "h": "A map of the product's code on Work, one box per main part (job #1900, A176)",
977
- "try": {
978
- "steps": [
979
- "Open Work and pick one product",
980
- "Under the strategy, read the Code map: one box per main part",
981
- "Ask the chat: say the api part is the public REST API"
982
- ],
983
- "see": "One box per main folder of the product's repository, each with what it is, how it is tested and who changed it last. A part with no tests or many recent fixes is tinted and says why. After the chat…",
984
- "open": "/premium-board.html"
985
- }
986
- },
987
- {
988
- "n": 1969,
989
- "t": "Today rearranges to the day, with a quiet line and a pin (job #1914, A310)",
990
- "s": "Today rearranges to the day, with a quiet line and a pin (job #1914, A310)",
991
- "k": "new",
992
- "i": "today-order",
993
- "h": "Today rearranges to the day, with a quiet line and a pin (job #1914, A310)",
994
- "try": {
995
- "steps": [
996
- "Open Today on a Monday, a Friday, a day with 3 or more meetings, or the day one of your initiatives ships",
997
- "Read the quiet line under the page head and press the lock icon beside it",
998
- "Open Today again tomorrow and press the lock icon to unpin"
999
- ],
1000
- "see": "The same blocks show in a different order, and one line says why (for example 'Ordered for Monday · from your calendar'). After the pin the line says the order is pinned and the order stays the same…",
1001
- "open": "/today.html"
1002
- }
1003
- },
1004
- {
1005
- "n": 1972,
1006
- "t": "Popup four learn from a full 30-day use log (A498)",
1007
- "s": "Popup four learn from a full 30-day use log (A498)",
1008
- "k": "fix",
1009
- "i": "popup-cap"
1010
- },
1011
- {
1012
- "n": 1975,
1013
- "t": "Settings opens again; features rows for code and connectors",
1014
- "s": "Settings opens again; features rows for code and connectors",
1015
- "k": "fix",
1016
- "i": "connector-data",
1017
- "h": "Settings opens again; features rows for code and connectors",
1018
- "try": {
1019
- "steps": [
1020
- "Open Today",
1021
- "Open Settings from the rail",
1022
- "Open What PMOS can do and find Code map"
1023
- ],
1024
- "see": "Settings opens, and Connectors and What PMOS does alone both show; Code map and What connectors read and write are listed"
1025
- }
1026
- }
1027
- ]
1028
- },
1029
- {
1030
- "v": "0.825.0",
1031
- "at": "2026-11-25T10:33:55.582Z",
1032
- "f": 4,
1033
- "prs": [
1034
- {
1035
- "n": 1939,
1036
- "t": "Settings › What PMOS does alone, one read-only table of each kind of action (A513)",
1037
- "s": "Settings › What PMOS does alone, one read-only table of each kind of action (A513)",
1038
- "k": "new",
1039
- "i": "does-alone"
1040
- },
1041
- {
1042
- "n": 1949,
1043
- "t": "Names in a Today line link to the person, meeting or document (job #1915, A536)",
1044
- "s": "Names in a Today line link to the person, meeting or document (job #1915, A536)",
1045
- "k": "new",
1046
- "i": "name-links",
1047
- "h": "Names in a Today line link to the person, meeting or document (job #1915, A536)",
1048
- "try": {
1049
- "steps": [
1050
- "Open Today",
1051
- "In the capture line type a line that names a person from People or a meeting you took notes in, for example 'Follow up on Azhar's notes…",
1052
- "Point at or tap the underlined name"
1053
- ],
1054
- "see": "The names that match one record are underlined. A small card shows the record (a meeting's date, people and notes) with one press: Open the notes, Open the document, or Ask PMOS about the person. A…",
1055
- "open": "/today.html"
1056
- }
1057
- },
1058
- {
1059
- "n": 1953,
1060
- "t": "What each connector reads and writes (job #1920, A150)",
1061
- "s": "What each connector reads and writes (job #1920, A150)",
1062
- "k": "new",
1063
- "i": "connector-data",
1064
- "h": "What each connector reads and writes (job #1920, A150)",
1065
- "try": {
1066
- "steps": [
1067
- "On Today, open Settings from the rail and go to Connectors.",
1068
- "Read the one line under Jira (or any connector you have).",
1069
- "Press the arrow on that row to open its page."
1070
- ],
1071
- "see": "Each connected row says in one line what PMOS reads and writes. The page shows What PMOS reads, What PMOS writes and What leaves this computer, with a switch only where PMOS can really stop the read.",
1072
- "open": "/today.html"
1073
- }
1074
- },
1075
- {
1076
- "n": 1941,
1077
- "t": "Hold the phone chat mic to talk (job #1891, A13)",
1078
- "s": "Hold the phone chat mic to talk (job #1891, A13)",
1079
- "k": "new",
1080
- "i": "hold-to-talk",
1081
- "h": "Hold the phone chat mic to talk (job #1891, A13)",
1082
- "try": {
1083
- "steps": [
1084
- "On a phone, open Today and its chat.",
1085
- "Press and hold the mic, say what to change (for example: move <one of your tasks> a day), and let go.",
1086
- "Press Undo under PMOS's answer, then hold again and slide left before letting go."
1087
- ],
1088
- "see": "Your words show above the mic while you hold it; letting go sends them like typing, so the change is done with Undo (a question gets an answer); sliding left cancels and nothing is sent.",
1089
- "open": "/today.html"
1090
- }
1091
- }
1092
- ]
1093
1022
  }
1094
1023
  ]
1095
1024
  }
@@ -1,3 +1,3 @@
1
- kernel-source: pmos@86fc4382a
1
+ kernel-source: pmos@63a4025cb
2
2
  assembled: 2026-11-25
3
3
  mode: vendor
@@ -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-25T18:33:55Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T20:45:29Z"}
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-25T18:33:55Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T20:45:29Z"}
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-25T18:33:55Z"}
5
+ generated: {by: process:create-pmos, at: "2026-11-25T20:45:29Z"}
6
6
  status: stable
7
7
  ---
8
8
 
@@ -1,4 +1,69 @@
1
1
  [
2
+ {
3
+ "v": "0.850.0",
4
+ "at": "2026-11-25T20:45:33.395Z",
5
+ "f": 4,
6
+ "prs": [
7
+ {
8
+ "n": 1950,
9
+ "t": "Compare two items side by side, the differences marked (job #1919, A421)",
10
+ "s": "Compare two items side by side, the differences marked (job #1919, A421)",
11
+ "k": "new",
12
+ "h": "Compare two items side by side, the differences marked (job #1919, A421)",
13
+ "try": {
14
+ "steps": [
15
+ "Open Work and tick exactly two tasks",
16
+ "Press the Compare icon in the bar under them",
17
+ "Read the rows that differ, press the swap icon, then fold open the rows that are the same"
18
+ ],
19
+ "see": "One compare panel opens beside the list: the two titles at the top, each field on one row, the rows that differ with a dot and a tint, and one line that says how many rows are the same. With one or…",
20
+ "open": "/premium-board.html"
21
+ },
22
+ "i": "compare-items"
23
+ },
24
+ {
25
+ "n": 1957,
26
+ "t": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
27
+ "s": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
28
+ "k": "new",
29
+ "h": "Library › Drift lists specs and code that no longer match (job #1902, A495)",
30
+ "try": {
31
+ "steps": [
32
+ "Open Library: the This week block sits above the list by itself, with no ask",
33
+ "Press the wrench on a row to add a task that fixes the code, or the page to add a task that updates the spec",
34
+ "Open Work, open the spec's initiative and find the new task"
35
+ ],
36
+ "see": "One row per mismatch with what the spec says, what the code does and both dates. The press adds a task to the initiative and the row says task added, with Undo. With no mismatch, there is no block",
37
+ "open": "/premium-library.html"
38
+ },
39
+ "i": "spec-code-drift"
40
+ }
41
+ ]
42
+ },
43
+ {
44
+ "v": "0.849.0",
45
+ "at": "2026-11-25T18:55:50.990Z",
46
+ "f": 4,
47
+ "prs": [
48
+ {
49
+ "n": 2057,
50
+ "t": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
51
+ "s": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
52
+ "k": "new",
53
+ "i": "balance-rebalance",
54
+ "h": "A target mix for the roadmap and the rank move that closes the gap (job #2051)",
55
+ "try": {
56
+ "steps": [
57
+ "On Today, find the row in Your move that proposes a target mix for the top of your roadmap, drawn from the roadmap itself. Press its ✦ to…",
58
+ "The row then names the rank move that closes the most gap. Press its ✦, check the Roadmap on Work, then press Undo",
59
+ "Open the chat (Ask PMOS). On a desk the chat opens from the menu button at the bottom left, then the speech bubble. Say: set my roadmap…"
60
+ ],
61
+ "see": "When the top of the roadmap leans one way, Today proposes a target mix by itself and ✦ saves it. Then a Today row names the one rank move that closes the most gap. ✦ makes that rank move and Undo…",
62
+ "open": "/today.html"
63
+ }
64
+ }
65
+ ]
66
+ },
2
67
  {
3
68
  "v": "0.848.0",
4
69
  "at": "2026-11-25T18:33:59.152Z",
@@ -9,6 +74,7 @@
9
74
  "t": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
10
75
  "s": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
11
76
  "k": "new",
77
+ "i": "change-requests",
12
78
  "h": "Pmos change-request records a stakeholder's ask with what it would break (job #2024)",
13
79
  "try": {
14
80
  "steps": [
@@ -18,8 +84,7 @@
18
84
  ],
19
85
  "see": "Each open change request is a Today row by itself, naming who asked and what it would break. Approve records your answer and Undo takes it back. A new ask from the chat is recorded with an id and…",
20
86
  "open": "/today.html"
21
- },
22
- "i": "change-requests"
87
+ }
23
88
  }
24
89
  ]
25
90
  },
@@ -396,6 +396,14 @@ Write the press release before the build ("working backwards"). Run it in the pr
396
396
  - The draft uses one agent run with no tools. `--no-ai`, `pmos ai off press-release` or `PMOS_AI=off` makes a draft from the record's own lines only. A failed run does the same and says why.
397
397
  - `pmos press-release count [--days 7]` prints how many drafts were written in the last days. Its last line is the number.
398
398
 
399
+ ### pmos compare: two items side by side
400
+
401
+ See what changed between two items before you choose. Run it in the product's repository, or pass `--root <dir>`, or ask the chat to "compare the brief with its last version". No running workspace is needed. In Work, tick exactly two tasks and press Compare in the bar under them: the same rows open in one panel beside the list.
402
+
403
+ - `pmos compare <a> <b>` (or `pmos compare show <a> <b>`) compares two initiatives by id, or two files. Add `@<git revision>` to read a version: `pmos compare planning/prd/otp.md@HEAD~1 planning/prd/otp.md`.
404
+ - Fields (the record's frontmatter) line up row by row, and each `## ` section is a part compared in words: removed words show in `[-…-]`, added words in `{+…+}`. The rows that are the same are named in one line.
405
+ - `--json` gives every row. PMOS changes neither item and sends nothing.
406
+
399
407
  ### pmos story-map: the user's journey and the Release 1 line
400
408
 
401
409
  A story map for a new bet: the steps of the user's journey left to right, the tasks of each step top to bottom, and a dashed line under the thinnest release that still works end to end. The initiative popup on Work shows it, and the chat reads and writes the same map. Run it in the product's repository, or pass `--root <dir>`. No running workspace is needed.
@@ -536,6 +544,16 @@ See if a list leans too far one way, for example all features and no fixes. PMOS
536
544
  - A note shows only when one kind is more than your line of the list, and the list has 5 or more items. The line is 60% unless `--max <percent>` says otherwise. `--json` prints the counts as JSON.
537
545
  - Work shows the same mix as a thin bar under the header of the **Initiatives** list and of the **Backlog**. Press a kind in its legend to show only those items.
538
546
 
547
+ ### pmos balance target: a target mix for the roadmap
548
+
549
+ Say the mix you want at the top of the roadmap, and see which rank move gets you closer to it. PMOS never moves a rank by itself.
550
+
551
+ - `pmos balance target feature:50,fix:30,debt:20` saves the mix you want for the first 6 ranked initiatives of this repository. `--front <N>` sets another number. The kinds are feature, fix, debt, discovery and other, and the parts must add up to 100.
552
+ - `pmos balance target` shows the saved target. `pmos balance target --undo` puts the previous target back, and `pmos balance target --clear` removes it.
553
+ - `pmos balance gap` shows the mix of the top of the roadmap beside the target, and the gap in points (half the sum of the differences). It names at most 2 rank moves that close the most gap: an initiative of a kind under its target, from below the top, moved above one of a kind over its target. Each move is a `pmos initiative after` or `pmos initiative top` command, with the command that undoes it. `--json` prints the same as JSON.
554
+ - When the top of the roadmap is 15 points or more from the target and a move closes some of the gap, Today shows the best move in **Your move**. Press ✦ to make the move, and Undo to put the initiative back.
555
+ - With no target saved, Today can propose one in **Your move**: the mix of your whole roadmap, with the largest kind at most 60%, in steps of 10. It shows only when the top of the roadmap is 15 points or more from that mix and a rank move would help. Press ✦ to save it, and Undo to take it back.
556
+
539
557
  ### pmos decisions: a decision journal
540
558
 
541
559
  Write one line for each product decision, also one that is smaller than an initiative. Each decision has an expected outcome and a date to check it. Run the commands in the product's repository, or pass `--root <dir>`. The journal is `decision-journal.jsonl` in the runs folder (`pmos/state/` in a product, `planning/runs/` in PMOS itself). Commit it to keep it.
@@ -733,6 +751,19 @@ Only PMOS's impact run uses these. The server pins each run to your ledger. Outs
733
751
  - `pmos drift replay`: the replay of the last four weeks of this repository.
734
752
  - `pmos drift status`: the last weekly result and the replays on record.
735
753
 
754
+ #### pmos drift spec: specs and code that no longer match
755
+
756
+ Once a week PMOS compares each merged spec (an initiative's done test) with the code as it is now. Library shows the result in the "This week" block, one row per mismatch: what the spec says, what the code does now, and both dates. With no mismatch, there is no block.
757
+
758
+ A row comes from git only. No model reads the code. A spec row names the test that proves it. The check reads that test twice: when the spec landed, and now. A row shows when the test file is gone, when the test no longer names the row, or when a line that proved the row was rewritten. A test that never named its row, a moved test that still proves it, a line added beside the proof and a changed comment do not give a row.
759
+
760
+ - `pmos drift spec`: this week's rows for this repository, each with its row id. When this week has no result, it runs the check first. `--now` runs it again.
761
+ - `pmos drift spec fix <row>`: adds the task "Fix the code to match the spec" to the spec's initiative.
762
+ - `pmos drift spec update <row>`: adds the task "Update the spec" instead.
763
+ - `pmos drift spec undo <row>`: removes that task again. The row is open again.
764
+
765
+ The page writes the same record, in your runtime folder (`spec-drift/spec-drift.jsonl`), so a change from the chat shows in Library at once. `PMOS_SPEC_DRIFT=off` turns the check off. Nothing is sent.
766
+
736
767
  ### pmos design drift: places that do not read a design token
737
768
 
738
769
  The aim: change one token and every page follows. Each place this command counts is a place a token change does not reach.
@@ -144,6 +144,7 @@ An "off" switch accepts `off`, `0`, `false` or `no` unless the row says a differ
144
144
  | `PMOS_DESCRIPTIONS` | `off` stops the daily [initiative descriptions](claude-proposes.md). | on | `pmos ai off descriptions` |
145
145
  | `PMOS_OUTCOMES` | `off` stops the daily read for [expected outcomes](claude-proposes.md). | on | `pmos ai off outcomes` |
146
146
  | `PMOS_DRIFT` | `off` stops [what you might have missed](claude-proposes.md). | on | `pmos ai off drift` |
147
+ | `PMOS_SPEC_DRIFT` | `off` stops the weekly check of specs and code in Library (`pmos drift spec`). | on | — |
147
148
  | `PMOS_IMPACT` | `off` stops the daily read for [your impact](claude-proposes.md). | on | General › Your impact |
148
149
  | `PMOS_METRIC_DRAFT` | `off` stops the [metric drafts](claude-proposes.md). | on | — |
149
150
  | `PMOS_METRIC_READ` | `off` stops the goal reading runs. | on | — |
@@ -280,6 +281,7 @@ Do not set these on your own computer. The suites set them to make a run short o
280
281
  | `PMOS_CORE_DOCS_NOW` | A fixed clock for the core document drafts. | the real clock | — |
281
282
  | `PMOS_REFRESH_NOW` | A fixed clock for the refresh runs. | the real clock | — |
282
283
  | `PMOS_DRIFT_NOW` | A fixed clock for what you might have missed. | the real clock | — |
284
+ | `PMOS_SPEC_DRIFT_NOW` | A fixed clock for the weekly check of specs and code. | the real clock | — |
283
285
  | `PMOS_IMPACT_NOW` | A fixed clock for your impact. | the real clock | — |
284
286
  | `PMOS_MOMENTS_NOW` | A fixed clock for moments. | the real clock | — |
285
287
  | `PMOS_PACK_KEYS_RECORD` | A file path. A shared board's pack then keeps every key and writes each key path to that file, to grow the key list. For development only: never set it where you publish. | not set | — |
@@ -4,6 +4,9 @@
4
4
  * pmos balance show [--by kind|outcome] [--max <percent>] [--json] the roadmap: the live initiatives of this repository
5
5
  * pmos balance show --file <items.json> [--by …] [--max …] [--json] any list: a JSON array of items (ideas, backlog tasks), each with
6
6
  * its own kind, lane or type field, and an outcome field
7
+ * pmos balance target [<kind>:<pct>,…] [--front N] [--undo | --clear] [--json] the mix you want at the top of the roadmap (balance-rebalance)
8
+ * pmos balance gap [--json] how far the top of the roadmap is from it, and the 1-2 rank moves
9
+ * that close the most gap (lib/balance-target.js)
7
10
  * every command: [--root <dir>] (default: this repository)
8
11
  *
9
12
  * It prints the counts, one bar of the mix, and a quiet note only when one kind passes the line (default 60%). Each run writes one
@@ -13,15 +16,19 @@ const fs = require('fs');
13
16
  const path = require('path');
14
17
  const B = require('./list-balance.js');
15
18
 
16
- const COMMANDS = { balance: ['show'] };
19
+ const COMMANDS = { balance: ['show', 'target', 'gap'] };
17
20
  const USAGE = [
18
21
  'usage: pmos balance show — the mix of a list in one line: feature, fix, debt, discovery, or with and without an expected outcome',
19
22
  ' pmos balance show [--by kind|outcome] [--max <percent>] [--json] the roadmap: the live initiatives of this repository',
20
23
  ' pmos balance show --file <items.json> [--by kind|outcome] [--json] any list: a JSON array of items with a kind, lane or type field',
24
+ ' pmos balance target feature:50,fix:30,debt:20 [--front 6] save the mix you want for the first N ranked initiatives',
25
+ ' pmos balance target [--undo | --clear] show it, put the previous one back, or remove it',
26
+ ' pmos balance gap how far the top of the roadmap is from the target, and the rank moves that close it',
21
27
  'A note shows only when one kind is over the line (--max, default 60%). Run it in the product\'s repository, or pass --root <dir>.',
28
+ 'PMOS never moves a rank by itself: gap names the move, and you make it with pmos initiative after|top.',
22
29
  ];
23
- const ALLOWED = ['json', 'root', 'by', 'max', 'file'];
24
- const BOOL = new Set(['json']);
30
+ const ALLOWED = { show: ['json', 'root', 'by', 'max', 'file'], target: ['json', 'root', 'front', 'undo', 'clear'], gap: ['json', 'root'] };
31
+ const BOOL = new Set(['json', 'undo', 'clear']);
25
32
 
26
33
  function parse(args) {
27
34
  const pos = [], flags = {};
@@ -56,14 +63,15 @@ function bar(R) {
56
63
  return R.parts.map((p, i) => (GLYPH[p.key] || '·').repeat(cells[i])).join('');
57
64
  }
58
65
 
59
- async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), log = (s) => console.error(s) } = {}) {
66
+ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), log = (s) => console.error(s), env = process.env, stateDir = null, actor = null } = {}) {
60
67
  const args = argv[0] === 'balance' ? argv.slice(1) : argv.slice();
61
68
  const sub = args[0];
62
69
  if (!sub || ['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return sub ? 0 : 1; }
63
70
  if (!COMMANDS.balance.includes(sub)) { say(`unknown balance command "${sub}". Use one of: ${COMMANDS.balance.join(', ')}`); return 2; }
64
71
  const { pos, flags } = parse(args.slice(1));
65
- for (const k of Object.keys(flags)) if (!ALLOWED.includes(k)) { say(`✗ --${k} is not an option of pmos balance ${sub}`); return 2; }
72
+ for (const k of Object.keys(flags)) if (!ALLOWED[sub].includes(k)) { say(`✗ --${k} is not an option of pmos balance ${sub}`); return 2; }
66
73
  const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
74
+ if (sub === 'target' || sub === 'gap') return targetRun(sub, pos, flags, { say, cwd, log, env, stateDir, actor, fail });
67
75
  if (pos.length) return fail('usage: pmos balance show [--by kind|outcome] [--file <items.json>]', 2);
68
76
  if (flags.by !== undefined && !['kind', 'outcome'].includes(flags.by)) return fail('--by is kind or outcome', 2);
69
77
  if (flags.max !== undefined && !(Number(flags.max) > 0 && Number(flags.max) < 100)) return fail('--max is a percent between 1 and 99', 2);
@@ -86,4 +94,49 @@ async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), log
86
94
  return 0;
87
95
  }
88
96
 
97
+ /** `pmos balance target` and `pmos balance gap` (initiative balance-rebalance): lib/balance-target.js does the work. */
98
+ function targetRun(sub, pos, flags, { say, cwd, log, env, stateDir, actor, fail }) {
99
+ const T = require('./balance-target.js');
100
+ const root = path.resolve(flags.root || repoRoot(cwd));
101
+ const runtime = stateDir || require('./state-root.js').defaultRoot({ env });
102
+ const by = (actor || require('./actor.js').fromCli({ env })).by;
103
+ const json = !!flags.json;
104
+ const done = (o, text) => { if (json) say(JSON.stringify({ ok: true, ...o })); else for (const l of text) say(l); return 0; };
105
+ const savedWords = (s) => s ? `${T.mixWords(s.target)} for the top ${s.front} of the roadmap` : 'none';
106
+ if (sub === 'target') {
107
+ if (flags.undo && flags.clear) return fail('--undo or --clear, not both', 2);
108
+ if ((flags.undo || flags.clear) && (pos.length || flags.front !== undefined)) return fail(`--${flags.undo ? 'undo' : 'clear'} takes no mix`, 2);
109
+ if (pos.length > 1) return fail('usage: pmos balance target feature:50,fix:30,debt:20 [--front 6]', 2);
110
+ if (flags.undo || flags.clear) {
111
+ const r = flags.undo ? T.undoTarget(runtime, root, { by }) : T.clearTarget(runtime, root, { by });
112
+ if (!r.ok) return fail(r.error);
113
+ return done({ target: r.saved }, [flags.undo ? `✓ Target put back: ${savedWords(r.saved)}.` : '✓ Target removed. pmos balance target --undo puts it back.']);
114
+ }
115
+ if (!pos.length) {
116
+ if (flags.front !== undefined) return fail('--front goes with a mix, e.g. pmos balance target feature:50,fix:50 --front 8', 2);
117
+ const s = T.targetOf(runtime, root);
118
+ return done({ target: s }, [s ? `Target: ${savedWords(s)}.` : 'No target yet. Save one: pmos balance target feature:50,fix:30,debt:20']);
119
+ }
120
+ const p = T.parseTarget(pos[0]);
121
+ if (!p.ok) return fail(p.error, 2);
122
+ const r = T.setTarget(runtime, root, p.target, { front: flags.front === undefined ? undefined : Number(flags.front), by });
123
+ if (!r.ok) return fail(r.error, 2);
124
+ const g = T.gapOf(T.ranked(root), r.saved.target, r.saved.front);
125
+ return done({ target: r.saved, gap: g.gap }, [`✓ Target saved: ${savedWords(r.saved)}.`, `The top of the roadmap is ${g.gap} points from it. pmos balance gap names the moves. Undo: pmos balance target --undo`]);
126
+ }
127
+ // gap
128
+ if (pos.length) return fail('usage: pmos balance gap', 2);
129
+ const s = T.targetOf(runtime, root);
130
+ if (!s) return done({ target: null, gap: null, moves: [] }, ['No target yet. Save one: pmos balance target feature:50,fix:30,debt:20']);
131
+ T.used(runtime, root, 'gap');
132
+ try { log(`${B.TAG} gap`); } catch { /* no log */ }
133
+ const list = T.ranked(root), g = T.gapOf(list, s.target, s.front), moves = T.movesOf(list, s.target, s.front);
134
+ const out = [`Top ${g.front.length} of the roadmap: ${T.mixWords(g.mix)}. Target: ${T.mixWords(s.target)}.`, `Gap: ${g.gap} point${g.gap === 1 ? '' : 's'}.`];
135
+ if (!g.gap) out.push('On target.');
136
+ else if (!moves.length) out.push('No rank move closes it: no initiative of an under-target kind waits below the top.');
137
+ else for (const m of moves) out.push(`✦ Move ${m.id} (${B.KIND_LABEL[m.kind]}) above ${m.above}: the gap goes to ${m.gapAfter}. ${m.cli} · Undo: ${m.undo}`);
138
+ if (moves.length) out.push('Nothing moved. Make a move with its command.');
139
+ return done({ target: s, mix: g.mix, gap: g.gap, front: g.front.map((x) => x.id), moves, moved: false }, out);
140
+ }
141
+
89
142
  module.exports = { run, COMMANDS, USAGE, bar };