create-pmos 0.854.0 → 0.855.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 +10 -3
- package/payload/KIT-VERSION +1 -1
- package/payload/planning/evals/eval-calibration.md +1 -1
- package/payload/planning/okrs/health-budgets.md +1 -1
- package/payload/state/discoveries.md +1 -1
- package/workspace/changelog.json +9 -2
- package/workspace/guide/home.md +1 -0
- package/workspace/lib/ctrlk-do.js +156 -0
- package/workspace/lib/routes-boards.js +18 -0
- package/workspace/package-lock.json +2 -2
- package/workspace/package.json +1 -1
- package/workspace/public/pm/cozy-search.js +43 -4
- package/workspace/test-files.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-pmos",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.855.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": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"pmosChanges": [
|
|
36
36
|
{
|
|
37
|
-
"v": "0.
|
|
38
|
-
"at": "2026-11-25T22:
|
|
37
|
+
"v": "0.855.0",
|
|
38
|
+
"at": "2026-11-25T22:25:06.723Z",
|
|
39
39
|
"f": 4,
|
|
40
40
|
"prs": [
|
|
41
41
|
{
|
|
@@ -54,6 +54,13 @@
|
|
|
54
54
|
"see": "The Summary card gives the same To do, In progress and Done counts as the Tasks tabs, all work in the sprint's dates, Jira and not. Each count with work has one ✦ sentence written from the tickets,…",
|
|
55
55
|
"open": "/premium-board.html"
|
|
56
56
|
}
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"n": 2064,
|
|
60
|
+
"t": "Ctrl K does things — typed change, old → new, ✓ applies, Undo (A490)",
|
|
61
|
+
"s": "Ctrl K does things — typed change, old → new, ✓ applies, Undo (A490)",
|
|
62
|
+
"k": "new",
|
|
63
|
+
"i": "ctrlk-do"
|
|
57
64
|
}
|
|
58
65
|
]
|
|
59
66
|
},
|
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-25T22:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T22:25:04Z"}
|
|
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-25T22:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T22:25:04Z"}
|
|
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-25T22:
|
|
5
|
+
generated: {by: process:create-pmos, at: "2026-11-25T22:25:04Z"}
|
|
6
6
|
status: stable
|
|
7
7
|
---
|
|
8
8
|
|
package/workspace/changelog.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
[
|
|
2
2
|
{
|
|
3
|
-
"v": "0.
|
|
4
|
-
"at": "2026-11-25T22:
|
|
3
|
+
"v": "0.855.0",
|
|
4
|
+
"at": "2026-11-25T22:25:06.723Z",
|
|
5
5
|
"f": 4,
|
|
6
6
|
"prs": [
|
|
7
7
|
{
|
|
@@ -20,6 +20,13 @@
|
|
|
20
20
|
"see": "The Summary card gives the same To do, In progress and Done counts as the Tasks tabs, all work in the sprint's dates, Jira and not. Each count with work has one ✦ sentence written from the tickets,…",
|
|
21
21
|
"open": "/premium-board.html"
|
|
22
22
|
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"n": 2064,
|
|
26
|
+
"t": "Ctrl K does things — typed change, old → new, ✓ applies, Undo (A490)",
|
|
27
|
+
"s": "Ctrl K does things — typed change, old → new, ✓ applies, Undo (A490)",
|
|
28
|
+
"k": "new",
|
|
29
|
+
"i": "ctrlk-do"
|
|
23
30
|
}
|
|
24
31
|
]
|
|
25
32
|
},
|
package/workspace/guide/home.md
CHANGED
|
@@ -194,6 +194,7 @@ Some features, such as Notes, open as a plain card in the Viewer. Each one works
|
|
|
194
194
|
- **Guide** (the **?** icon in the menu) opens this guide in the Viewer.
|
|
195
195
|
- **What PMOS can do** lists every feature by job, each with how to reach it: its command (press it to put it in the chat box), its page, or its keys. Open it from Ctrl K (type "features"), from the ? key list, or from the guide. Features new since you last looked come first.
|
|
196
196
|
- **Search or ask** (Ctrl K or ⌘K, or `/`) finds initiatives, documents, sessions and files in your work. It always reads the repository and all its worktrees, so it has no worktree picker. It also reaches every page, each Settings section, the themes and the actions of the item you last pointed at: type "lib" to go to Library, or "conn" for Settings › Connectors.
|
|
197
|
+
- **Change something from Ctrl K.** Type a short change to one task: "done checkout redesign", "move survey to friday", "move checkout to next sprint", "give survey to Lee" or "make survey P1". Two changes to the same task can go in one line with "and" ("drop the survey and give it to Lee"). A **Change** row comes first. It shows each field's old value and its new value. Nothing changes while you type. Press ↵ or the row to apply it, and the toast shows **Undo** for 8 seconds. × drops the row. When the words fit more than one task, PMOS asks which one. A person PMOS does not know is underlined. Only these changes work here: Ctrl K never sends anything out of PMOS.
|
|
197
198
|
- **Dates** show the year only when the year is not this year, for example "Jun 23 ’27". New for you shows a due date as "due 25 Nov".
|
|
198
199
|
- **Settings** holds the workspace settings. **General** holds the theme (Light, Dark or Auto) and **Product**, which names the product the page reads. **Connectors** shows when PMOS last read each source. A source that is old or failed has an amber dot and ↻ to read it again. ↻ in the Connectors header reads every source again. While a source is old, an amber box at the top of Settings names it, with ↻.
|
|
199
200
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/* ctrlk-do.js — Ctrl K does things (bet A490, board CtrlKDoDS on the main canvas, agreed by Wawan 2026-11-25).
|
|
3
|
+
*
|
|
4
|
+
* A typed line that reads as a change to one PMOS task becomes a plan: the task, each field's old and new value, the writes that apply
|
|
5
|
+
* it and the writes that undo it. Nothing here writes. The page shows the plan as the Change row of Ctrl K and sends the writes only on ✓.
|
|
6
|
+
*
|
|
7
|
+
* Only known verbs, mapped onto the task writes that already exist (POST /api/boards/tasks/state and /api/boards/tasks/edit):
|
|
8
|
+
* done | finish | complete | close <task> state Done
|
|
9
|
+
* start <task> state In progress
|
|
10
|
+
* reopen <task> state To do
|
|
11
|
+
* drop | cancel <task> state Won't do
|
|
12
|
+
* move | put | push <task> to next sprint start and due = the sprint's days (the first future sprint after the active one)
|
|
13
|
+
* move | put <task> to sprint <name> the same, for a known sprint whose name holds the words
|
|
14
|
+
* move | push | set <task> to <day> due day (YYYY-MM-DD, 9 Dec, Dec 9, today, tomorrow, a weekday)
|
|
15
|
+
* give | assign | hand <task> to <person> owner
|
|
16
|
+
* make | set <task> P1|P2|P3 priority
|
|
17
|
+
* Clauses joined by "and" change the same task ("drop the survey task and give it to Sam"). Anything that would leave PMOS (send, post,
|
|
18
|
+
* email, Jira) is never a verb here: it has no Change row. A line with no verb, or a task that is not found, gives null (zero is silence).
|
|
19
|
+
*
|
|
20
|
+
* looksLikeChange(q) the line starts with a known verb (the page asks the server only then)
|
|
21
|
+
* planLine(q, { tasks, sprints, people, today, ws, pick })
|
|
22
|
+
* tasks: [{ id, board, title, state, owner, due, priority, sprint }] sprints: [{ name, state, start, end }] people: [names]
|
|
23
|
+
* pick: a task id the person chose when the words fit more than one
|
|
24
|
+
* → null | { which: [{ id, title }] } | { task: { id, title }, say, changes: [{ field, label, from, to, unsure? }], apply: [call], undo: [call] }
|
|
25
|
+
* call = { path, body } */
|
|
26
|
+
|
|
27
|
+
const VERB = /^\s*(done|finish|finished|complete|close|start|reopen|drop|cancel|move|put|push|set|give|assign|hand|make|mark)\b/i;
|
|
28
|
+
const looksLikeChange = (q) => VERB.test(String(q || ''));
|
|
29
|
+
|
|
30
|
+
const STATE = { done: 'Done', finish: 'Done', finished: 'Done', complete: 'Done', close: 'Done', start: 'In progress', reopen: 'To do', drop: "Won't do", cancel: "Won't do" };
|
|
31
|
+
const STOP = new Set(['the', 'a', 'an', 'task', 'my', 'our', 'this', 'that']);
|
|
32
|
+
const words = (s) => String(s || '').toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
|
|
33
|
+
const MONTHS = ['jan', 'feb', 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct', 'nov', 'dec'];
|
|
34
|
+
const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];
|
|
35
|
+
const iso = (d) => d.toISOString().slice(0, 10);
|
|
36
|
+
const say = (d) => { if (!d) return 'none'; const x = new Date(d + 'T00:00:00Z'); return isNaN(x) ? String(d) : x.getUTCDate() + ' ' + MONTHS[x.getUTCMonth()][0].toUpperCase() + MONTHS[x.getUTCMonth()].slice(1); };
|
|
37
|
+
|
|
38
|
+
/** A day typed in words, from today (YYYY-MM-DD); null when it is not a day. */
|
|
39
|
+
function dayOf(text, today) {
|
|
40
|
+
const t = String(text || '').trim().toLowerCase().replace(/^(on|by)\s+/, '');
|
|
41
|
+
const base = new Date((today || iso(new Date())) + 'T00:00:00Z');
|
|
42
|
+
if (/^\d{4}-\d{2}-\d{2}$/.test(t)) return t;
|
|
43
|
+
if (t === 'today') return iso(base);
|
|
44
|
+
if (t === 'tomorrow') return iso(new Date(base.getTime() + 864e5));
|
|
45
|
+
const wd = DAYS.findIndex((d) => d === t || d.slice(0, 3) === t || 'next ' + d === t);
|
|
46
|
+
if (wd >= 0) { const n = ((wd - base.getUTCDay() + 7) % 7) || 7; return iso(new Date(base.getTime() + n * 864e5)); }
|
|
47
|
+
let m = /^(\d{1,2})\s+([a-z]+)$/.exec(t), day, mon;
|
|
48
|
+
if (m) { day = +m[1]; mon = MONTHS.indexOf(m[2].slice(0, 3)); }
|
|
49
|
+
else if ((m = /^([a-z]+)\s+(\d{1,2})$/.exec(t))) { day = +m[2]; mon = MONTHS.indexOf(m[1].slice(0, 3)); }
|
|
50
|
+
if (!m || mon < 0 || day < 1 || day > 31) return null;
|
|
51
|
+
let y = base.getUTCFullYear();
|
|
52
|
+
let d = new Date(Date.UTC(y, mon, day));
|
|
53
|
+
if (d < base) d = new Date(Date.UTC(++y, mon, day)); // a day already past this year means next year's
|
|
54
|
+
return d.getUTCMonth() === mon ? iso(d) : null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** The tasks the words name: every word (stop words left out) starts a word of the title. Fewest extra title words first. */
|
|
58
|
+
function findTasks(phrase, tasks) {
|
|
59
|
+
const want = words(phrase).filter((w) => !STOP.has(w));
|
|
60
|
+
if (!want.length) return [];
|
|
61
|
+
return tasks.filter((t) => { const have = words(t.title); return want.every((w) => have.some((h) => h.startsWith(w))); })
|
|
62
|
+
.sort((a, b) => words(a.title).length - words(b.title).length);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/** One clause → { phrase, field, to } (phrase '' when it says "it"), or null. */
|
|
66
|
+
function clauseOf(c, ctx) {
|
|
67
|
+
const s = c.trim().replace(/[.!]+$/, '');
|
|
68
|
+
let m = /^(done|finish|finished|complete|close|start|reopen|drop|cancel)\s+(.+)$/i.exec(s);
|
|
69
|
+
if (m) return { phrase: m[2], field: 'state', to: STATE[m[1].toLowerCase()] };
|
|
70
|
+
m = /^mark\s+(.+?)\s+(?:as\s+)?(done|finished|complete|started|dropped)$/i.exec(s);
|
|
71
|
+
if (m) return { phrase: m[1], field: 'state', to: { done: 'Done', finished: 'Done', complete: 'Done', started: 'In progress', dropped: "Won't do" }[m[2].toLowerCase()] };
|
|
72
|
+
m = /^(?:move|put|push)\s+(.+?)\s+(?:in)?to\s+(?:the\s+)?next\s+sprint$/i.exec(s);
|
|
73
|
+
if (m) return { phrase: m[1], field: 'sprint', to: nextSprint(ctx.sprints) };
|
|
74
|
+
m = /^(?:move|put|push)\s+(.+?)\s+(?:in)?to\s+sprint\s+(.+)$/i.exec(s);
|
|
75
|
+
if (m) return { phrase: m[1], field: 'sprint', to: namedSprint(ctx.sprints, m[2]) };
|
|
76
|
+
m = /^(?:give|assign|hand)\s+(.+?)\s+to\s+(.+)$/i.exec(s);
|
|
77
|
+
if (m) return { phrase: m[1], field: 'owner', to: personOf(ctx.people, m[2]) };
|
|
78
|
+
m = /^(?:make|set|mark)\s+(.+?)\s+(?:to\s+|as\s+)?(p[1-3])$/i.exec(s);
|
|
79
|
+
if (m) return { phrase: m[1], field: 'priority', to: m[2].toUpperCase() };
|
|
80
|
+
m = /^(?:move|push|set|put)\s+(.+?)\s+(?:due\s+)?(?:to|on|by)\s+(.+)$/i.exec(s);
|
|
81
|
+
if (m) { const d = dayOf(m[2], ctx.today); if (d) return { phrase: m[1].replace(/\s+due$/i, ''), field: 'due', to: d }; }
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
function nextSprint(sprints) {
|
|
85
|
+
const S = (sprints || []).filter((x) => x && x.name);
|
|
86
|
+
const a = S.findIndex((x) => x.state === 'active');
|
|
87
|
+
const f = S.slice(a + 1).find((x) => x.state === 'future') || S.find((x) => x.state === 'future');
|
|
88
|
+
return f && f.start && f.end ? f : null;
|
|
89
|
+
}
|
|
90
|
+
function namedSprint(sprints, text) {
|
|
91
|
+
const want = words(text);
|
|
92
|
+
const f = (sprints || []).find((x) => x && x.name && want.every((w) => words(x.name).includes(w)));
|
|
93
|
+
return f && f.start && f.end ? f : null;
|
|
94
|
+
}
|
|
95
|
+
function personOf(people, text) {
|
|
96
|
+
const t = String(text || '').trim().replace(/[.!]+$/, '');
|
|
97
|
+
const known = (people || []).find((p) => String(p).toLowerCase() === t.toLowerCase())
|
|
98
|
+
|| (people || []).find((p) => words(p).some((w) => w.startsWith(t.toLowerCase())));
|
|
99
|
+
return known ? { name: String(known), unsure: false } : (t ? { name: t.replace(/\b\w/g, (c) => c.toUpperCase()), unsure: true } : null);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
const LABEL = { state: 'Status', sprint: 'Sprint', owner: 'Owner', priority: 'Priority', due: 'Due' };
|
|
103
|
+
/** The sprint a task sits in today: the one whose dates hold its due day (PMOS tasks join a sprint by its dates, tasks/edit "into sprint"). */
|
|
104
|
+
const sprintOfTask = (t, sprints) => { const d = String(t.due || '').slice(0, 10); const f = d && (sprints || []).find((x) => x && x.start && x.end && String(x.start).slice(0, 10) <= d && d <= String(x.end).slice(0, 10)); return f ? f.name : ''; };
|
|
105
|
+
const showOf = (field, v) => (field === 'due' ? say(v) : v == null || v === '' ? 'none' : String(v));
|
|
106
|
+
|
|
107
|
+
function planLine(q, o = {}) {
|
|
108
|
+
if (!looksLikeChange(q)) return null;
|
|
109
|
+
const tasks = (o.tasks || []).filter((t) => t && t.id && t.title);
|
|
110
|
+
const parts = String(q).split(/\s+and\s+/i);
|
|
111
|
+
const clauses = [];
|
|
112
|
+
for (const p of parts) {
|
|
113
|
+
const c = clauseOf(p, o);
|
|
114
|
+
if (!c) return null; // one part that is not a known change: no Change row at all, never half a change
|
|
115
|
+
clauses.push(c);
|
|
116
|
+
}
|
|
117
|
+
if (clauses.some((c) => c.to == null)) return null; // a sprint or a person that is not there
|
|
118
|
+
const named = clauses.map((c) => (/^(it|that|this)$/i.test(c.phrase.trim()) ? '' : c.phrase)).filter(Boolean);
|
|
119
|
+
if (!named.length) return null;
|
|
120
|
+
let task = null;
|
|
121
|
+
if (o.pick) task = tasks.find((t) => t.id === o.pick) || null;
|
|
122
|
+
if (!task) {
|
|
123
|
+
const found = findTasks(named[0], tasks);
|
|
124
|
+
if (!found.length) return null;
|
|
125
|
+
const exact = found.filter((t) => words(t.title).filter((w) => !STOP.has(w)).length === words(named[0]).filter((w) => !STOP.has(w)).length);
|
|
126
|
+
if (found.length > 1 && exact.length !== 1) return { which: found.slice(0, 3).map((t) => ({ id: t.id, title: t.title })) };
|
|
127
|
+
task = exact.length === 1 ? exact[0] : found[0];
|
|
128
|
+
}
|
|
129
|
+
if (named.slice(1).some((n) => !findTasks(n, [task]).length)) return null; // one line changes one task
|
|
130
|
+
const changes = [], edit = {}, undoEdit = {};
|
|
131
|
+
let state = null, stateFrom = null;
|
|
132
|
+
for (const c of clauses) {
|
|
133
|
+
if (c.field === 'sprint') {
|
|
134
|
+
const was = sprintOfTask(task, o.sprints);
|
|
135
|
+
if (was === c.to.name) continue;
|
|
136
|
+
changes.push({ field: 'sprint', label: LABEL.sprint, from: showOf('sprint', was), to: c.to.name });
|
|
137
|
+
edit.start = String(c.to.start).slice(0, 10); edit.due = String(c.to.end).slice(0, 10); edit.sprint = c.to.name;
|
|
138
|
+
undoEdit.start = String(task.start || '').slice(0, 10); undoEdit.due = String(task.due || '').slice(0, 10);
|
|
139
|
+
continue;
|
|
140
|
+
}
|
|
141
|
+
const to = c.field === 'owner' ? c.to.name : c.to;
|
|
142
|
+
const from = c.field === 'state' ? task.state : task[c.field] == null ? '' : task[c.field];
|
|
143
|
+
if (String(from || '') === String(to)) continue;
|
|
144
|
+
changes.push({ field: c.field, label: LABEL[c.field], from: showOf(c.field, from), to: showOf(c.field, to), ...(c.field === 'owner' && c.to.unsure ? { unsure: true } : {}) });
|
|
145
|
+
if (c.field === 'state') { state = to; stateFrom = from || 'To do'; } else { edit[c.field] = to; undoEdit[c.field] = from || ''; }
|
|
146
|
+
}
|
|
147
|
+
if (!changes.length) return null; // it already says that
|
|
148
|
+
const base = { ws: o.ws || undefined, board: task.board, task: task.id };
|
|
149
|
+
const apply = [], undo = [];
|
|
150
|
+
if (Object.keys(edit).length) { apply.push({ path: '/api/boards/tasks/edit', body: { ...base, ...edit } }); undo.push({ path: '/api/boards/tasks/edit', body: { ...base, ...undoEdit } }); }
|
|
151
|
+
if (state) { apply.push({ path: '/api/boards/tasks/state', body: { ...base, state, why: 'via Ctrl K' } }); undo.push({ path: '/api/boards/tasks/state', body: { ...base, state: stateFrom, why: 'Undo via Ctrl K' } }); }
|
|
152
|
+
const sayIt = changes.map((c) => (c.field === 'state' ? c.to : c.label + ' ' + c.to)).join(', ');
|
|
153
|
+
return { task: { id: task.id, title: task.title }, say: task.title + ': ' + sayIt, changes, apply, undo };
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
module.exports = { looksLikeChange, planLine, dayOf, findTasks };
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* GET /api/boards/columns?ws&board&q&owner&cap → { ok, columns: [{ stage, cat, hint, count, rows }] }
|
|
12
12
|
* GET /api/boards/initiative?ws&board&id → { ok, row, board, history, tools }
|
|
13
13
|
* GET /api/boards/asks?ws&board&state → { ok, asks } state: open (default) | accepted | declined | all
|
|
14
|
+
* GET /api/boards/do-parse?ws&q[&task] → { ok, plan } Ctrl K does things (A490, lib/ctrlk-do.js planLine), read-only
|
|
14
15
|
* GET /api/boards/sprints?ws&board → { ok, source: jira|none, readAt, sprints, backlog } (each sprint with goal, summary, themes, frozen; backlog: B.backlogOf)
|
|
15
16
|
* GET /api/boards/items?ws&board → { ok, build, jira, items, initiatives } PMOS tasks + Jira items (Build and deliver only)
|
|
16
17
|
* GET /api/boards/anchors?ws&board → { ok, anchors: [{ value, kind, group, label }], error } the declared KRs,
|
|
@@ -1158,6 +1159,23 @@ const READS = {
|
|
|
1158
1159
|
initiatives: live.map((x) => ({ id: x.id, title: x.title, stage: x.stage, cat: x.cat, status: x.status, signal: x.signal || null, owner: x.owner, anchor: x.anchor || '', rank: x.rank, start: x.start, end: x.end, progress: x.progress, template: x.template, epics: x.epics,
|
|
1159
1160
|
stages: (x.wfStages || []).map((st) => ({ key: st.key, name: st.name, milestone: !!st.milestone })), ...(x.wfMap ? { map: x.wfMap } : {}) })) }); // the sections a task can sit in (the task Viewer's move icon)
|
|
1160
1161
|
},
|
|
1162
|
+
'/api/boards/do-parse': (ctx, res, url) => {
|
|
1163
|
+
// Ctrl K does things (bet A490, lib/ctrlk-do.js): the plan for a typed change, read-only. The page sends the plan's writes only on ✓.
|
|
1164
|
+
const w = wsOf(ctx, url.searchParams.get('ws'));
|
|
1165
|
+
if (!w) return fail(ctx, res, 404, 'no such workspace');
|
|
1166
|
+
const q = String(url.searchParams.get('q') || '').slice(0, 300);
|
|
1167
|
+
const DO = require('./ctrlk-do.js');
|
|
1168
|
+
if (!DO.looksLikeChange(q)) return ctx.json(res, { ok: true, plan: null });
|
|
1169
|
+
const fr = frameFor(ctx, w);
|
|
1170
|
+
const P = fr.folded.priorities || new Map();
|
|
1171
|
+
const tasks = [...(fr.folded.tasks || new Map()).values()].filter((t) => t && t.board && fr.boards.some((b) => b.id === t.board))
|
|
1172
|
+
.map((t) => ({ id: t.id, board: t.board, title: t.title, state: t.state, owner: t.owner || '', start: t.start || '', due: t.due || '', priority: P.get(t.id) || '' }));
|
|
1173
|
+
let sprints = [];
|
|
1174
|
+
try { const whole = jiraStatus.readSprints(w.root); sprints = whole ? B.sprintsOf([], () => true, whole, null, {}).sprints || [] : []; } catch { sprints = []; }
|
|
1175
|
+
const people = [...new Set(tasks.map((t) => t.owner).filter(Boolean))];
|
|
1176
|
+
const plan = DO.planLine(q, { tasks, sprints, people, ws: w.id, pick: url.searchParams.get('task') || null });
|
|
1177
|
+
ctx.json(res, { ok: true, plan });
|
|
1178
|
+
},
|
|
1161
1179
|
'/api/boards/sprints': (ctx, res, url) => {
|
|
1162
1180
|
const r = boardRead(ctx, res, url);
|
|
1163
1181
|
if (!r) return;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pmos-workspace",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.855.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.855.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@anthropic-ai/sdk": "^1.3.0",
|
package/workspace/package.json
CHANGED
|
@@ -17,8 +17,9 @@
|
|
|
17
17
|
* Initiatives", "… · Work-items in Jira"), then everything else Search reads. An initiative the page lists is not listed twice.
|
|
18
18
|
* closeSearch()
|
|
19
19
|
* It reads GET /api/find (the repository and every worktree: lib/search-index.js), GET /api/boards/backlog (the initiatives' stage) and
|
|
20
|
-
* GET /api/sessions. A
|
|
21
|
-
*
|
|
20
|
+
* GET /api/sessions. A typed change (bet A490) also reads GET /api/boards/do-parse: its Change row writes only on ✓ or ↵ (the task writes
|
|
21
|
+
* that already exist), with Undo in the toast. A result opens in the Viewer when it can: a document of main as its page (premium-vw-doc.js), a meeting as its card,
|
|
22
|
+
* any other file read-only from its worktree (GET /api/find/file). Nothing else here writes. */
|
|
22
23
|
import { esc, svg, ICON, wsParam, wsQ, skelRows, cantRead, failedItem } from './cozy-evui.js';
|
|
23
24
|
const ARROW = { up: 'M12 19V5M6 11l6-6 6 6', down: 'M12 5v14M6 13l6 6 6-6', enter: 'M20 5v7a3 3 0 0 1-3 3H5M9 11l-4 4 4 4' }; // the footer's keys, drawn (R28-13: no glyph as a control)
|
|
24
25
|
import { SEARCH_KINDS, PHONE_KINDS, searchGroups, resultSub, resultTag } from './cozy-evmodel.js';
|
|
@@ -28,10 +29,12 @@ import { adler } from './cozy-adler.js'; // session names A: the PM's name win
|
|
|
28
29
|
|
|
29
30
|
const PHONE = 760;
|
|
30
31
|
const isPhone = () => innerWidth <= PHONE;
|
|
31
|
-
const S = { ask: null, el: null, q: '', kind: 'all', scope: null, at: 0, rows: [], res: null, busy: false, err: '', wt: null, back: null, go: null, seq: 0, boards: null, sessions: null, t: 0 };
|
|
32
|
+
const S = { doit: null, ask: null, el: null, q: '', kind: 'all', scope: null, at: 0, rows: [], res: null, busy: false, err: '', wt: null, back: null, go: null, seq: 0, boards: null, sessions: null, t: 0 };
|
|
32
33
|
const KIND_ICON = { initiative: ICON.flag, document: ICON.doc, slides: ICON.slides, report: ICON.report, artifact: ICON.design, file: ICON.file, meeting: ICON.meet, session: ICON.session };
|
|
33
34
|
/** A question: it ends with "?" or starts with a question word, and has 3 words or more (the same rule as lib/search-ask.js isQuestion). */
|
|
34
35
|
const QW = /^\s*(why|how|what|whats|what's|who|whom|whose|when|where|which|is|are|was|were|do|does|did|can|could|should|would|will|has|have|had)\b/i;
|
|
36
|
+
/** Ctrl K does things (bet A490): a line that starts with a known verb is asked as a change (the same rule as lib/ctrlk-do.js looksLikeChange). */
|
|
37
|
+
const CHANGE = /^\s*(done|finish|finished|complete|close|start|reopen|drop|cancel|move|put|push|set|give|assign|hand|make|mark)\b/i;
|
|
35
38
|
const isQuestion = (q) => String(q || '').trim().split(/\s+/).filter(Boolean).length >= 3 && (/\?\s*$/.test(String(q).trim()) || QW.test(q));
|
|
36
39
|
async function getj(p) { try { const r = await fetch(p, { credentials: 'same-origin' }); const j = await r.json().catch(() => null); return j || { ok: false, error: 'the server did not answer' }; } catch { return { ok: false, error: 'the server did not answer' }; } }
|
|
37
40
|
|
|
@@ -59,6 +62,7 @@ function mount() {
|
|
|
59
62
|
const b = e.target.closest('button, input[type="checkbox"]'); if (!b) return;
|
|
60
63
|
if (b.dataset.ev === 'close') { closeSearch(); return; }
|
|
61
64
|
if (b.dataset.evKind) { S.kind = b.dataset.evKind; S.at = 0; draw(); q.focus(); return; }
|
|
65
|
+
if ('evDrop' in b.dataset) { if (S.doit) S.doit.dropped = true; S.at = 0; draw(); return; }
|
|
62
66
|
if (b.dataset.evI != null) { const r = S.rows[+b.dataset.evI]; if (r) go(r); }
|
|
63
67
|
});
|
|
64
68
|
return S.el;
|
|
@@ -98,6 +102,7 @@ async function run() {
|
|
|
98
102
|
S.busy = false;
|
|
99
103
|
if (!r.ok) { S.err = r.error || 'the server did not answer'; draw(); return; }
|
|
100
104
|
S.res = r; draw();
|
|
105
|
+
if (CHANGE.test(q)) askChange(q, null);
|
|
101
106
|
// search-answers-questions: a question the copied sentence did not answer gets an answer written from the user's own files
|
|
102
107
|
if (!r.answer && isQuestion(q) && !(S.ask && S.ask.q === q)) {
|
|
103
108
|
S.ask = { q, busy: true, answer: null }; draw();
|
|
@@ -107,6 +112,32 @@ async function run() {
|
|
|
107
112
|
}
|
|
108
113
|
}
|
|
109
114
|
|
|
115
|
+
/* ── Ctrl K does things (bet A490, board CtrlKDoDS): a Change row first, old → new per field, ✓ applies, Undo takes it back ── */
|
|
116
|
+
async function askChange(q, pick) {
|
|
117
|
+
if (S.doit && S.doit.q === q && !pick) return;
|
|
118
|
+
S.doit = { q, plan: null, busy: true }; draw();
|
|
119
|
+
const p = await getj('/api/boards/do-parse?q=' + encodeURIComponent(q) + (pick ? '&task=' + encodeURIComponent(pick) : '') + wsQ('&'));
|
|
120
|
+
if (!S.doit || S.doit.q !== q) return;
|
|
121
|
+
S.doit = { q, plan: p && p.ok ? p.plan : null, busy: false }; S.at = 0; draw();
|
|
122
|
+
}
|
|
123
|
+
async function post(calls) {
|
|
124
|
+
const H = await import('./http.js');
|
|
125
|
+
for (const c of calls) { const r = await H.pmPost(c.path, c.body); if (!r || !r.ok) return (r && r.error) || 'the save did not land'; }
|
|
126
|
+
return null;
|
|
127
|
+
}
|
|
128
|
+
async function applyChange(plan) {
|
|
129
|
+
closeSearch();
|
|
130
|
+
const T = await import('./c3-toast.js');
|
|
131
|
+
const err = await post(plan.apply);
|
|
132
|
+
if (err) { T.toast({ text: 'Not changed: ' + err, tone: 'error' }); return; }
|
|
133
|
+
T.toast({ text: plan.say, actionLabel: 'Undo', timeout: 8000, onAction: async () => { const e = await post(plan.undo); if (e) T.toast({ text: 'Undo did not land: ' + e, tone: 'error' }); } });
|
|
134
|
+
}
|
|
135
|
+
const OK_D = 'M5 12l5 5 9-11', NO_D = 'M6 6l12 12M18 6L6 18';
|
|
136
|
+
function changeHtml(plan, i) {
|
|
137
|
+
const lines = plan.changes.map((c) => `<span class="ev-small" style="display:flex;gap:8px"><span class="ev-mut" style="min-width:64px">${esc(c.label)}</span><s class="ev-mut">${esc(c.from)}</s><span aria-hidden="true">→</span><b${c.unsure ? ' style="text-decoration:underline dotted"' : ''}>${esc(c.to)}</b></span>`).join('');
|
|
138
|
+
return `<div role="none" style="display:flex;align-items:flex-start;gap:4px"><button type="button" class="ev-mi${i === S.at ? ' hl' : ''}" role="option" id="evo${i}" data-ev-i="${i}" aria-selected="${i === S.at}" aria-label="${esc('Apply: ' + plan.say)}" style="flex:1;height:auto;align-items:flex-start">${svg(OK_D, 18)}<span class="ev-t" style="display:flex;flex-direction:column;gap:2px"><b>${esc(plan.task.title)}</b>${lines}</span></button><button type="button" class="ev-mi" data-ev-drop aria-label="Drop this change" title="Drop this change" style="width:auto;flex:none">${svg(NO_D, 16)}</button></div>`;
|
|
139
|
+
}
|
|
140
|
+
|
|
110
141
|
/** Every row the palette shows for the query: the search's results, the board's initiatives and the sessions that match, each once. */
|
|
111
142
|
function allRows() {
|
|
112
143
|
const q = S.q.trim().toLowerCase();
|
|
@@ -165,10 +196,16 @@ function drawList() {
|
|
|
165
196
|
const waiting = !ansRow && made && made.busy;
|
|
166
197
|
// chief-of-staff C5: the one chat is the first row of Search; a page's own find (U2 scope) keeps its own hits first, then the chat
|
|
167
198
|
const ownRows = own.flatMap((g) => g.rows);
|
|
168
|
-
|
|
199
|
+
const D = S.kind === 'all' && S.doit && S.doit.q === q && !S.doit.dropped ? S.doit : null;
|
|
200
|
+
const doRows = D && D.plan && D.plan.changes ? [{ kind: 'change', plan: D.plan }] : D && D.plan && D.plan.which ? D.plan.which.map((t) => ({ kind: 'which', id: t.id, title: t.title })) : [];
|
|
201
|
+
S.rows = doRows.concat(ansRow ? [ansRow] : [], ownRows, ask ? [ask] : [], groups.slice(own.length).flatMap((g) => g.rows));
|
|
169
202
|
S.at = Math.min(S.at, Math.max(0, S.rows.length - 1));
|
|
170
203
|
let h = '', i = 0;
|
|
171
204
|
const askHtml = () => `<button type="button" class="ev-mi${i === S.at ? ' hl' : ''}" role="option" id="evo${i}" data-ev-i="${i}" aria-selected="${i === S.at}">${svg(ICON.chat, 18)}<span class="ev-t">Ask PMOS: <b>“${esc(q)}”</b></span><span class="ev-k">${onHome() ? 'In the chat' : 'Opens the chat here'}</span></button>`;
|
|
205
|
+
if (doRows.length) {
|
|
206
|
+
h += `<p class="ev-mlbl">${doRows[0].kind === 'which' ? 'Change which one?' : 'Change'}</p>`;
|
|
207
|
+
for (const r of doRows) { h += r.kind === 'change' ? changeHtml(r.plan, i) : `<button type="button" class="ev-mi${i === S.at ? ' hl' : ''}" role="option" id="evo${i}" data-ev-i="${i}" aria-selected="${i === S.at}">${svg(ICON.flag, 18)}<span class="ev-t">${esc(r.title)}</span></button>`; i++; }
|
|
208
|
+
}
|
|
172
209
|
if (ansRow && !S.err) { h += answerHtml(ansRow.answer, i); i++; }
|
|
173
210
|
else if (waiting && !S.err) h += `<p class="ev-sp-empty" role="status">Finding an answer in your work…</p>`;
|
|
174
211
|
// the page's own groups first (UI grill U2): what Search itself could not read is said after them
|
|
@@ -212,6 +249,8 @@ addEventListener('resize', () => draw());
|
|
|
212
249
|
const onHome = () => /^\/(?:premium(?:\.html)?|index\.html)?$/.test(location.pathname);
|
|
213
250
|
function homeUrl(params) { const q = new URLSearchParams(params); if (wsParam()) q.set('ws', wsParam()); return '/premium.html?' + q.toString(); }
|
|
214
251
|
function go(r) {
|
|
252
|
+
if (r.kind === 'change') { applyChange(r.plan); return; }
|
|
253
|
+
if (r.kind === 'which') { askChange(S.q.trim(), r.id); return; }
|
|
215
254
|
closeSearch();
|
|
216
255
|
if (r.kind === 'ask') { askClaude(r.title); return; }
|
|
217
256
|
if (r.kind === 'answer') { const src = r.answer.source; go({ ...src, kind: src.kind || 'document', title: src.title || src.path }); return; }
|