openplanr 2.5.0 → 2.6.1
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/CHANGELOG.md +16 -0
- package/CONTRIBUTING.md +2 -31
- package/dist/services/codex-plugin-service.d.ts +2 -2
- package/dist/services/codex-plugin-service.d.ts.map +1 -1
- package/dist/services/codex-plugin-service.js +7 -7
- package/dist/services/codex-plugin-service.js.map +1 -1
- package/lib/host-packages/adapter-registry.json +5 -5
- package/lib/host-packages/capability-map.json +1 -1
- package/lib/host-packages/claude/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/claude/openplanr/.claude-plugin/plugin.json +1 -1
- package/lib/host-packages/claude/openplanr/.openplanr-content.json +46 -14
- package/lib/host-packages/claude/openplanr/skills/design/openplanr.skill.json +22 -0
- package/lib/host-packages/claude/openplanr/skills/design/scripts/design.mjs +69 -16
- package/lib/host-packages/claude/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/claude/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/claude/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/claude/openplanr/skills/design-loop/openplanr.skill.json +22 -0
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/design.mjs +69 -16
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/claude/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/claude/openplanr/skills/design-review/openplanr.skill.json +22 -0
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/design.mjs +69 -16
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/claude/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/claude/openplanr/skills/plan/openplanr.skill.json +22 -0
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/design.mjs +69 -16
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/claude/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/cursor/openplanr/.openplanr-content.json +42 -10
- package/lib/host-packages/cursor/openplanr/manifest.json +1 -1
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/design.mjs +69 -16
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-design/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/design.mjs +69 -16
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/design.mjs +69 -16
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-design-review/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/design.mjs +69 -16
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/cursor/openplanr/rules/planr-plan/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/openai/.claude-plugin/marketplace.json +2 -2
- package/lib/host-packages/openai/openplanr/.codex-plugin/plugin.json +1 -1
- package/lib/host-packages/openai/openplanr/.openplanr-content.json +46 -14
- package/lib/host-packages/openai/openplanr/skills/design/openplanr.skill.json +22 -0
- package/lib/host-packages/openai/openplanr/skills/design/scripts/design.mjs +69 -16
- package/lib/host-packages/openai/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/openai/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/openai/openplanr/skills/design/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/openai/openplanr/skills/design-loop/openplanr.skill.json +22 -0
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/design.mjs +69 -16
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/openai/openplanr/skills/design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/openai/openplanr/skills/design-review/openplanr.skill.json +22 -0
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/design.mjs +69 -16
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/openai/openplanr/skills/design-review/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/lib/host-packages/openai/openplanr/skills/plan/openplanr.skill.json +22 -0
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/design.mjs +69 -16
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/enhancements.js +19 -2
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/handoff-center.css +81 -0
- package/lib/host-packages/openai/openplanr/skills/plan/scripts/runtime/packages/design/templates/studio/handoff-center.js +400 -0
- package/package.json +2 -2
|
@@ -0,0 +1,400 @@
|
|
|
1
|
+
/* Five-step Design Handoff Center. Domain decisions stay in server projections. */
|
|
2
|
+
(() => {
|
|
3
|
+
'use strict';
|
|
4
|
+
if (document.currentScript && !document.currentScript.isConnected) return;
|
|
5
|
+
|
|
6
|
+
const q = (selector, parent = document) => parent.querySelector(selector);
|
|
7
|
+
const node = (tag, text = '', attrs = {}) => {
|
|
8
|
+
const value = document.createElement(tag);
|
|
9
|
+
if (text) value.textContent = text;
|
|
10
|
+
for (const [key, entry] of Object.entries(attrs)) if (entry !== undefined && entry !== null && entry !== false) value.setAttribute(key, entry);
|
|
11
|
+
return value;
|
|
12
|
+
};
|
|
13
|
+
const action = (label, run, attrs = {}) => {
|
|
14
|
+
const value = node('button', label, { type: 'button', ...attrs });
|
|
15
|
+
value.addEventListener('click', run);
|
|
16
|
+
return value;
|
|
17
|
+
};
|
|
18
|
+
const plainPackage = value => ({
|
|
19
|
+
id: value.id,
|
|
20
|
+
title: value.title,
|
|
21
|
+
sources: structuredClone(value.sources || []),
|
|
22
|
+
requirements: (value.requirements || []).map(({ id: _id, ...requirement }) => structuredClone(requirement)),
|
|
23
|
+
});
|
|
24
|
+
const requestId = prefix => `${prefix}-${globalThis.crypto?.randomUUID?.() || `${Date.now()}-${Math.random().toString(16).slice(2)}`}`;
|
|
25
|
+
const labels = { ready: 'Ready', pass: 'Complete', attention: 'Needs attention', blocked: 'Blocked', stale: 'Out of date', absent: 'Not available', approved: 'Approved', draft: 'Draft', superseded: 'Superseded', revoked: 'Revoked' };
|
|
26
|
+
const steps = [
|
|
27
|
+
['readiness', 'Readiness'],
|
|
28
|
+
['review', 'Review resolution'],
|
|
29
|
+
['package', 'Implementation package'],
|
|
30
|
+
['approval', 'Owner approval'],
|
|
31
|
+
['plan', 'Continue to Plan'],
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
let bridge, root, panel, opener, activeStep = 'readiness', serial = 0;
|
|
35
|
+
const state = { readiness: null, review: null, implementation: null, errors: {} };
|
|
36
|
+
|
|
37
|
+
const readiness = () => state.readiness?.readiness || state.readiness;
|
|
38
|
+
const approvedReview = () => Boolean(state.review?.current && state.review?.draft?.status === 'approved');
|
|
39
|
+
const packageDraft = () => state.implementation?.draft || null;
|
|
40
|
+
const currentPackage = () => state.implementation?.current || null;
|
|
41
|
+
const approvedPackage = () => currentPackage()?.status === 'approved';
|
|
42
|
+
const statusFor = id => {
|
|
43
|
+
if (state.errors[id === 'readiness' ? 'readiness' : id === 'review' ? 'review' : 'implementation']) return 'attention';
|
|
44
|
+
if (id === 'readiness') return readiness()?.status || 'absent';
|
|
45
|
+
if (id === 'review') return approvedReview() ? 'pass' : state.review?.draft ? (state.review.current ? 'attention' : 'stale') : 'blocked';
|
|
46
|
+
if (id === 'package') return packageDraft() ? 'pass' : readiness()?.status === 'ready' ? 'attention' : 'blocked';
|
|
47
|
+
if (id === 'approval') return approvedPackage() ? 'pass' : currentPackage()?.status || (packageDraft() ? 'attention' : 'blocked');
|
|
48
|
+
return approvedPackage() ? 'ready' : 'blocked';
|
|
49
|
+
};
|
|
50
|
+
const badge = value => node('span', labels[value] || value, { class: 'design-handoff-badge', 'data-status': value });
|
|
51
|
+
const paragraph = (text, className = '') => node('p', text, className ? { class: className } : {});
|
|
52
|
+
const empty = (title, detail) => {
|
|
53
|
+
const value = node('div', '', { class: 'design-handoff-empty' });
|
|
54
|
+
value.append(node('strong', title), paragraph(detail));
|
|
55
|
+
return value;
|
|
56
|
+
};
|
|
57
|
+
const sectionTitle = (eyebrow, title, detail) => {
|
|
58
|
+
const block = node('header', '', { class: 'design-handoff-step-header' });
|
|
59
|
+
block.append(node('span', eyebrow, { class: 'design-handoff-eyebrow' }), node('h3', title), paragraph(detail));
|
|
60
|
+
return block;
|
|
61
|
+
};
|
|
62
|
+
const setStatus = (message, error = false) => {
|
|
63
|
+
const live = q('[data-design-handoff-status]', panel);
|
|
64
|
+
if (!live) return;
|
|
65
|
+
live.textContent = message;
|
|
66
|
+
live.dataset.error = String(error);
|
|
67
|
+
};
|
|
68
|
+
const setBusy = busy => {
|
|
69
|
+
panel?.toggleAttribute('aria-busy', busy);
|
|
70
|
+
panel && q('[data-design-handoff-refresh]', panel)?.toggleAttribute('disabled', busy);
|
|
71
|
+
};
|
|
72
|
+
const perform = async (message, work, success) => {
|
|
73
|
+
setBusy(true); setStatus(message);
|
|
74
|
+
try {
|
|
75
|
+
await work();
|
|
76
|
+
await refresh();
|
|
77
|
+
setStatus(success);
|
|
78
|
+
} catch (error) {
|
|
79
|
+
setStatus(error?.message || 'The handoff action could not be completed. Refresh and try again.', true);
|
|
80
|
+
} finally { setBusy(false); }
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
function renderProgress() {
|
|
84
|
+
const progress = q('[data-design-handoff-progress]', panel);
|
|
85
|
+
progress.replaceChildren();
|
|
86
|
+
for (const [index, [id, label]] of steps.entries()) {
|
|
87
|
+
const status = statusFor(id);
|
|
88
|
+
const button = action(label, () => { activeStep = id; render(); q(`[data-handoff-step="${id}"]`, panel)?.focus(); }, {
|
|
89
|
+
class: 'design-handoff-step',
|
|
90
|
+
'data-handoff-step': id,
|
|
91
|
+
'data-status': status,
|
|
92
|
+
'aria-current': activeStep === id ? 'step' : undefined,
|
|
93
|
+
'aria-label': `${index + 1}. ${label}: ${labels[status] || status}`,
|
|
94
|
+
});
|
|
95
|
+
button.prepend(node('span', String(index + 1).padStart(2, '0'), { 'aria-hidden': 'true' }));
|
|
96
|
+
button.append(badge(status));
|
|
97
|
+
progress.append(button);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function recoveryAction(check) {
|
|
102
|
+
const label = check.recoveryAction?.label || 'Return to the design';
|
|
103
|
+
return action(label, () => {
|
|
104
|
+
if (['resolve-review-decisions', 'resolve-review-blockers', 'approve-review-handoff'].includes(check.recoveryAction?.id)) {
|
|
105
|
+
activeStep = 'review'; render();
|
|
106
|
+
} else {
|
|
107
|
+
close(); bridge.announce(`${check.message} ${label}.`);
|
|
108
|
+
}
|
|
109
|
+
}, { class: 'design-handoff-link' });
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function renderReadiness(content) {
|
|
113
|
+
const value = readiness();
|
|
114
|
+
content.append(sectionTitle('Step 1 of 5', 'Readiness', 'Confirm the current design, verification and review evidence before preparing implementation work.'));
|
|
115
|
+
if (state.errors.readiness) {
|
|
116
|
+
content.append(empty('Readiness is temporarily unavailable', state.errors.readiness));
|
|
117
|
+
content.append(action('Retry readiness', refresh, { class: 'design-primary' }));
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (!value || value.status === 'absent') {
|
|
121
|
+
content.append(empty('No readiness projection yet', value?.message || 'Complete a local design render to compute handoff readiness.'));
|
|
122
|
+
content.append(action(value?.nextAction?.label || 'Return to the design', close, { class: 'design-primary' }));
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
const summary = node('div', '', { class: 'design-handoff-summary' });
|
|
126
|
+
summary.append(badge(value.status), node('strong', value.status === 'ready' ? 'This design can move into implementation packaging.' : `${value.blockers?.length || 0} blocking checks remain.`));
|
|
127
|
+
content.append(summary);
|
|
128
|
+
const list = node('ol', '', { class: 'design-handoff-checks' });
|
|
129
|
+
for (const check of value.checks || []) {
|
|
130
|
+
const item = node('li', '', { 'data-status': check.status });
|
|
131
|
+
const body = node('div'); body.append(node('strong', check.message), badge(check.status));
|
|
132
|
+
item.append(body);
|
|
133
|
+
if (check.status !== 'pass') item.append(recoveryAction(check));
|
|
134
|
+
list.append(item);
|
|
135
|
+
}
|
|
136
|
+
content.append(list);
|
|
137
|
+
if (value.status === 'ready') content.append(action('Review resolved feedback', () => { activeStep = 'review'; render(); }, { class: 'design-primary' }));
|
|
138
|
+
else if (value.nextActions?.[0]) content.append(recoveryAction({ message: 'Readiness needs attention.', recoveryAction: value.nextActions[0] }));
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function reviewGroup(title, items) {
|
|
142
|
+
const section = node('section', '', { class: 'design-handoff-review-group' });
|
|
143
|
+
section.append(node('h4', `${title} · ${items?.length || 0}`));
|
|
144
|
+
if (!items?.length) section.append(paragraph('None recorded.', 'design-muted'));
|
|
145
|
+
for (const item of items || []) {
|
|
146
|
+
const card = node('article');
|
|
147
|
+
card.append(paragraph(item.text || item.statement || 'Review decision'));
|
|
148
|
+
if (item.refinement) card.append(paragraph(item.refinement, 'design-handoff-refinement'));
|
|
149
|
+
section.append(card);
|
|
150
|
+
}
|
|
151
|
+
return section;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function renderReview(content) {
|
|
155
|
+
content.append(sectionTitle('Step 2 of 5', 'Review resolution', 'Turn current feedback into explicit accepted, open, deferred and declined decisions.'));
|
|
156
|
+
if (state.errors.review) {
|
|
157
|
+
content.append(empty('Review decisions could not be loaded', state.errors.review));
|
|
158
|
+
content.append(action('Retry review decisions', refresh, { class: 'design-primary' }));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
const response = state.review, draft = response?.draft;
|
|
162
|
+
if (!draft) {
|
|
163
|
+
content.append(empty('No review handoff has been prepared', 'Generate a proposal from the current comments. You will review every decision before approval.'));
|
|
164
|
+
content.append(action('Generate review handoff', () => perform('Generating review decisions…', async () => {
|
|
165
|
+
state.review = await bridge.updateReviewHandoff({ action: 'draft', version: 0 });
|
|
166
|
+
}, 'Review decisions generated.'), { class: 'design-primary' }));
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
const status = response.current ? draft.status : 'stale';
|
|
170
|
+
const summary = node('div', '', { class: 'design-handoff-summary' });
|
|
171
|
+
summary.append(badge(status), node('strong', draft.content?.summary || (response.current ? 'Review decisions match this design.' : 'The design or feedback changed after this handoff was prepared.')));
|
|
172
|
+
content.append(summary);
|
|
173
|
+
const decisions = node('div', '', { class: 'design-handoff-review-groups' });
|
|
174
|
+
decisions.append(
|
|
175
|
+
reviewGroup('Accepted changes', draft.content?.agreedChanges),
|
|
176
|
+
reviewGroup('Open questions', draft.content?.openQuestions),
|
|
177
|
+
reviewGroup('Deferred', draft.content?.deferred),
|
|
178
|
+
reviewGroup('Declined', draft.content?.rejected),
|
|
179
|
+
);
|
|
180
|
+
content.append(decisions);
|
|
181
|
+
const label = approvedReview() ? 'Continue to implementation package' : response.current ? 'Review and approve decisions' : 'Regenerate current decisions';
|
|
182
|
+
content.append(action(label, () => {
|
|
183
|
+
if (approvedReview()) { activeStep = 'package'; render(); }
|
|
184
|
+
else bridge.openReviewHandoff();
|
|
185
|
+
}, { class: 'design-primary' }));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function packageEditor(source, { regenerate = false } = {}) {
|
|
189
|
+
const form = node('form', '', { class: 'design-handoff-package-editor' });
|
|
190
|
+
const editable = plainPackage(source);
|
|
191
|
+
const title = node('input', '', { type: 'text', required: '', maxlength: '256', 'aria-label': 'Implementation package title' });
|
|
192
|
+
title.value = editable.title;
|
|
193
|
+
const titleLabel = node('label', 'Package title'); titleLabel.append(title); form.append(titleLabel);
|
|
194
|
+
const requirements = node('div', '', { class: 'design-handoff-requirements' });
|
|
195
|
+
const editors = editable.requirements.map((requirement, index) => {
|
|
196
|
+
const card = node('fieldset'); card.append(node('legend', `${requirement.kind.replaceAll('-', ' ')} requirement ${index + 1}`));
|
|
197
|
+
const statement = node('textarea', '', { required: '', maxlength: '16384', 'aria-label': `Requirement ${index + 1} statement` }); statement.value = requirement.statement;
|
|
198
|
+
const verification = node('textarea', '', { required: '', maxlength: '16384', 'aria-label': `Requirement ${index + 1} verification` }); verification.value = requirement.verification.join('\n');
|
|
199
|
+
const statementLabel = node('label', 'Requirement'); statementLabel.append(statement);
|
|
200
|
+
const verificationLabel = node('label', 'Verification, one expectation per line'); verificationLabel.append(verification);
|
|
201
|
+
card.append(statementLabel, verificationLabel); requirements.append(card);
|
|
202
|
+
return { requirement, statement, verification };
|
|
203
|
+
});
|
|
204
|
+
form.append(requirements);
|
|
205
|
+
const save = node('button', regenerate ? 'Create next package version' : 'Save implementation package', { type: 'submit', class: 'design-primary' });
|
|
206
|
+
form.append(save);
|
|
207
|
+
form.addEventListener('submit', event => {
|
|
208
|
+
event.preventDefault();
|
|
209
|
+
if (!form.reportValidity()) return;
|
|
210
|
+
editable.title = title.value.trim();
|
|
211
|
+
editable.requirements = editors.map(({ requirement, statement, verification }) => ({
|
|
212
|
+
...requirement,
|
|
213
|
+
statement: statement.value.trim(),
|
|
214
|
+
verification: verification.value.split('\n').map(value => value.trim()).filter(Boolean),
|
|
215
|
+
}));
|
|
216
|
+
const input = regenerate
|
|
217
|
+
? { action: 'regenerate', requestId: requestId('regenerate'), package: editable }
|
|
218
|
+
: { action: 'draft', package: editable };
|
|
219
|
+
void perform(regenerate ? 'Creating a new package version…' : 'Saving the implementation package…', async () => {
|
|
220
|
+
await bridge.updateImplementationHandoff(input);
|
|
221
|
+
}, regenerate ? 'A new package version is ready for approval.' : 'Implementation package saved.');
|
|
222
|
+
});
|
|
223
|
+
return form;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
function renderPackage(content) {
|
|
227
|
+
content.append(sectionTitle('Step 3 of 5', 'Implementation package', 'Review traceable requirements and observable verification expectations. Integrity values stay in the contract and are hidden here.'));
|
|
228
|
+
if (state.errors.implementation) {
|
|
229
|
+
content.append(empty('Implementation package could not be loaded', state.errors.implementation));
|
|
230
|
+
content.append(action('Retry implementation package', refresh, { class: 'design-primary' }));
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
const response = state.implementation, draft = response?.draft;
|
|
234
|
+
if (!approvedReview() || readiness()?.status !== 'ready') {
|
|
235
|
+
content.append(empty('Readiness must be complete first', 'Approve current review decisions and resolve every blocking readiness check before composing the implementation package.'));
|
|
236
|
+
content.append(action('Return to readiness', () => { activeStep = 'readiness'; render(); }, { class: 'design-primary' }));
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
if (!draft) {
|
|
240
|
+
const proposal = response?.proposal;
|
|
241
|
+
if (!proposal) {
|
|
242
|
+
content.append(empty('No package proposal is available', 'Refresh the current design render, then return here to prepare the implementation scope.'));
|
|
243
|
+
content.append(action('Refresh package proposal', refresh, { class: 'design-primary' }));
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
content.append(paragraph(`${proposal.sources.length} approved sources · ${proposal.requirements.length} proposed requirements`, 'design-muted'));
|
|
247
|
+
content.append(packageEditor(proposal));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
const summary = node('div', '', { class: 'design-handoff-summary' });
|
|
251
|
+
summary.append(badge(draft.status), node('strong', `${draft.title} · version ${draft.version}`));
|
|
252
|
+
content.append(summary, paragraph(`${draft.sources.length} sources · ${draft.requirements.length} requirements`, 'design-muted'));
|
|
253
|
+
const list = node('ol', '', { class: 'design-handoff-requirement-list' });
|
|
254
|
+
for (const requirement of draft.requirements) {
|
|
255
|
+
const item = node('li');
|
|
256
|
+
item.append(node('strong', requirement.statement), paragraph(requirement.verification.join(' · '), 'design-muted'));
|
|
257
|
+
list.append(item);
|
|
258
|
+
}
|
|
259
|
+
content.append(list);
|
|
260
|
+
if (approvedPackage()) {
|
|
261
|
+
const edit = node('details'); edit.append(node('summary', 'Prepare a revised package version'), packageEditor(draft, { regenerate: true })); content.append(edit);
|
|
262
|
+
}
|
|
263
|
+
content.append(action('Review owner approval', () => { activeStep = 'approval'; render(); }, { class: 'design-primary' }));
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function renderApproval(content) {
|
|
267
|
+
content.append(sectionTitle('Step 4 of 5', 'Owner approval', 'Approval records the exact package version and permits a later, separate Plan invocation.'));
|
|
268
|
+
if (state.errors.implementation) {
|
|
269
|
+
content.append(empty('Approval state could not be loaded', state.errors.implementation));
|
|
270
|
+
content.append(action('Retry approval state', refresh, { class: 'design-primary' }));
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const response = state.implementation, draft = response?.draft, current = response?.current, preview = response?.approvalPreview;
|
|
274
|
+
if (!draft) {
|
|
275
|
+
content.append(empty('No package is ready for approval', 'Complete the implementation package before requesting owner approval.'));
|
|
276
|
+
content.append(action('Prepare implementation package', () => { activeStep = 'package'; render(); }, { class: 'design-primary' }));
|
|
277
|
+
return;
|
|
278
|
+
}
|
|
279
|
+
if (approvedPackage()) {
|
|
280
|
+
const approved = response.history?.find(item => item.id === current.id && item.version === current.version);
|
|
281
|
+
content.append(node('div', '', { class: 'design-handoff-approval-card' }));
|
|
282
|
+
const card = content.lastElementChild;
|
|
283
|
+
card.append(badge('approved'), node('h4', approved?.title || draft.title), paragraph(`Version ${current.version} was approved${approved?.approval?.actorId ? ` by ${approved.approval.actorId}` : ''}${approved?.approval?.approvedAt ? ` on ${new Date(approved.approval.approvedAt).toLocaleString()}` : ''}.`));
|
|
284
|
+
content.append(action('Continue to Plan', () => { activeStep = 'plan'; render(); }, { class: 'design-primary' }));
|
|
285
|
+
const details = node('details'); details.append(node('summary', 'Revoke this approval'));
|
|
286
|
+
const reason = node('textarea', '', { 'aria-label': 'Revocation reason', maxlength: '16384', placeholder: 'Why is this package no longer approved?' });
|
|
287
|
+
details.append(reason, action('Revoke approval', () => {
|
|
288
|
+
if (!reason.value.trim()) { reason.setCustomValidity('Enter a revocation reason.'); reason.reportValidity(); return; }
|
|
289
|
+
reason.setCustomValidity('');
|
|
290
|
+
void perform('Revoking approval…', async () => bridge.updateImplementationHandoff({ action: 'revoke', requestId: requestId('revoke'), expectedVersion: current.version, expectedContentDigest: current.contentDigest, reason: reason.value.trim() }), 'Approval revoked.');
|
|
291
|
+
}, { class: 'design-danger' }));
|
|
292
|
+
content.append(details);
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
if (!preview?.available) {
|
|
296
|
+
content.append(empty(current?.status === 'revoked' ? 'The current approval was revoked' : 'This package cannot be approved yet', 'Refresh the package against the current ready design, then review approval again.'));
|
|
297
|
+
content.append(action('Review implementation package', () => { activeStep = 'package'; render(); }, { class: 'design-primary' }));
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const card = node('div', '', { class: 'design-handoff-approval-card' });
|
|
301
|
+
card.append(node('h4', preview.summary.title), paragraph(`Version ${preview.summary.packageVersion} · ${preview.summary.requirementCount} requirements · direction ${preview.summary.selectedVariant}`), paragraph(preview.summary.description, 'design-muted'));
|
|
302
|
+
content.append(card, action('Approve exact package', () => perform('Recording owner approval…', async () => {
|
|
303
|
+
await bridge.updateImplementationHandoff({ action: 'approve', requestId: requestId('approve'), ...preview.approvalRequest });
|
|
304
|
+
}, 'Implementation package approved.'), { class: 'design-primary' }));
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async function copyText(value, output) {
|
|
308
|
+
try { await navigator.clipboard.writeText(value); output.textContent = 'Invocation copied. Paste it into your active coding agent when you are ready.'; }
|
|
309
|
+
catch {
|
|
310
|
+
const field = node('textarea', '', { readonly: '', 'aria-label': 'Plan invocation' }); field.value = value; output.before(field); field.focus(); field.select(); output.textContent = 'Copy the selected invocation.';
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function renderPlan(content) {
|
|
315
|
+
content.append(sectionTitle('Step 5 of 5', 'Continue to Plan', 'Prepare an explicit host handoff. Plan remains a separate action; Ship is never started here.'));
|
|
316
|
+
if (!approvedPackage()) {
|
|
317
|
+
content.append(empty('An approved current package is required', currentPackage()?.status === 'revoked' ? 'This package was revoked. Prepare and approve a current version before planning.' : 'Complete owner approval before preparing the Plan invocation.'));
|
|
318
|
+
content.append(action('Review owner approval', () => { activeStep = 'approval'; render(); }, { class: 'design-primary' }));
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
const context = bridge.context();
|
|
322
|
+
const subject = node('input', '', { type: 'text', required: '', maxlength: '256', value: context.designId, 'aria-label': 'Plan subject' });
|
|
323
|
+
const label = node('label', 'Plan subject'); label.append(subject); content.append(label);
|
|
324
|
+
const result = node('div', '', { class: 'design-handoff-plan-result', 'aria-live': 'polite' });
|
|
325
|
+
content.append(action('Prepare Plan handoff', async () => {
|
|
326
|
+
setBusy(true); setStatus('Preparing the Plan handoff…');
|
|
327
|
+
try {
|
|
328
|
+
const response = await bridge.updateImplementationHandoff({ action: 'continue-to-plan', subject: subject.value.trim() });
|
|
329
|
+
const handoff = response.handoff;
|
|
330
|
+
if (typeof bridge.continueToActiveHost === 'function') {
|
|
331
|
+
await bridge.continueToActiveHost(handoff);
|
|
332
|
+
result.textContent = 'The approved package was handed to the active host. Invoke Plan there to continue.';
|
|
333
|
+
} else {
|
|
334
|
+
const host = String(context.host || '').toLowerCase();
|
|
335
|
+
const key = host.includes('claude') ? 'claudeCode' : host.includes('codex') ? 'codex' : host.includes('cursor') ? 'cursor' : 'fallback';
|
|
336
|
+
const invocation = handoff.invocations[key] || handoff.invocations.fallback;
|
|
337
|
+
result.replaceChildren(node('code', invocation));
|
|
338
|
+
result.append(action('Copy invocation', () => void copyText(invocation, result), { class: 'design-handoff-copy' }));
|
|
339
|
+
}
|
|
340
|
+
setStatus('Plan handoff prepared. No planning files, agents, Git state or Ship run were changed.');
|
|
341
|
+
} catch (error) { setStatus(error?.message || 'The Plan handoff could not be prepared.', true); }
|
|
342
|
+
finally { setBusy(false); }
|
|
343
|
+
}, { class: 'design-primary' }), result);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
function render() {
|
|
347
|
+
if (!panel) return;
|
|
348
|
+
renderProgress();
|
|
349
|
+
const content = q('[data-design-handoff-content]', panel); content.replaceChildren();
|
|
350
|
+
({ readiness: renderReadiness, review: renderReview, package: renderPackage, approval: renderApproval, plan: renderPlan })[activeStep](content);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
async function refresh() {
|
|
354
|
+
const attempt = ++serial;
|
|
355
|
+
setBusy(true); setStatus('Refreshing handoff state…');
|
|
356
|
+
const results = await Promise.allSettled([bridge.loadReadiness(), bridge.loadReviewHandoff(), bridge.loadImplementationHandoff()]);
|
|
357
|
+
if (attempt !== serial || !panel) return;
|
|
358
|
+
for (const [index, key] of ['readiness', 'review', 'implementation'].entries()) {
|
|
359
|
+
const result = results[index];
|
|
360
|
+
if (result.status === 'fulfilled') { state[key] = result.value; delete state.errors[key]; }
|
|
361
|
+
else state.errors[key] = result.reason?.message || 'This state is temporarily unavailable.';
|
|
362
|
+
}
|
|
363
|
+
setBusy(false); setStatus(Object.keys(state.errors).length ? 'Some handoff state is unavailable. The current design remains usable.' : 'Handoff state is current.', Boolean(Object.keys(state.errors).length));
|
|
364
|
+
render();
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function close() {
|
|
368
|
+
if (!panel) return;
|
|
369
|
+
const returnTo = opener; panel.remove(); panel = null; delete root.dataset.designHandoffOpen;
|
|
370
|
+
returnTo?.isConnected && returnTo.focus({ preventScroll: true });
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
function open(step = activeStep) {
|
|
374
|
+
if (!bridge.owner()) return bridge.announce('Only a design owner can prepare an implementation handoff.', true);
|
|
375
|
+
activeStep = steps.some(([id]) => id === step) ? step : 'readiness';
|
|
376
|
+
if (panel) { render(); q(`[data-handoff-step="${activeStep}"]`, panel)?.focus(); return; }
|
|
377
|
+
opener = document.activeElement; root.dataset.designHandoffOpen = 'true';
|
|
378
|
+
panel = node('aside', '', { class: 'design-handoff-center', role: 'dialog', 'aria-modal': 'false', 'aria-labelledby': 'design-handoff-center-title' });
|
|
379
|
+
const header = node('header');
|
|
380
|
+
const heading = node('div'); heading.append(node('span', 'Owner workspace', { class: 'design-handoff-eyebrow' }), node('h2', 'Handoff Center', { id: 'design-handoff-center-title' }));
|
|
381
|
+
header.append(heading, action('×', close, { 'aria-label': 'Close Handoff Center', class: 'design-handoff-close' }));
|
|
382
|
+
const progress = node('nav', '', { class: 'design-handoff-progress', 'data-design-handoff-progress': '', 'aria-label': 'Design handoff progress' });
|
|
383
|
+
const content = node('section', '', { class: 'design-handoff-content', 'data-design-handoff-content': '', tabindex: '-1' });
|
|
384
|
+
const footer = node('footer'); footer.append(node('p', '', { 'data-design-handoff-status': '', role: 'status', 'aria-live': 'polite' }), action('Refresh', refresh, { 'data-design-handoff-refresh': '' }));
|
|
385
|
+
panel.append(header, progress, content, footer); root.append(panel);
|
|
386
|
+
panel.addEventListener('keydown', event => { if (event.key === 'Escape') { event.preventDefault(); close(); } });
|
|
387
|
+
render(); q(`[data-handoff-step="${activeStep}"]`, panel)?.focus({ preventScroll: true }); void refresh();
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
function mount() {
|
|
391
|
+
bridge = window.__openPlanrDesignHandoffBridge;
|
|
392
|
+
root = q('.planr-shell');
|
|
393
|
+
if (!bridge || !root) return false;
|
|
394
|
+
window.__openPlanrDesignHandoffCenter = Object.freeze({ open, close, refresh, getState: () => ({ open: Boolean(panel), step: activeStep, statuses: Object.fromEntries(steps.map(([id]) => [id, statusFor(id)])) }) });
|
|
395
|
+
return true;
|
|
396
|
+
}
|
|
397
|
+
const started = Date.now();
|
|
398
|
+
function boot() { if (!mount() && Date.now() - started < 15000) setTimeout(boot, 30); }
|
|
399
|
+
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot, { once: true }); else boot();
|
|
400
|
+
})();
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"files": [
|
|
9
9
|
{
|
|
10
10
|
"path": "manifest.json",
|
|
11
|
-
"digest": "sha256:
|
|
11
|
+
"digest": "sha256:1792e219cbc52762a182c31ec1a2432262067dd5f12cfcc9337653bc8ee22cec"
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"path": "rules/planr-artifact.mdc",
|
|
@@ -244,7 +244,7 @@
|
|
|
244
244
|
},
|
|
245
245
|
{
|
|
246
246
|
"path": "rules/planr-design-loop/scripts/design.mjs",
|
|
247
|
-
"digest": "sha256:
|
|
247
|
+
"digest": "sha256:3fec9a1d47bc41c0caf4909a2c4b9d00205da630c015a46f6921caf2a4d7a2d2"
|
|
248
248
|
},
|
|
249
249
|
{
|
|
250
250
|
"path": "rules/planr-design-loop/scripts/runtime/notices/entities.txt",
|
|
@@ -264,7 +264,15 @@
|
|
|
264
264
|
},
|
|
265
265
|
{
|
|
266
266
|
"path": "rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/enhancements.js",
|
|
267
|
-
"digest": "sha256:
|
|
267
|
+
"digest": "sha256:e967e9a622018a3bfdd52751ecfa6e842dbbf1922f573f3395a2bf29ca028589"
|
|
268
|
+
},
|
|
269
|
+
{
|
|
270
|
+
"path": "rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.css",
|
|
271
|
+
"digest": "sha256:2f972f98d16723fd19989df349f6342e6eae951820e53ca84f310b433ef83b48"
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
"path": "rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/handoff-center.js",
|
|
275
|
+
"digest": "sha256:012f648cf3936be649ac5f4935412a91489c8f90e076400dc19fbc6ebbf38b21"
|
|
268
276
|
},
|
|
269
277
|
{
|
|
270
278
|
"path": "rules/planr-design-loop/scripts/runtime/packages/design/templates/studio/share.css",
|
|
@@ -420,7 +428,7 @@
|
|
|
420
428
|
},
|
|
421
429
|
{
|
|
422
430
|
"path": "rules/planr-design-review/scripts/design.mjs",
|
|
423
|
-
"digest": "sha256:
|
|
431
|
+
"digest": "sha256:3fec9a1d47bc41c0caf4909a2c4b9d00205da630c015a46f6921caf2a4d7a2d2"
|
|
424
432
|
},
|
|
425
433
|
{
|
|
426
434
|
"path": "rules/planr-design-review/scripts/runtime/notices/entities.txt",
|
|
@@ -440,7 +448,15 @@
|
|
|
440
448
|
},
|
|
441
449
|
{
|
|
442
450
|
"path": "rules/planr-design-review/scripts/runtime/packages/design/templates/studio/enhancements.js",
|
|
443
|
-
"digest": "sha256:
|
|
451
|
+
"digest": "sha256:e967e9a622018a3bfdd52751ecfa6e842dbbf1922f573f3395a2bf29ca028589"
|
|
452
|
+
},
|
|
453
|
+
{
|
|
454
|
+
"path": "rules/planr-design-review/scripts/runtime/packages/design/templates/studio/handoff-center.css",
|
|
455
|
+
"digest": "sha256:2f972f98d16723fd19989df349f6342e6eae951820e53ca84f310b433ef83b48"
|
|
456
|
+
},
|
|
457
|
+
{
|
|
458
|
+
"path": "rules/planr-design-review/scripts/runtime/packages/design/templates/studio/handoff-center.js",
|
|
459
|
+
"digest": "sha256:012f648cf3936be649ac5f4935412a91489c8f90e076400dc19fbc6ebbf38b21"
|
|
444
460
|
},
|
|
445
461
|
{
|
|
446
462
|
"path": "rules/planr-design-review/scripts/runtime/packages/design/templates/studio/share.css",
|
|
@@ -596,7 +612,7 @@
|
|
|
596
612
|
},
|
|
597
613
|
{
|
|
598
614
|
"path": "rules/planr-design/scripts/design.mjs",
|
|
599
|
-
"digest": "sha256:
|
|
615
|
+
"digest": "sha256:3fec9a1d47bc41c0caf4909a2c4b9d00205da630c015a46f6921caf2a4d7a2d2"
|
|
600
616
|
},
|
|
601
617
|
{
|
|
602
618
|
"path": "rules/planr-design/scripts/runtime/notices/entities.txt",
|
|
@@ -616,7 +632,15 @@
|
|
|
616
632
|
},
|
|
617
633
|
{
|
|
618
634
|
"path": "rules/planr-design/scripts/runtime/packages/design/templates/studio/enhancements.js",
|
|
619
|
-
"digest": "sha256:
|
|
635
|
+
"digest": "sha256:e967e9a622018a3bfdd52751ecfa6e842dbbf1922f573f3395a2bf29ca028589"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"path": "rules/planr-design/scripts/runtime/packages/design/templates/studio/handoff-center.css",
|
|
639
|
+
"digest": "sha256:2f972f98d16723fd19989df349f6342e6eae951820e53ca84f310b433ef83b48"
|
|
640
|
+
},
|
|
641
|
+
{
|
|
642
|
+
"path": "rules/planr-design/scripts/runtime/packages/design/templates/studio/handoff-center.js",
|
|
643
|
+
"digest": "sha256:012f648cf3936be649ac5f4935412a91489c8f90e076400dc19fbc6ebbf38b21"
|
|
620
644
|
},
|
|
621
645
|
{
|
|
622
646
|
"path": "rules/planr-design/scripts/runtime/packages/design/templates/studio/share.css",
|
|
@@ -804,7 +828,7 @@
|
|
|
804
828
|
},
|
|
805
829
|
{
|
|
806
830
|
"path": "rules/planr-plan/scripts/design.mjs",
|
|
807
|
-
"digest": "sha256:
|
|
831
|
+
"digest": "sha256:3fec9a1d47bc41c0caf4909a2c4b9d00205da630c015a46f6921caf2a4d7a2d2"
|
|
808
832
|
},
|
|
809
833
|
{
|
|
810
834
|
"path": "rules/planr-plan/scripts/planning-ids.mjs",
|
|
@@ -828,7 +852,15 @@
|
|
|
828
852
|
},
|
|
829
853
|
{
|
|
830
854
|
"path": "rules/planr-plan/scripts/runtime/packages/design/templates/studio/enhancements.js",
|
|
831
|
-
"digest": "sha256:
|
|
855
|
+
"digest": "sha256:e967e9a622018a3bfdd52751ecfa6e842dbbf1922f573f3395a2bf29ca028589"
|
|
856
|
+
},
|
|
857
|
+
{
|
|
858
|
+
"path": "rules/planr-plan/scripts/runtime/packages/design/templates/studio/handoff-center.css",
|
|
859
|
+
"digest": "sha256:2f972f98d16723fd19989df349f6342e6eae951820e53ca84f310b433ef83b48"
|
|
860
|
+
},
|
|
861
|
+
{
|
|
862
|
+
"path": "rules/planr-plan/scripts/runtime/packages/design/templates/studio/handoff-center.js",
|
|
863
|
+
"digest": "sha256:012f648cf3936be649ac5f4935412a91489c8f90e076400dc19fbc6ebbf38b21"
|
|
832
864
|
},
|
|
833
865
|
{
|
|
834
866
|
"path": "rules/planr-plan/scripts/runtime/packages/design/templates/studio/share.css",
|
|
@@ -1011,5 +1043,5 @@
|
|
|
1011
1043
|
"digest": "sha256:6378ad3477e4be8b7e916c4249404c50cafecac1c70ffbf5a1a2fce195dfea16"
|
|
1012
1044
|
}
|
|
1013
1045
|
],
|
|
1014
|
-
"contentDigest": "sha256:
|
|
1046
|
+
"contentDigest": "sha256:caef832e6bcc061db7a2e96e48b425dac0f39b4de84f5c8c699ab3e3c8b8a46e"
|
|
1015
1047
|
}
|