create-pmos 0.784.0 → 0.785.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 +46 -46
- package/payload/AGENTS.md +160 -0
- package/payload/KIT-VERSION +1 -1
- package/payload/design-system/ui/components/Badge/README.md +2 -2
- package/payload/design-system/ui/components/Glyph/README.md +28 -0
- package/payload/design-system/ui/components/bundle.css +3 -0
- 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/bin/card-catalog-gen.js +22 -0
- package/workspace/board-columns-test.js +2 -2
- package/workspace/briefing-premium-insights-test.js +5 -4
- package/workspace/calm-timeline-test.js +4 -3
- package/workspace/changelog.json +45 -0
- package/workspace/design-system/ui/components/Badge/README.md +2 -2
- package/workspace/design-system/ui/components/Glyph/README.md +28 -0
- package/workspace/design-system/ui/components/bundle.css +3 -0
- package/workspace/guide/cli.md +8 -0
- package/workspace/guide/home.md +4 -3
- package/workspace/guide/index.md +2 -2
- package/workspace/guide/layout.md +16 -2
- package/workspace/lib/briefing-premium-agent.js +3 -0
- package/workspace/lib/card-catalog-gen.js +123 -0
- package/workspace/lib/cos-chat.js +1 -0
- package/workspace/lib/declined-asks.js +177 -0
- package/workspace/lib/declined-cli.js +87 -0
- package/workspace/lib/goal-chat.js +1 -0
- package/workspace/lib/initiative-chat.js +1 -0
- package/workspace/lib/jira-status.js +11 -2
- package/workspace/lib/live-events.js +99 -0
- package/workspace/lib/pmos-verbs.js +3 -0
- package/workspace/lib/program-chat.js +1 -0
- package/workspace/lib/report-chat.js +1 -0
- package/workspace/lib/route-modules.js +1 -0
- package/workspace/lib/routes-live-rows.js +30 -0
- package/workspace/lib/routes-slash.js +142 -2
- package/workspace/lib/task-cli.js +5 -3
- package/workspace/lib/workflow-chat.js +1 -0
- package/workspace/okr-goals-ui-test.js +3 -2
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/bd-cols.js +3 -1
- package/workspace/public/pm/bd-span.js +13 -7
- package/workspace/public/pm/bd-views.js +6 -3
- package/workspace/public/pm/bd-work-ds.css +1 -0
- package/workspace/public/pm/bd-work.js +15 -2
- package/workspace/public/pm/cozy-board.css +3 -0
- package/workspace/public/pm/cozy-insights.css +3 -4
- package/workspace/public/pm/ds-bridge.css +12 -0
- package/workspace/public/pm/goal-forecast.js +7 -4
- package/workspace/public/pm/home-app.js +5 -3
- package/workspace/public/pm/komorebi.css +1 -0
- package/workspace/public/pm/live-edit.js +34 -3
- package/workspace/public/pm/live-feed.js +42 -0
- package/workspace/public/pm/okr-list.js +5 -2
- package/workspace/public/pm/premium-board.js +2 -0
- package/workspace/public/pm/premium-insights.js +10 -4
- package/workspace/public/pm/premium-vw-doc.css +5 -0
- package/workspace/public/pm/premium-vw-doc.js +11 -31
- package/workspace/public/pm/premium-vw-file.js +13 -8
- package/workspace/public/pm/premium-vw-guide.css +9 -0
- package/workspace/public/pm/premium-vw-guide.js +20 -17
- package/workspace/public/pm/reading-view.js +44 -0
- package/workspace/public/pm/state-glyph.js +135 -0
- package/workspace/skills/jira-sync.skill +4 -3
- package/workspace/task-milestones-test.js +2 -2
- package/workspace/test-lists/a2ui-chat-rules.json +9 -0
- package/workspace/test-lists/a2ui-live-rows.json +9 -0
- package/workspace/test-lists/declined-asks.json +9 -0
- package/workspace/test-lists/state-glyph.json +5 -0
package/workspace/guide/home.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Today: your list, the chat, the Viewer, My work, documents and people"
|
|
4
4
|
description: "Today's list, Mentions, Your day, the chat and the Viewer; My work; documents and their copies; People; and the suggested next prompt."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-25
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Today
|
|
@@ -159,6 +159,7 @@ Press the name in the Viewer's header. The name becomes a field.
|
|
|
159
159
|
|
|
160
160
|
- Type the new name. Press Enter or the check to save it. Press Esc to stop without a change. An empty name is not saved.
|
|
161
161
|
- The new name shows at once in the list, the chat header, the Viewer, Work and the Timeline. The message **Renamed** has **Undo**.
|
|
162
|
+
- **A change from the chat shows at once.** When you ask the chat to add, move, close or delete a task, the row changes on Today, Work and an open task popup within a second, without the page reading its lists again. A change you make in one tab of the workspace shows in its other open tabs as soon as it is saved. A change that is not saved does not show in the other tabs.
|
|
162
163
|
- An initiative of another product renames in that product's own repository, the same as on Work.
|
|
163
164
|
- Only the name changes. The id, the record file, the links and the history stay the same.
|
|
164
165
|
- An initiative with a Jira epic shows **Rename the Jira epic too**. It is off by default. When you select it, Today opens the initiative's chat with the request typed. Send it to let your agent rename the epic in Jira. PMOS does not change Jira itself.
|
|
@@ -200,7 +201,7 @@ Press the round button at the bottom of the page (bottom left on a desktop, bott
|
|
|
200
201
|
- **Search** (⌘K) has **Ask PMOS: …** as its first row once you type two letters. On Work and in Intelligence, the page's own matches come first, then **Ask PMOS**. Press it to put your words in the chat.
|
|
201
202
|
- PMOS reads with the `pmos` commands and ends each answer with where it read from and how fresh it is, for example "Work · read now". A change inside PMOS comes back as a ✦ that you keep with ✓. Anything that leaves PMOS is a draft in the outbox. The chat never accepts a run, anchors or disposes an initiative, approves a contract or merges: it says where each one waits.
|
|
202
203
|
|
|
203
|
-
- **Guide** opens this guide's start page in the Viewer of the page you are on. A link to another guide page opens it in the same place; ← goes back. The guide opens wide
|
|
204
|
+
- **Guide** opens this guide's start page in the Viewer of the page you are on. A link to another guide page opens it in the same place; ← goes back. The guide opens wide and reads like every document: Contents at the left lists the page's sections and follows the scroll, and each section folds. The list icon at the top shows every page, by group, with Find a page. Where Contents is hidden (a narrow Viewer or a phone), a chip for each section sits above the page. The address `/premium-viewer.html?open=guide&page=<name>` opens one page on its own.
|
|
204
205
|
|
|
205
206
|
- The button has one dot. It is amber when a source is old, else blue when a call is yours in Your move. The dot shows on every page. When the menu is open, the blue dot is on **Today** and the amber dot is on **Settings**.
|
|
206
207
|
- When a source is old, **Settings** opens at **Connectors**, with the old source first.
|
|
@@ -233,7 +234,7 @@ There is no My work page. The list on Today is your list:
|
|
|
233
234
|
- A conversation opens at its latest message.
|
|
234
235
|
- A file that you send shows as a chip in your message, with a small picture for a photo. Press the chip to open the file beside the conversation.
|
|
235
236
|
- Your message shows as you typed it. Markdown that you paste (headings, lists, bold, code, tables) shows formatted.
|
|
236
|
-
- Type `/` to see every command: `/goal`, the commands built into Claude Code, and the commands and skills in the workspace's `.claude` folder and in your own `~/.claude` folder.
|
|
237
|
+
- Type `/` to see every command: `/goal`, then one `/pmos:` command for each button a PMOS card has (`/pmos:task-set` moves a task's dates; the list comes from the card catalog), the commands built into Claude Code, and the commands and skills in the workspace's `.claude` folder and in your own `~/.claude` folder.
|
|
237
238
|
- The mic types what you say into the box. **Stop** keeps the words, and **Discard** puts the box back. Both end listening at once.
|
|
238
239
|
- When Claude Code asks whether to trust the folder of a new chat, the chat shows the ask as a card: **Trust this folder** or **No, end the session**. Your first message waits until you answer, for up to 15 minutes, and is then sent. It is never typed into the question.
|
|
239
240
|
|
package/workspace/guide/index.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Guide: start here"
|
|
4
|
-
timestamp: 2026-11-
|
|
4
|
+
timestamp: 2026-11-25
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Guide: start here
|
|
8
8
|
|
|
9
9
|
This guide describes the PMOS workspace as it works today. It ships with the app. When a change alters how the workspace looks or behaves, the same change updates this guide.
|
|
10
10
|
|
|
11
|
-
To open the guide from any page, press the round menu button at the bottom of the page, then the **?** icon (Guide). The guide opens wide in the Viewer and uses its full width.
|
|
11
|
+
To open the guide from any page, press the round menu button at the bottom of the page, then the **?** icon (Guide). The guide opens wide in the Viewer and uses its full width. Each page reads like every document in PMOS: **Contents** at the left lists its sections and marks the one you are reading, and each section folds (the page keeps what you folded). The list icon at the top shows every page, by group, with **Find a page** on top; a group folds and stays folded. When the Viewer is narrow, or on a phone, one chip for each section sits above the page instead of Contents. A link to another guide page opens that page in the same place. Press ← to go back.
|
|
12
12
|
|
|
13
13
|
## The screen
|
|
14
14
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
type: Guide
|
|
3
3
|
title: "Layout and first run: the places, the navigation, the Viewer, the launcher and Adler"
|
|
4
4
|
description: "The places, the navigation at the left, the Viewer, the keys and the phone; the first run; when features appear; the PMOS app; and Adler."
|
|
5
|
-
timestamp: 2026-11-
|
|
5
|
+
timestamp: 2026-11-25
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Layout and first run
|
|
@@ -142,7 +142,7 @@ A document opened in the Viewer (a doc, spec, brief, report, weekly update, meet
|
|
|
142
142
|
- **Contents** at the left lists the sections and marks the one you are reading as you scroll. Press one to go to it. Below 1100 px wide, and on a phone, there is no Contents.
|
|
143
143
|
- Edit, Markdown, Health, Links, Copies, the report's Present, Print and Download, the Edit log and Proposals are where they were. An agent's edit still opens with **Keep** and **Undo all**.
|
|
144
144
|
|
|
145
|
-
Other kinds move to this view one at a time. Slides, PDFs and prototypes keep the stage, and a task, ticket or event keeps the task detail.
|
|
145
|
+
This guide's pages and a Markdown file opened from a chat read the same way; a file keeps **Download** and **Share** at the top. Other kinds move to this view one at a time. Slides, PDFs and prototypes keep the stage, and a task, ticket or event keeps the task detail.
|
|
146
146
|
|
|
147
147
|
### What you type is kept
|
|
148
148
|
|
|
@@ -454,6 +454,20 @@ When a place opens, Today's own chat shows one ✦ for it, with a link to its pa
|
|
|
454
454
|
|
|
455
455
|
PMOS shows at most one of these a day. Your impact and What you might have missed come first, so Today's chat shows one ✦ at a time.
|
|
456
456
|
|
|
457
|
+
### States are shapes
|
|
458
|
+
|
|
459
|
+
PMOS shows the state of a piece of work as a small shape, not as a word. Each state has its own shape, so you can tell them apart without colour:
|
|
460
|
+
|
|
461
|
+
- **On track**: a ring that fills as the work gets done.
|
|
462
|
+
- **At risk**: a half-filled circle.
|
|
463
|
+
- **Late**: a triangle with !.
|
|
464
|
+
- **Needs you**: a blue dot on a light circle. It pulses once when it first shows, and not at all when your system asks for less motion.
|
|
465
|
+
- **Waiting on others**: a clock.
|
|
466
|
+
- **No signal**: a dashed ring. PMOS has read nothing for this work yet.
|
|
467
|
+
- **Done**: a filled circle with a check.
|
|
468
|
+
|
|
469
|
+
The shape is before the title on Work, Goals and the phone rows, in the Status column of the Timeline, and at the end of a bar on the Timeline. The facts stay as words beside it, for example "29 days late" or "Commerce has it". Hold the pointer on a shape to see its word and why. A screen reader reads the same words. On a phone, press and hold a shape to open a small sheet with its word and one line of why.
|
|
470
|
+
|
|
457
471
|
### The dot on the menu
|
|
458
472
|
|
|
459
473
|
The first time a place opens, its row in the menu gets one soft blue dot, and so does the menu button. The dot goes away when you open that place. The reports dot is on the Intelligence row, because reports are in Intelligence under **⋯**.
|
|
@@ -15,6 +15,7 @@ const path = require('path');
|
|
|
15
15
|
const crypto = require('crypto');
|
|
16
16
|
const headless = require('./headless.js');
|
|
17
17
|
const Goal = require('./goal-chat.js');
|
|
18
|
+
const { pmosAsk } = require('./routes-slash.js');
|
|
18
19
|
const ReportChat = require('./report-chat.js');
|
|
19
20
|
const REPORT_KEYS = new Set(); // chats that carried the report rule: their later messages carry the short reminder (item 9, batch 27)
|
|
20
21
|
const ProgramChat = require('./program-chat.js');
|
|
@@ -234,6 +235,8 @@ function chat({ runtimeDir, key, text, model, context, sessions, wsId, iniInfo,
|
|
|
234
235
|
let msg = q, goal = null;
|
|
235
236
|
const cmd = Goal.parseCommand(q);
|
|
236
237
|
if (cmd) { const b = Goal.begin({ runtimeDir, key, text: cmd.text, now }); if (b.error) return fail(400, b.error); msg = b.prompt; goal = b.id; }
|
|
238
|
+
// A455: a pick from the / menu's PMOS group ("/pmos task set …") reaches the session as words; Claude Code has no /pmos command
|
|
239
|
+
else if (pmosAsk(q)) msg = pmosAsk(q);
|
|
237
240
|
// D99: the New workflow chat (Settings › Workflows) carries the workflow rule on every message (lib/workflow-chat.js)
|
|
238
241
|
else if (WorkflowChat.isKey(key) && !q.startsWith('/')) msg = WorkflowChat.wrap(q);
|
|
239
242
|
// ask-the-past: "why did we drop X?" in any chat carries the past rule: answer from `pmos past ask`, cite every line, "No record found" when none
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* card-catalog-gen.js — the command text that the card catalog (lib/card-catalog.json) writes into three places (A455, job #1749):
|
|
3
|
+
* 1. kit/AGENTS.md, between <!-- card-catalog:begin --> and <!-- card-catalog:end -->: every pmos command a card button runs
|
|
4
|
+
* 2. the chat rules lib/<scope>-chat.js, between the card-catalog:begin and card-catalog:end comments: the commands of the cards that
|
|
5
|
+
* chat speaks about, as one rule line
|
|
6
|
+
* 3. the PMOS group of the / menu (lib/routes-slash.js), between the same comments: one entry per command
|
|
7
|
+
* The catalog is the one source. Edit lib/card-catalog.json, then run `node bin/card-catalog-gen.js`; card-catalog-gen.test.js fails
|
|
8
|
+
* while a generated block differs from what the catalog writes, and when a catalog command has no handler in `pmos`.
|
|
9
|
+
*
|
|
10
|
+
* usage(cmd) → 'pmos task set <id> [--due <date>] [--start <date>] …' (the positional words of its first run, every flag of every run)
|
|
11
|
+
* scopeLine(scope) → the one rule line of a chat scope (SCOPES)
|
|
12
|
+
* agentsBlock() → the markdown of the AGENTS.md block
|
|
13
|
+
* slashEntries() → [{ cmd, name, say }] for the / menu
|
|
14
|
+
* targets(root) → [{ file, begin, end, text }] the blocks and where they go (root = the repository root)
|
|
15
|
+
* apply(src, t) → src with the block between t.begin and t.end replaced by t.text; throws when a marker is missing
|
|
16
|
+
* handlerMissing(verbs?) → ['pmos <verb> <sub>' …] the catalog commands no `pmos` handler takes
|
|
17
|
+
* Pure apart from reading the catalog and, in handlerMissing, the verb modules' COMMANDS. */
|
|
18
|
+
const path = require('path');
|
|
19
|
+
const fs = require('fs');
|
|
20
|
+
const CC = require('./card-catalog');
|
|
21
|
+
|
|
22
|
+
/* Which cards each chat speaks about. cos is the chief over every unit, so it gets every group, by command name only. */
|
|
23
|
+
const SCOPES = Object.freeze({
|
|
24
|
+
initiative: { file: 'initiative-chat.js', kinds: ['task', 'subtask', 'milestone', 'dependency', 'workitem', 'initiative', 'proposal-ini', 'parked', 'launch', 'ready', 'signoff', 'artefact', 'rehearsal'] },
|
|
25
|
+
program: { file: 'program-chat.js', kinds: ['program', 'program-task', 'unit'] },
|
|
26
|
+
goal: { file: 'goal-chat.js', kinds: ['goal', 'measure', 'outcome', 'forecast'] },
|
|
27
|
+
report: { file: 'report-chat.js', kinds: ['report', 'schedule', 'press-release'] },
|
|
28
|
+
workflow: { file: 'workflow-chat.js', kinds: ['workflow', 'grill', 'build-item', 'prototype'] },
|
|
29
|
+
cos: { file: 'cos-chat.js', kinds: null },
|
|
30
|
+
});
|
|
31
|
+
const WHO = { you: 'one press with Undo', agent: 'PMOS starts a run', waits: 'only after the PM says yes' };
|
|
32
|
+
|
|
33
|
+
const cmdKey = (c) => c.verb + ' ' + c.sub;
|
|
34
|
+
/** Every catalog command, each with all its runs. */
|
|
35
|
+
function allCommands() {
|
|
36
|
+
const by = new Map();
|
|
37
|
+
for (const k of CC.kinds()) for (const a of k.actions) {
|
|
38
|
+
const p = CC.parseRun(a.run); if (!p) continue;
|
|
39
|
+
const key = p.verb + ' ' + p.sub;
|
|
40
|
+
if (!by.has(key)) by.set(key, { verb: p.verb, sub: p.sub, pos: p.pos, flags: {}, need: new Set(Object.keys(p.flags)), uses: [] });
|
|
41
|
+
const c = by.get(key);
|
|
42
|
+
for (const [f, v] of Object.entries(p.flags)) if (!(f in c.flags)) c.flags[f] = v;
|
|
43
|
+
c.uses.push({ kind: k.id, group: k.group, label: a.label, who: a.who || 'you' });
|
|
44
|
+
}
|
|
45
|
+
return [...by.values()];
|
|
46
|
+
}
|
|
47
|
+
function usage(c) {
|
|
48
|
+
// the first run's flags are its usual form; a flag only another button adds is shown optional
|
|
49
|
+
const fl = Object.entries(c.flags).map(([f, v]) => { const w = '--' + f + (v === true ? '' : ' ' + v); return c.need.has(f) ? w : '[' + w + ']'; });
|
|
50
|
+
return ['pmos', c.verb, c.sub, ...c.pos, ...fl].filter(Boolean).join(' ');
|
|
51
|
+
}
|
|
52
|
+
const uniq = (a) => [...new Set(a)];
|
|
53
|
+
const whoOf = (c) => uniq(c.uses.map((u) => u.who)).sort().join('/');
|
|
54
|
+
const labels = (c, kinds) => uniq(c.uses.filter((u) => !kinds || kinds.includes(u.kind)).map((u) => u.label));
|
|
55
|
+
|
|
56
|
+
function scopeLine(scope) {
|
|
57
|
+
const S = SCOPES[scope]; if (!S) throw new Error('no chat scope ' + scope);
|
|
58
|
+
const head = 'The card buttons run these pmos commands (the card catalog; who acts: you = ' + WHO.you + ', agent = ' + WHO.agent + ', waits = ' + WHO.waits + '). Run the one that fits the PM\'s ask, and tell the PM the Undo line it prints: ';
|
|
59
|
+
if (!S.kinds) {
|
|
60
|
+
const groups = (CC.load().groups || []).map((g) => {
|
|
61
|
+
const ks = g.kinds.map((k) => k.id), cs = allCommands().filter((c) => c.uses.some((u) => ks.includes(u.kind)));
|
|
62
|
+
return g.name + ': ' + uniq(cs.map((c) => 'pmos ' + cmdKey(c))).join(', ');
|
|
63
|
+
});
|
|
64
|
+
return head + groups.join('; ') + '. Each command\'s own help gives its flags.';
|
|
65
|
+
}
|
|
66
|
+
const cs = allCommands().filter((c) => c.uses.some((u) => S.kinds.includes(u.kind)));
|
|
67
|
+
return head + cs.map((c) => usage(c) + ' (' + labels(c, S.kinds).join(', ') + '; ' + whoOf(c) + ')').join('; ') + '.';
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function agentsBlock() {
|
|
71
|
+
const out = ['## Card commands (generated from the card catalog)', '',
|
|
72
|
+
'Every button on a PMOS card runs one `pmos` command. This list is generated from `workspace/lib/card-catalog.json` by `node workspace/bin/card-catalog-gen.js`; do not edit it by hand. Who acts: **you** is ' + WHO.you + ', **agent** is ' + WHO.agent + ', **waits** is ' + WHO.waits + '. Run the command the PM\'s ask names, and tell the PM the Undo line it prints.', ''];
|
|
73
|
+
for (const g of CC.load().groups || []) {
|
|
74
|
+
const ks = g.kinds.map((k) => k.id), cs = allCommands().filter((c) => c.uses.some((u) => ks.includes(u.kind)));
|
|
75
|
+
if (!cs.length) continue;
|
|
76
|
+
out.push('**' + g.name + '.**', '');
|
|
77
|
+
for (const c of cs) out.push('- `' + usage(c) + '`: ' + labels(c, ks).join(', ') + ' (' + whoOf(c) + ')');
|
|
78
|
+
out.push('');
|
|
79
|
+
}
|
|
80
|
+
return out.join('\n').trimEnd();
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function slashEntries() {
|
|
84
|
+
// one entry per sub ("up|down" gives two); a / command is one word, so "/pmos:task-set" (the menu filters as you type)
|
|
85
|
+
const out = [];
|
|
86
|
+
for (const c of allCommands()) for (const sub of String(c.sub).split('|')) {
|
|
87
|
+
const l = labels(c);
|
|
88
|
+
out.push({ cmd: '/pmos:' + c.verb + (sub ? '-' + sub : ''), run: ('pmos ' + c.verb + ' ' + sub).trim(), name: l[0] + (l.length > 1 ? ' and ' + (l.length - 1) + ' more' : ''), say: usage({ ...c, sub }) });
|
|
89
|
+
}
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
const JS_BEGIN = '/* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */';
|
|
94
|
+
const JS_END = '/* card-catalog:end */';
|
|
95
|
+
function targets(root) {
|
|
96
|
+
const ws = path.join(root, 'workspace');
|
|
97
|
+
const t = [{ file: path.join(root, 'kit', 'AGENTS.md'), begin: '<!-- card-catalog:begin -->', end: '<!-- card-catalog:end -->', text: '\n\n' + agentsBlock() + '\n\n' }];
|
|
98
|
+
for (const s of Object.keys(SCOPES)) t.push({ file: path.join(ws, 'lib', SCOPES[s].file), begin: JS_BEGIN, end: JS_END, text: JSON.stringify(scopeLine(s)) });
|
|
99
|
+
t.push({ file: path.join(ws, 'lib', 'routes-slash.js'), begin: JS_BEGIN, end: JS_END, text: '\n' + slashEntries().map((e) => ' ' + JSON.stringify(e) + ',').join('\n') + '\n' });
|
|
100
|
+
return t;
|
|
101
|
+
}
|
|
102
|
+
function apply(src, t) {
|
|
103
|
+
const i = src.indexOf(t.begin), j = src.indexOf(t.end, i + 1);
|
|
104
|
+
if (i < 0 || j < 0) throw new Error('the card-catalog markers are missing in ' + t.file);
|
|
105
|
+
return src.slice(0, i + t.begin.length) + t.text + src.slice(j);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/* The verbs bin/pmos.js handles itself, before lib/pmos-verbs.js: verb → its module. */
|
|
109
|
+
const BIN_VERBS = { schedule: 'schedule-cli.js', skill: 'schedule-cli.js', proactive: 'proactive-cli.js', item: 'item-cli.js', kg: 'kg-cli.js' };
|
|
110
|
+
function handlerMissing() {
|
|
111
|
+
const V = require('./pmos-verbs');
|
|
112
|
+
const miss = [];
|
|
113
|
+
for (const c of allCommands()) {
|
|
114
|
+
const mod = BIN_VERBS[c.verb] || (V.VERBS[c.verb] && V.VERBS[c.verb].module);
|
|
115
|
+
const f = mod && path.join(__dirname, mod);
|
|
116
|
+
if (!f || !fs.existsSync(f)) { miss.push('pmos ' + cmdKey(c)); continue; }
|
|
117
|
+
const subs = ((require(f).COMMANDS || {})[c.verb]) || [];
|
|
118
|
+
for (const s of String(c.sub).split('|')) if (s && !subs.includes(s)) miss.push('pmos ' + c.verb + ' ' + s);
|
|
119
|
+
}
|
|
120
|
+
return miss;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
module.exports = { SCOPES, JS_BEGIN, JS_END, allCommands, usage, scopeLine, agentsBlock, slashEntries, targets, apply, handlerMissing };
|
|
@@ -59,6 +59,7 @@ const RULE = [
|
|
|
59
59
|
'You are the chief: the one live session over every Program, Product and Project. Each unit has one owner, a record with a daily brief, never a session; an initiative in a program is the program\'s, else its product\'s. Never ask another session; read the records. `pmos units` lists the units and their briefs. You may run these yourself: `pmos owner brief [<unit>]` (a fresh brief now), `pmos team dispatch --unit <unit>` (the roles for the unit\'s first open initiative), `pmos team pause|resume --unit <unit>` (stop or restart the role runs on a unit). When the same lesson shows in two units, file it with `pmos propose` as a workspace rule the PM keeps or drops.',
|
|
60
60
|
'Answer in plain sentences, the answer first. Never start with "I can help with".',
|
|
61
61
|
'Speak to the PM as "you", in the first person ("I archived them"). Never write "The PM says" or speak of the PM in the third person.',
|
|
62
|
+
/* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: Work items: pmos task set, pmos task state, pmos task comment, pmos task describe, pmos task remove, pmos task add, pmos rehearse move, pmos task link, pmos task unlink, pmos item move, pmos item set, pmos item withdraw, pmos my-work show; Initiatives and programs: pmos task add, pmos initiative up|down, pmos initiative top|bottom, pmos initiative after, pmos initiative check-by, pmos initiative kind, pmos workflow switch, pmos workflow move, pmos initiative describe, pmos parked hold, pmos initiative export, pmos initiative adopt, pmos initiative drop, pmos parked back, pmos program check, pmos program milestone, pmos program join, pmos program leave, pmos program charter, pmos program capacity, pmos program decide, pmos program order, pmos program archive, pmos program task, pmos program task-done, pmos units show, pmos launch check, pmos launch tier, pmos ready check; Strategy, goals and evidence: pmos strategy set, pmos strategy draft, pmos strategy undo, pmos positioning keep, pmos positioning drop, pmos principles keep, pmos principles drop, pmos principles undo, pmos principles add, pmos artefacts set, pmos artefacts undo, pmos proactive goals, pmos measure add, pmos outcomes declare, pmos outcomes test, pmos outcomes record, pmos decisions add, pmos decisions check, pmos decisions undo, pmos glossary set, pmos glossary remove, pmos signal add, pmos signal remove, pmos forecast baseline, pmos forecast baseline-off; People and conversations: pmos people record, pmos mention draft, pmos mention answered, pmos mention watch, pmos mention stands, pmos signoff ask, pmos signoff answer, pmos signoff drop, pmos jira answer; What PMOS proposes and does: pmos driver keep, pmos driver return, pmos driver drop, pmos driver undo, pmos driver pause, pmos proactive feedback, pmos rules edit, pmos rules retire, pmos rules restore, pmos autonomy restore, pmos autonomy check, pmos ai off, pmos ai on, pmos team pause|resume, pmos team dispatch, pmos scan match, pmos critic label; Tracker, documents and sources: pmos task set, pmos jira pin, pmos jira approve, pmos jira criteria-propose, pmos jira epic, pmos docs link, pmos docs unlink, pmos docs sync-start, pmos refresh since, pmos calendar import; Reports, routines and rehearsals: pmos rehearse move, pmos report draft, pmos report check, pmos report rule, pmos report issue, pmos schedule run, pmos schedule disable|enable, pmos schedule edit, pmos schedule rm, pmos rehearse end, pmos rehearse cut, pmos press-release , pmos skill copy, pmos skill edit; Factory (Full ADLC): pmos workflow switch, pmos build rollout, pmos build rollback, pmos build review, pmos loop stop, pmos loop resume, pmos lab delete, pmos lab undo, pmos grill mode, pmos grill cap. Each command's own help gives its flags."/* card-catalog:end */,
|
|
62
63
|
].join('\n');
|
|
63
64
|
|
|
64
65
|
/** The message as typed into a live session. page: the "You are on …" chip's words, or '' when the PM dropped it. */
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* declined-asks.js — saying no, kindly and on record (initiative declined-asks-reply, bet A326). A PM closes many asks without doing them
|
|
3
|
+
* (Won't Do, Declined, Duplicate…). PMOS lists them from the product's stored Jira readings, drafts a short, kind reply to the person who
|
|
4
|
+
* asked, and, when the PM records one, writes it to the product's out-of-scope list, where lib/past.js (and the "You decided this before"
|
|
5
|
+
* check, lib/past-repeat.js) finds a later repeat of the same ask.
|
|
6
|
+
*
|
|
7
|
+
* PMOS NEVER SENDS THE REPLY. It is a draft the PM copies and sends where they talk to that person. No model, no network, no Jira write.
|
|
8
|
+
*
|
|
9
|
+
* declinedOf(readings, { now, days }) → [ask] PURE: the asks closed without being done in the window, newest first
|
|
10
|
+
* reasonOf(ask) → string PURE: the default reason, from the status or the resolution
|
|
11
|
+
* replyFor(ask, { reason }) → string PURE: the reply draft, at most 3 sentences
|
|
12
|
+
* collect(root, { now, days }) → [ask] every stored Jira reading of the product (lib/jira-status.js)
|
|
13
|
+
* record(root, key, { reason, now, asks }) → { ok, ask, reply, file } | { ok: false, error }
|
|
14
|
+
* recorded(root) → [line] the recorded asks, last line per key
|
|
15
|
+
* CLI: node declined-asks.js recorded → the count on its last line (the experiment's health read)
|
|
16
|
+
*
|
|
17
|
+
* AN ASK is { key, summary, status, resolution, reporter, resolved, url }. The reading carries the reporter's display name only, never an
|
|
18
|
+
* email (lib/jira-status.js askedClosed).
|
|
19
|
+
*
|
|
20
|
+
* THE RECORD. One line per record in `declined-asks.jsonl` in the product's records folder, { at, key, summary, reporter, reason, reason_by:
|
|
21
|
+
* 'pm' | 'pmos', reply, file }, and `planning/out-of-scope/<key>.md` (type Reference, decision: declined). A later record of the same key
|
|
22
|
+
* replaces the file only while it is still the one PMOS wrote (its text matches the last line's hash); a file the PM changed is kept.
|
|
23
|
+
*/
|
|
24
|
+
const fs = require('fs');
|
|
25
|
+
const path = require('path');
|
|
26
|
+
const crypto = require('crypto');
|
|
27
|
+
|
|
28
|
+
const FILE = 'declined-asks.jsonl';
|
|
29
|
+
const DAYS = 90;
|
|
30
|
+
const DAY_MS = 86400000;
|
|
31
|
+
const KEY_RE = /^[A-Z][A-Z0-9_]*-\d+$/;
|
|
32
|
+
// Closed without being done, by the status's or the resolution's name (lib/task-jira.js CLOSED_NOT_DONE, the same words).
|
|
33
|
+
const CLOSED_NOT_DONE = /invalid|not an issue|won'?t|cancel|duplicate|reject|obsolete|not (?:needed|required|a bug|reproducible)|cannot reproduce|declined|abandon/i;
|
|
34
|
+
const DONE_WORD = /\b(done|closed|resolved|released|complete|shipped|deployed)\b/i;
|
|
35
|
+
const log = (s) => { try { console.log('[declined-asks] ' + s); } catch { /* no console */ } };
|
|
36
|
+
|
|
37
|
+
const one = (v, n = 200) => { const s = String(v == null ? '' : v).replace(/\s+/g, ' ').trim(); return s.length > n ? s.slice(0, n - 1).trimEnd() + '…' : s; };
|
|
38
|
+
const hash = (s) => crypto.createHash('sha1').update(String(s)).digest('hex').slice(0, 12);
|
|
39
|
+
const dayOf = (v) => { const m = /^(\d{4}-\d{2}-\d{2})/.exec(String(v || '')); return m ? m[1] : null; };
|
|
40
|
+
|
|
41
|
+
/** True when the reading was closed without being done: its status or its resolution says so. */
|
|
42
|
+
function isDeclined(r) {
|
|
43
|
+
if (!r) return false;
|
|
44
|
+
const st = String(r.status || ''), res = String(r.resolution || '');
|
|
45
|
+
if (CLOSED_NOT_DONE.test(st)) return true;
|
|
46
|
+
const closed = String(r.category || '').toLowerCase() === 'done' || DONE_WORD.test(st) || !!r.resolved;
|
|
47
|
+
return closed && !!res && CLOSED_NOT_DONE.test(res);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/** PURE. The asks closed without being done, resolved in the last `days` days (a ticket with no resolution day counts by its last
|
|
51
|
+
* update), newest first, one per key. */
|
|
52
|
+
function declinedOf(readings, { now = Date.now(), days = DAYS } = {}) {
|
|
53
|
+
const since = new Date(now - days * DAY_MS).toISOString().slice(0, 10);
|
|
54
|
+
const by = new Map();
|
|
55
|
+
for (const r of readings || []) {
|
|
56
|
+
if (!r || !KEY_RE.test(String(r.key || '')) || !isDeclined(r)) continue;
|
|
57
|
+
const day = dayOf(r.resolved) || dayOf(r.updated);
|
|
58
|
+
if (!day || day < since) continue;
|
|
59
|
+
const a = { key: r.key, summary: one(r.summary, 250), status: one(r.status, 60), resolution: r.resolution ? one(r.resolution, 60) : null,
|
|
60
|
+
reporter: r.reporter ? one(r.reporter, 80) : null, resolved: day, url: r.url || null };
|
|
61
|
+
const old = by.get(a.key);
|
|
62
|
+
if (!old || a.resolved > old.resolved) by.set(a.key, a);
|
|
63
|
+
}
|
|
64
|
+
return [...by.values()].sort((x, y) => (x.resolved < y.resolved ? 1 : x.resolved > y.resolved ? -1 : x.key < y.key ? -1 : 1));
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** PURE. The reason a reply gives when the PM gave none, from the words the ticket was closed with. */
|
|
68
|
+
function reasonOf(ask) {
|
|
69
|
+
const w = `${(ask && ask.resolution) || ''} ${(ask && ask.status) || ''}`;
|
|
70
|
+
if (/duplicate/i.test(w)) return 'it is already covered by another ticket, so the work happens there';
|
|
71
|
+
if (/not a bug|not an issue|cannot reproduce|not reproducible|invalid/i.test(w)) return 'we could not find a problem to fix as it was described';
|
|
72
|
+
if (/obsolete|not (?:needed|required)/i.test(w)) return 'it is no longer needed after other changes';
|
|
73
|
+
if (/cancel|abandon/i.test(w)) return 'the work it belonged to was stopped';
|
|
74
|
+
return 'it does not fit what we are working on now';
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/** PURE. The kind reply draft: thanks for the ask, the decision and its reason, what would bring it back. 3 sentences at most. */
|
|
78
|
+
function replyFor(ask, { reason } = {}) {
|
|
79
|
+
const first = ask && ask.reporter ? one(ask.reporter, 80).split(/\s+/)[0] : '';
|
|
80
|
+
const what = one((ask && ask.summary) || 'this', 120).replace(/[.!?…]+$/, '');
|
|
81
|
+
const why = one(reason || reasonOf(ask), 220).replace(/[.!?…]+$/, '');
|
|
82
|
+
const greet = first ? `Hi ${first}, thank you` : 'Thank you';
|
|
83
|
+
return `${greet} for asking for "${what}" (${ask.key}). We decided not to take it on for now, because ${why.charAt(0).toLowerCase() + why.slice(1)}. If something changes, for example more people need it, we will look at it again.`;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ── the readings ────────────────────────────────────────────────────────────────────────────────────
|
|
87
|
+
function jiraDirOf(root) { try { return require('./jira-tickets.js').jiraDir(root); } catch { return null; } }
|
|
88
|
+
function readingsOf(root) {
|
|
89
|
+
const dir = jiraDirOf(root);
|
|
90
|
+
if (!dir) return [];
|
|
91
|
+
let names;
|
|
92
|
+
try { names = fs.readdirSync(dir); } catch { return []; }
|
|
93
|
+
const JS = require('./jira-status.js');
|
|
94
|
+
const out = [];
|
|
95
|
+
for (const n of names.sort()) {
|
|
96
|
+
if (!n.endsWith('.md') || n.endsWith('-tickets.md') || n === '_sprint-notes.md') continue;
|
|
97
|
+
const snap = JS.readSnapshot(root, n.slice(0, -3));
|
|
98
|
+
if (snap) for (const r of snap.tickets.values()) out.push(r);
|
|
99
|
+
}
|
|
100
|
+
return out;
|
|
101
|
+
}
|
|
102
|
+
/** Every declined ask in the product's stored Jira readings. */
|
|
103
|
+
function collect(root, opts = {}) { return declinedOf(readingsOf(root), opts); }
|
|
104
|
+
|
|
105
|
+
// ── the record ──────────────────────────────────────────────────────────────────────────────────────
|
|
106
|
+
function recordsDirOf(root) {
|
|
107
|
+
try { const { repoScript } = require('./repo-script.js'); return require(repoScript('signals/layout-paths.js')).pathsFor(root).recordsDir; } catch { return path.join(root, 'planning', 'records'); }
|
|
108
|
+
}
|
|
109
|
+
const ledgerOf = (root) => path.join(recordsDirOf(root), FILE);
|
|
110
|
+
const outOfScopeRel = (key) => `planning/out-of-scope/${String(key).toLowerCase()}.md`;
|
|
111
|
+
|
|
112
|
+
function readLedger(root) {
|
|
113
|
+
let text;
|
|
114
|
+
try { text = fs.readFileSync(ledgerOf(root), 'utf8'); } catch { return []; }
|
|
115
|
+
const out = [];
|
|
116
|
+
for (const l of text.split('\n')) { if (!l.trim()) continue; try { const o = JSON.parse(l); if (o && KEY_RE.test(String(o.key || ''))) out.push(o); } catch { /* a torn line is skipped */ } }
|
|
117
|
+
return out;
|
|
118
|
+
}
|
|
119
|
+
/** The recorded asks, the last line for each key wins, newest first. */
|
|
120
|
+
function recorded(root) {
|
|
121
|
+
const by = new Map();
|
|
122
|
+
for (const o of readLedger(root)) by.set(o.key, o);
|
|
123
|
+
return [...by.values()].sort((a, b) => (a.at < b.at ? 1 : -1));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const yq = (s) => '"' + String(s).replace(/\\/g, '\\\\').replace(/"/g, '\\"') + '"';
|
|
127
|
+
function fileText(ask, { reason, reply, day }) {
|
|
128
|
+
return [
|
|
129
|
+
'---', 'type: Reference', `title: ${yq(one(ask.summary, 150))}`, `timestamp: ${day}`, `ticket: ${ask.key}`, 'decision: declined', '---', '',
|
|
130
|
+
`# ${one(ask.summary, 150)}`, '',
|
|
131
|
+
'- decision: declined', `- date: ${ask.resolved || day}`, `- ticket: ${ask.key}${ask.url ? ' (' + ask.url + ')' : ''}`,
|
|
132
|
+
...(ask.reporter ? [`- asked by: ${ask.reporter}`] : []), `- closed as: ${ask.resolution || ask.status}`, '',
|
|
133
|
+
'## Reasoning', '', `Declined because ${reason}.`, '',
|
|
134
|
+
'## Reply draft', '', 'PMOS drafted this reply. It was not sent.', '', '> ' + reply, '',
|
|
135
|
+
`Recorded by \`pmos declined record ${ask.key}\`. Edit this file freely: PMOS does not write over it once you change it.`, '',
|
|
136
|
+
].join('\n');
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Record one declined ask: a ledger line and the out-of-scope file. `asks` (optional) is the list to find the key in (default: collect). */
|
|
140
|
+
function record(root, key, { reason, now = Date.now(), asks } = {}) {
|
|
141
|
+
const k = String(key || '').trim().toUpperCase();
|
|
142
|
+
if (!KEY_RE.test(k)) return { ok: false, error: `"${key}" is not a ticket key such as ABC-123` };
|
|
143
|
+
const list = asks || collect(root, { now, days: 3650 });
|
|
144
|
+
const ask = list.find((a) => a.key === k);
|
|
145
|
+
if (!ask) return { ok: false, error: `${k} is not a declined ask in this product's Jira readings (pmos declined lists them)` };
|
|
146
|
+
const own = one(reason || '', 220).replace(/[.!?…]+$/, '');
|
|
147
|
+
const why = own || reasonOf(ask);
|
|
148
|
+
const reply = replyFor(ask, { reason: why });
|
|
149
|
+
const day = new Date(now).toISOString().slice(0, 10);
|
|
150
|
+
const rel = outOfScopeRel(k);
|
|
151
|
+
const abs = path.join(root, rel);
|
|
152
|
+
const text = fileText(ask, { reason: why.charAt(0).toLowerCase() + why.slice(1), reply, day });
|
|
153
|
+
const last = recorded(root).find((o) => o.key === k);
|
|
154
|
+
let kept = false;
|
|
155
|
+
if (fs.existsSync(abs)) {
|
|
156
|
+
let cur = '';
|
|
157
|
+
try { cur = fs.readFileSync(abs, 'utf8'); } catch { /* unreadable: keep it */ }
|
|
158
|
+
if (!last || hash(cur) !== last.file_hash) kept = true; // the PM wrote or changed it
|
|
159
|
+
}
|
|
160
|
+
if (!kept) { fs.mkdirSync(path.dirname(abs), { recursive: true }); fs.writeFileSync(abs, text); }
|
|
161
|
+
const lineObj = { at: new Date(now).toISOString(), key: k, summary: ask.summary, reporter: ask.reporter, reason: why, reason_by: own ? 'pm' : 'pmos', reply,
|
|
162
|
+
file: rel, file_hash: kept ? (last ? last.file_hash : null) : hash(text), kept_pm_file: kept || undefined };
|
|
163
|
+
fs.mkdirSync(path.dirname(ledgerOf(root)), { recursive: true });
|
|
164
|
+
fs.appendFileSync(ledgerOf(root), JSON.stringify(lineObj) + '\n');
|
|
165
|
+
log(`recorded ${k} (${lineObj.reason_by} reason)${kept ? '; kept the out-of-scope file the PM changed' : ''}`);
|
|
166
|
+
return { ok: true, ask, reply, reason: why, file: rel, kept };
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
module.exports = { FILE, DAYS, isDeclined, declinedOf, reasonOf, replyFor, collect, record, recorded, outOfScopeRel };
|
|
170
|
+
|
|
171
|
+
if (require.main === module) {
|
|
172
|
+
const [cmd, root] = process.argv.slice(2);
|
|
173
|
+
if (cmd === 'recorded') {
|
|
174
|
+
const r = path.resolve(root || process.cwd());
|
|
175
|
+
process.stdout.write(String(recorded(r).length) + '\n');
|
|
176
|
+
} else { process.stdout.write('usage: node declined-asks.js recorded [<product root>]\n'); process.exitCode = 2; }
|
|
177
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* declined-cli.js — `pmos declined`: the asks closed without being done, each with a kind reply draft, and recording one in the product's
|
|
3
|
+
* out-of-scope list (initiative declined-asks-reply, bet A326; lib/declined-asks.js).
|
|
4
|
+
*
|
|
5
|
+
* pmos declined list [--days N] [--json] the asks closed as Won't Do, Declined, Duplicate… in the last N days (90), each with its reply draft
|
|
6
|
+
* pmos declined draft <KEY> [--reason "<why>"] [--json] the reply draft for one ask, with the PM's reason when given
|
|
7
|
+
* pmos declined record <KEY> [--reason "<why>"] [--json] record it: a line in declined-asks.jsonl and planning/out-of-scope/<key>.md
|
|
8
|
+
* every command: [--root <dir>] (default: this repository)
|
|
9
|
+
*
|
|
10
|
+
* PMOS never sends the reply: the PM copies it and sends it where they talk to that person. Exit codes: 0 done, 1 refused, 2 usage. */
|
|
11
|
+
const path = require('path');
|
|
12
|
+
const { execFileSync } = require('child_process');
|
|
13
|
+
const D = require('./declined-asks.js');
|
|
14
|
+
|
|
15
|
+
const COMMANDS = { declined: ['list', 'draft', 'record'] };
|
|
16
|
+
const USAGE = [
|
|
17
|
+
'usage: pmos declined list|draft|record — asks closed without being done, each with a kind reply draft PMOS never sends',
|
|
18
|
+
' pmos declined list [--days 90] [--json] the asks closed as Won\'t Do, Declined, Duplicate and the like, newest first, each with its reply draft',
|
|
19
|
+
' pmos declined draft <KEY> [--reason "<why>"] the reply draft for one ask; your reason replaces the one PMOS reads from the ticket',
|
|
20
|
+
' pmos declined record <KEY> [--reason "<why>"] record it in the product\'s out-of-scope list, so a repeat of the ask is raised later',
|
|
21
|
+
'Run it in the product\'s repository, or pass --root <dir>. The reply is a draft: copy it and send it yourself.',
|
|
22
|
+
];
|
|
23
|
+
const ALLOWED = { list: ['json', 'root', 'days'], draft: ['json', 'root', 'reason'], record: ['json', 'root', 'reason'] };
|
|
24
|
+
const BOOL = new Set(['json']);
|
|
25
|
+
|
|
26
|
+
function parse(args) {
|
|
27
|
+
const pos = [], flags = {};
|
|
28
|
+
for (let i = 0; i < args.length; i++) {
|
|
29
|
+
const a = args[i];
|
|
30
|
+
if (!a.startsWith('--')) { pos.push(a); continue; }
|
|
31
|
+
const k = a.slice(2);
|
|
32
|
+
if (BOOL.has(k)) { flags[k] = true; continue; }
|
|
33
|
+
flags[k] = args[i + 1] !== undefined && !String(args[i + 1]).startsWith('--') ? args[++i] : '';
|
|
34
|
+
}
|
|
35
|
+
return { pos, flags };
|
|
36
|
+
}
|
|
37
|
+
function repoRoot(cwd) {
|
|
38
|
+
try { return execFileSync('git', ['rev-parse', '--show-toplevel'], { cwd, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || cwd; } catch { return cwd; }
|
|
39
|
+
}
|
|
40
|
+
const who = (a) => (a.reporter ? `asked by ${a.reporter}` : 'who asked is not known');
|
|
41
|
+
|
|
42
|
+
async function run(argv, { say = (s) => console.log(s), cwd = process.cwd(), now = Date.now() } = {}) {
|
|
43
|
+
const args = argv[0] === 'declined' ? argv.slice(1) : argv.slice();
|
|
44
|
+
let sub = args[0];
|
|
45
|
+
if (['help', '--help', '-h'].includes(sub)) { for (const l of USAGE) say(l); return 0; }
|
|
46
|
+
if (!sub || sub.startsWith('--')) { sub = 'list'; args.unshift('list'); }
|
|
47
|
+
if (!COMMANDS.declined.includes(sub)) { say(`unknown declined command "${sub}". Use one of: ${COMMANDS.declined.join(', ')}`); return 2; }
|
|
48
|
+
const { pos, flags } = parse(args.slice(1));
|
|
49
|
+
for (const k of Object.keys(flags)) if (!ALLOWED[sub].includes(k)) { say(`✗ --${k} is not an option of pmos declined ${sub}`); return 2; }
|
|
50
|
+
const root = path.resolve(flags.root || repoRoot(cwd));
|
|
51
|
+
const fail = (error, code = 1) => { say(flags.json ? JSON.stringify({ ok: false, error }) : '✗ ' + error); return code; };
|
|
52
|
+
|
|
53
|
+
if (sub === 'list') {
|
|
54
|
+
if (pos.length) return fail('pmos declined list takes options, not an argument', 2);
|
|
55
|
+
const days = flags.days === undefined ? D.DAYS : Number(flags.days);
|
|
56
|
+
if (!Number.isInteger(days) || days < 1 || days > 3650) return fail('--days is a whole number from 1 to 3650', 2);
|
|
57
|
+
const done = new Set(D.recorded(root).map((o) => o.key));
|
|
58
|
+
const asks = D.collect(root, { now, days }).map((a) => ({ ...a, recorded: done.has(a.key), reply: D.replyFor(a) }));
|
|
59
|
+
if (flags.json) { say(JSON.stringify({ ok: true, days, asks })); return 0; }
|
|
60
|
+
if (!asks.length) { say(`No ask was closed without being done in the last ${days} days in this product's Jira readings.`); return 0; }
|
|
61
|
+
say(`${asks.length} ask${asks.length === 1 ? ' was' : 's were'} closed without being done in the last ${days} days. Each reply is a draft: PMOS does not send it.`);
|
|
62
|
+
for (const a of asks) {
|
|
63
|
+
say('');
|
|
64
|
+
say(`${a.recorded ? '✓' : '•'} ${a.key} ${a.summary} (closed as ${a.resolution || a.status} on ${a.resolved}, ${who(a)})${a.recorded ? ' — recorded' : ''}`);
|
|
65
|
+
say(` Reply: ${a.reply}`);
|
|
66
|
+
}
|
|
67
|
+
return 0;
|
|
68
|
+
}
|
|
69
|
+
const key = String(pos[0] || '').toUpperCase();
|
|
70
|
+
if (!key || pos.length > 1) return fail(`pmos declined ${sub} takes one ticket key, such as ABC-123`, 2);
|
|
71
|
+
if (sub === 'draft') {
|
|
72
|
+
const a = D.collect(root, { now, days: 3650 }).find((x) => x.key === key);
|
|
73
|
+
if (!a) return fail(`${key} is not a declined ask in this product's Jira readings (pmos declined lists them)`);
|
|
74
|
+
const reply = D.replyFor(a, { reason: flags.reason || undefined });
|
|
75
|
+
say(flags.json ? JSON.stringify({ ok: true, ask: a, reply }) : reply);
|
|
76
|
+
return 0;
|
|
77
|
+
}
|
|
78
|
+
// record
|
|
79
|
+
const r = D.record(root, key, { reason: flags.reason || undefined, now });
|
|
80
|
+
if (!r.ok) return fail(r.error);
|
|
81
|
+
if (flags.json) { say(JSON.stringify({ ok: true, key, file: r.file, kept: r.kept, reply: r.reply })); return 0; }
|
|
82
|
+
say(`recorded ${key} in ${r.file}${r.kept ? ' (your own edits to that file are kept)' : ''}`);
|
|
83
|
+
say(`Reply (a draft, not sent): ${r.reply}`);
|
|
84
|
+
return 0;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
module.exports = { run, COMMANDS, USAGE };
|
|
@@ -76,6 +76,7 @@ function startMessage(draft) {
|
|
|
76
76
|
'At the end of each message about this goal, add a fenced pmos-goal block: {"step":"progress","state":"working|done|needs-you","met":["done points met"],"open":["done points still open"]}. Copy each done point word for word. Report done only after you checked every point.',
|
|
77
77
|
// batch 22 item 13 (Wawan, 2026-11-01): "6 of 6 met" while the report the goal asked for was only proposed
|
|
78
78
|
'A done point that names a thing to make (a report, slides, a deck, a document) is met only when that thing exists where the PM reads it, opened and checked by you. A proposal, a plan or a draft waiting for a PM press does not meet it: that point stays open, and you end with needs-you and the one press.',
|
|
79
|
+
/* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: pmos proactive goals add <text> --initiative <id> (Add, Done, Drop, Reopen; you); pmos measure add <anchor> <value> --source <source> (Add a reading; you); pmos outcomes declare <id> --metric <text> (Declare the metric; you); pmos outcomes test <id> --test <text> (Set the smallest test; you); pmos outcomes record <id> worked|didnt-work|cant-tell --evidence <text> (Record the result; you); pmos forecast baseline (Set baseline; you); pmos forecast baseline-off (Clear baseline; you)."/* card-catalog:end */,
|
|
79
80
|
].join('\n');
|
|
80
81
|
}
|
|
81
82
|
const cancelMessage = () => MARK.cancel + ' The PM cancelled this goal. Do no more work for it and say in one line what you stopped.';
|
|
@@ -62,6 +62,7 @@ function rule(info, id) {
|
|
|
62
62
|
'The Work timeline draws one bar per initiative, from the earliest start to the latest due of its tasks. An initiative with no dated task has no bar. Every stage shows there, Monitor and Evaluate included. Use these rules when the PM asks why an initiative is not on the timeline.',
|
|
63
63
|
`A stage's document fills its card only through \`pmos coredoc write --scope initiative:${ini} --key wf-<stage key> --file <path>\` (the stage keys are in \`pmos workflow of ${ini}\`). It is a draft the PM issues on the page. A file written under planning/ is not linked to a card.`,
|
|
64
64
|
);
|
|
65
|
+
out.push(/* card-catalog:begin, generated by bin/card-catalog-gen.js: edit lib/card-catalog.json, not this block */"The card buttons run these pmos commands (the card catalog; who acts: you = one press with Undo, agent = PMOS starts a run, waits = only after the PM says yes). Run the one that fits the PM's ask, and tell the PM the Undo line it prints: pmos task set <id> --due <date> [--start <date>] [--owner <who>] [--notes <text>] [--milestone] [--pin] [--no-milestone] (Move the date, Set start and due, Change owner, Add a note, Make it a milestone, Pin, Back to a task; you); pmos task state <id> --to <state> --why <text> (Change status, Mark done; you); pmos task comment <id> <text> (Comment; you); pmos task describe <id> (Write the description; agent); pmos task remove <id> --why <text> (Remove; you); pmos task add <initiative> \"<title>\" --parent <task> [--due <date>] [--owner <who>] (Add a subtask, Add a task; you); pmos rehearse move <id> --due <date> [--by <days>] (What slips if it moves, Move a task; you); pmos task link <from> <to> --type fs|ss|ff|sf --lag <days> (Link two tasks; you); pmos task unlink <from> <to> (Unlink; you); pmos item move <item> <todo|doing|review|done> --evidence <ref> (Move on the board; you); pmos item set <item> --due <date> --owner <who> (Change date or owner; you); pmos item withdraw <item> (Withdraw; you); pmos initiative up|down <id> (Move up / down; you); pmos initiative top|bottom <id> (Move to top / bottom; you); pmos initiative after <id> <other> (Rank after another; you); pmos initiative check-by <id> <date> (Set check date; you); pmos initiative kind <id> product|project|sdlc (Change kind; you); pmos workflow switch <id> --to <workflow> --stage <stage> --why <text> (Change workflow; you); pmos workflow move <id> --stage <stage> --why <text> (Move to stage; you); pmos initiative describe <id> (Write the description; agent); pmos parked hold <id> --why <text> (Park it, Change the reason; you); pmos initiative export <id> (Export the breakdown; you); pmos initiative adopt <proposal> (Keep; you); pmos initiative drop <proposal> (Drop; you); pmos parked back <id> (Bring back; you); pmos launch check <initiative> --date <date> (Check what is not ready; you); pmos launch tier <initiative> (Set the launch tier; you); pmos ready check <initiative> (Run the check; you); pmos artefacts set <scope> <artefact> --text <text> (Write it; you); pmos artefacts undo <a-id> (Undo; you); pmos signoff ask <initiative> --who <who> (Ask; waits); pmos signoff answer <id> --answer <text> (Record the answer; you); pmos signoff drop <id> --why <text> (Drop; you); pmos rehearse end <initiative> --to <date> (Move the end; you); pmos rehearse cut <task|initiative> (Cut it; you)."/* card-catalog:end */);
|
|
65
66
|
return out;
|
|
66
67
|
}
|
|
67
68
|
|
|
@@ -29,6 +29,8 @@
|
|
|
29
29
|
* reading saved before they were carried has none of them, and the burndown says it cannot be drawn. A ticket the search did not return keeps its last reading, marked
|
|
30
30
|
* stale. Titles and statuses only: never a description or a comment. The one person a reading carries is the assignee's display name, with
|
|
31
31
|
* the time of the last update (`assignee`, `updated`): Waiting on others names who a stale ticket waits on (home-your-move-waiting).
|
|
32
|
+
* It may also carry the reporter's display name and the resolution's name (`reporter`, `resolution`), when the read gave them:
|
|
33
|
+
* lib/declined-asks.js drafts a reply to the person who asked when the ticket was closed without being done (bet A326).
|
|
32
34
|
*
|
|
33
35
|
* A task that names a key follows its reading: lib/task-jira.js trackerLines sets its state in memory when the read is newer (no
|
|
34
36
|
* plan item or ledger line is written, D88 still holds).
|
|
@@ -241,6 +243,13 @@ function whoWhen(a, up) {
|
|
|
241
243
|
const t = Date.parse(isStr(up) ? up : '');
|
|
242
244
|
return { ...(name ? { assignee: name } : {}), ...(Number.isFinite(t) ? { updated: new Date(t).toISOString() } : {}) };
|
|
243
245
|
}
|
|
246
|
+
/** Who asked (the reporter's display name only, never an email) and how the ticket was closed (the resolution's name, e.g. "Won't Do"):
|
|
247
|
+
* lib/declined-asks.js drafts the reply to the person who asked when an ask is closed without being done (bet A326). */
|
|
248
|
+
function askedClosed(rep, res) {
|
|
249
|
+
const nm = (v) => clip(oneLine(typeof v === 'string' ? v : v && typeof v === 'object' ? v.displayName || v.name || '' : ''), 80);
|
|
250
|
+
const reporter = nm(rep), resolution = nm(res);
|
|
251
|
+
return { ...(reporter ? { reporter } : {}), ...(resolution ? { resolution } : {}) };
|
|
252
|
+
}
|
|
244
253
|
/** The official Atlassian MCP connector returns custom fields under `fields.customFields`, keyed by name: { Sprint: { id: 'customfield_10004',
|
|
245
254
|
* value: [...] } }. They are put back at the top level under their id and their name, as the REST shape has them, so the sprint, points
|
|
246
255
|
* and flag rules read them. A field already at the top level wins. */
|
|
@@ -271,7 +280,7 @@ function normalizeIssue(x) {
|
|
|
271
280
|
return { key, summary, status, category: categoryOf(status, st.statusCategory), sprint: sprintIn(f), ...sprintsAll(sprintField(f)), subtasks: subtasksOf(f.subtasks), ...subsOf(f.subtasks), fixVersion: fixVersionsOf(f.fixVersions),
|
|
272
281
|
points: pointsIn(f), resolved: dayOf(f.resolutiondate || f.resolved),
|
|
273
282
|
flagged, reason: flagged ? (flaggedIn(f) ? 'Flagged in Jira' : `Status: ${status}`) : null, url: urlOf(x, key),
|
|
274
|
-
...typeParent(f.issuetype, f.parent), ...whoWhen(f.assignee, f.updated) };
|
|
283
|
+
...typeParent(f.issuetype, f.parent), ...whoWhen(f.assignee, f.updated), ...askedClosed(f.reporter, f.resolution) };
|
|
275
284
|
}
|
|
276
285
|
// The flat shape: what the skill tells the agent to write when it is unsure of the connector's shape.
|
|
277
286
|
const summary = clip(oneLine(x.summary || x.title), 250);
|
|
@@ -281,7 +290,7 @@ function normalizeIssue(x) {
|
|
|
281
290
|
return { key, summary, status, category: categoryOf(status, x.category), sprint: sprintOf(x.sprint), ...sprintsAll(x.sprints != null ? x.sprints : x.sprint), subtasks: subtasksOf(x.subtasks), ...subsOf(x.subtasks), fixVersion: fixVersionsOf(x.fixVersions != null ? x.fixVersions : x.fixVersion),
|
|
282
291
|
points: pointsIn(x), resolved: dayOf(x.resolved || x.resolutiondate),
|
|
283
292
|
flagged, reason: flagged ? clip(oneLine(x.reason || x.flag_reason || (x.flagged === true ? 'Flagged in Jira' : `Status: ${status}`)), 160) : null,
|
|
284
|
-
url: urlOf(x, key), ...typeParent(x.type != null ? x.type : x.issuetype, x.parent), ...whoWhen(x.assignee, x.updated) };
|
|
293
|
+
url: urlOf(x, key), ...typeParent(x.type != null ? x.type : x.issuetype, x.parent), ...whoWhen(x.assignee, x.updated), ...askedClosed(x.reporter, x.resolution) };
|
|
285
294
|
}
|
|
286
295
|
function normalize(raw) {
|
|
287
296
|
const list = issuesList(raw);
|