ui-director-skill 2.0.0 → 3.0.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/CHANGELOG.md +25 -0
- package/INSTALL.md +47 -18
- package/README.md +34 -31
- package/SKILL.md +14 -9
- package/assets/bundle-profiles.json +178 -0
- package/assets/capabilities.json +259 -0
- package/assets/install-manifest.json +27 -0
- package/assets/project-profile.example.json +23 -0
- package/assets/routing-rules.json +24 -0
- package/assets/upstreams.json +100 -0
- package/benchmark/README.md +54 -0
- package/benchmark/blind.mjs +141 -0
- package/benchmark/cases.json +66 -0
- package/benchmark/fixtures/reference.html +39 -0
- package/bin/ui.mjs +53 -10
- package/examples/usage.md +19 -50
- package/install.py +304 -0
- package/lib/core.mjs +8 -3
- package/lib/workflows.mjs +151 -29
- package/package.json +8 -3
- package/references/delivery-contract.md +5 -0
- package/references/design-intelligence.md +2 -0
- package/references/integrations/security-policy.md +2 -0
- package/references/integrations/skill-manager.md +5 -0
- package/references/integrations/upstream-adapters.md +25 -0
- package/references/integrations.md +2 -0
- package/references/motion-interaction.md +2 -0
- package/references/orchestration/context-management.md +14 -0
- package/references/orchestration/iteration-loop.md +9 -0
- package/references/orchestration/routing.md +13 -0
- package/references/platforms/desktop.md +3 -0
- package/references/platforms/hmi.md +5 -0
- package/references/platforms/mobile.md +3 -0
- package/references/platforms/web.md +3 -0
- package/references/quality-assurance.md +2 -0
- package/references/routing.md +2 -27
- package/references/stages/design-research.md +2 -0
- package/references/stages/design-system.md +7 -0
- package/references/stages/deslop.md +3 -0
- package/references/stages/motion-interaction.md +31 -0
- package/references/stages/prototyping.md +2 -0
- package/references/stages/ux-strategy.md +10 -0
- package/references/stages/visual-direction.md +13 -0
- package/references/stages/visual-validation.md +25 -0
- package/references/visual-direction.md +2 -0
- package/skill_manager.py +657 -0
- package/templates/DECISIONS.md +2 -3
- package/templates/DESIGN.md +9 -10
- package/templates/PRODUCT.md +5 -4
- package/templates/REVIEW.md +13 -10
- package/config/optional-skills.json +0 -16
- package/config/quality-rubric.json +0 -13
- package/config/workflows.json +0 -15
- package/references/design-workflows.md +0 -21
- package/references/platforms.md +0 -17
- package/references/project-inspection.md +0 -11
- package/references/quality-gates.md +0 -16
- package/references/specialists.md +0 -9
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{
|
|
2
|
+
"market-analysis": {
|
|
3
|
+
"platform": "web",
|
|
4
|
+
"environment": "Chromium, English, light theme, local fixture data",
|
|
5
|
+
"targets": ["1440x900", "390x844"],
|
|
6
|
+
"prompt": "Build a runnable stock research screen for someone who wants to shortlist and compare two companies. Use these fictional sample records: ARB Arbor Labs, Technology, 42.10 USD, +3.2%, 1.4M volume; CDR Cedar Grid, Energy, 18.80 USD, -1.1%, 890K; SES Seaside Systems, Technology, 71.25 USD, +0.8%, 2.1M; RLP Railpoint, Industrials, 31.50 USD, +1.7%, 510K. Support sector filtering, comparing two companies and a simulated data load failure followed by retry. Preserve current selections on retry. Display units and meaningful labels.",
|
|
7
|
+
"captures": {"overview": "1440x900", "comparison": "1440x900", "load-failure": "1440x900", "mobile": "390x844"},
|
|
8
|
+
"checks": ["Filter Technology, select ARB and SES, and compare their prices, returns and volume.", "Simulate a failed load and recover by retrying. The selection and sector filter remain in place.", "Complete the main flow with keyboard navigation and verify readability on the narrow target."]
|
|
9
|
+
},
|
|
10
|
+
"boutique-commerce": {
|
|
11
|
+
"platform": "web",
|
|
12
|
+
"environment": "Chromium, English, light theme, local product data",
|
|
13
|
+
"targets": ["1440x900", "390x844"],
|
|
14
|
+
"prompt": "Build a runnable product page for a small ceramics studio. The Hearth mug costs 38 USD and comes in Sand and Moss (out of stock). The studio fires small batches with a matte glaze and ships within five days. Help a first-time shopper understand the material, shipping and variants, add Sand to a bag, then change quantity or undo removal. Use original or licensed imagery and local product data. Payment is out of scope.",
|
|
15
|
+
"captures": {"product": "1440x900", "unavailable-variant": "1440x900", "bag": "1440x900", "mobile": "390x844"},
|
|
16
|
+
"checks": ["Find material, price and shipping before adding.", "Inspect Moss, understand the availability, then select Sand and add it.", "Edit bag quantity, remove the item, and undo removal on the narrow target."]
|
|
17
|
+
},
|
|
18
|
+
"music-player": {
|
|
19
|
+
"platform": "web",
|
|
20
|
+
"environment": "Chromium, English, local audio fixtures",
|
|
21
|
+
"targets": ["1440x900", "390x844"],
|
|
22
|
+
"prompt": "Build a responsive music player for a three-track 25-second demo collection. Generate or include local audio for Aster / First Light and Kestrel / Between Stations, plus a third track Night Letter with a reproducible unavailable-audio state. Include play, pause, seek, queue navigation, error recovery and motion tied to playback. Keep the title, playback status and queue coherent after switching tracks.",
|
|
23
|
+
"captures": {"playing": "1440x900", "queue": "390x844", "playback-error": "1440x900", "reduced-motion": "390x844"},
|
|
24
|
+
"checks": ["Start playback, seek, pause and resume. Report actual media time.", "Switch tracks rapidly and verify the visible active item and audio stay in sync.", "Recover from the unavailable track and check reduced-motion preferences."]
|
|
25
|
+
},
|
|
26
|
+
"cocos-hmi": {
|
|
27
|
+
"platform": "hmi",
|
|
28
|
+
"environment": "Cocos Creator 3.8.x, English, local deterministic signal replay. Record actual runtime and device or simulator.",
|
|
29
|
+
"targets": ["1920x720", "1280x480"],
|
|
30
|
+
"prompt": "Build a Cocos Creator 3.8.x automotive display prototype for an approved demo environment. Present speed in km/h, gear and battery state, and expose a secondary trip summary. Replay a provided sequence in code: connect at 0 km/h / P / 61%, drive at 52 km/h / D / 60%, stop receiving values long enough to indicate stale data, then reconnect at 48 km/h / D / 60%. Include day/night styles and retain the primary state while navigating the trip summary.",
|
|
31
|
+
"captures": {"day-driving": "1920x720", "night-driving": "1920x720", "stale": "1280x480", "reconnected": "1280x480"},
|
|
32
|
+
"checks": ["Read speed, gear, units and remaining battery at both target dimensions.", "Open the trip summary, surface stale data and recover on reconnect while maintaining context.", "Exercise the available input route and capture frame timing in the target runtime."]
|
|
33
|
+
},
|
|
34
|
+
"knowledge-workspace": {
|
|
35
|
+
"platform": "web",
|
|
36
|
+
"environment": "Chromium, English, local fixture data, clean storage before each run",
|
|
37
|
+
"targets": ["1440x900", "390x844"],
|
|
38
|
+
"prompt": "Build a reading workspace for a researcher who needs to find, read and save notes without losing their place. Seed three notes: Render pipeline review (graphics), Interview follow-up (research), and Release readiness (delivery). Support tag filtering, full-text search, opening a note, marking it saved and returning to the filtered list. Include a no-results state with a recovery action.",
|
|
39
|
+
"captures": {"library": "1440x900", "reader": "1440x900", "no-results": "1440x900", "mobile": "390x844"},
|
|
40
|
+
"checks": ["Filter graphics and open Render pipeline review. Save it and return without losing the filter.", "Search for an absent term and recover from the empty state.", "Repeat the flow with keyboard and on the narrow target."]
|
|
41
|
+
},
|
|
42
|
+
"mobile-notification-preferences": {
|
|
43
|
+
"platform": "mobile",
|
|
44
|
+
"environment": "Native Android app on an Android emulator or device, English, light theme, deterministic local settings. Use the same runtime, density and text scale across all groups.",
|
|
45
|
+
"targets": ["1080x2400"],
|
|
46
|
+
"prompt": "Build a runnable native Android notification preferences flow. Product updates starts off, Account alerts is enabled and read-only, and Weekly summary starts on. Stage local edits and expose one Save action. Make the first save fail on demand, allow retry with edits retained, and preserve saved values when reopening. Use the supplied project settings components and design tokens when available.",
|
|
47
|
+
"captures": {"initial": "1080x2400", "pending": "1080x2400", "failed": "1080x2400", "saved": "1080x2400"},
|
|
48
|
+
"checks": ["Change Product updates and Weekly summary by touch and explain the read-only Account alerts state.", "Trigger save failure, retry with edits preserved, and confirm feedback.", "Reopen preferences and verify the saved values and actionable state."]
|
|
49
|
+
},
|
|
50
|
+
"desktop-download-queue": {
|
|
51
|
+
"platform": "desktop",
|
|
52
|
+
"environment": "Native desktop app, English, local fixture data. Use the same OS, input devices and app-window capture density across all groups.",
|
|
53
|
+
"targets": ["1280x800", "960x640"],
|
|
54
|
+
"prompt": "Build a runnable desktop download queue for Plan.pdf (complete), Voice.m4a (paused at 40%), and Archive.zip (failed). Let the user find failed downloads, inspect a reason, retry Archive.zip, and return to the filtered queue. Keep keyboard focus and current selection when resizing. Use the supplied project components and design tokens when available.",
|
|
55
|
+
"captures": {"queue": "1280x800", "error-detail": "1280x800", "retried": "1280x800", "narrow-window": "960x640"},
|
|
56
|
+
"checks": ["Filter failed downloads using keyboard or mouse, inspect Archive.zip and explain the available action.", "Retry Archive.zip and verify the resulting state and focus.", "Resize the app window and verify the filter, relevant selection and usable layout."]
|
|
57
|
+
},
|
|
58
|
+
"reference-match": {
|
|
59
|
+
"platform": "web",
|
|
60
|
+
"environment": "Chromium, English, light theme. Give every run the same screenshot from fixtures/reference.html at the desktop target.",
|
|
61
|
+
"targets": ["1440x900", "390x844"],
|
|
62
|
+
"prompt": "Build the original article index shown in the supplied desktop screenshot. Match the type hierarchy, alignment, column proportions, neutral surfaces and rules. Keep the article list readable at the narrow target and make the filter tabs change the visible rows. Use only the visible labels and data in the supplied reference. Define the small-screen layout based on reading order.",
|
|
63
|
+
"captures": {"desktop-match": "1440x900", "filtered-list": "1440x900", "mobile": "390x844"},
|
|
64
|
+
"checks": ["Compare at the exact reference viewport and report mismatches in alignment, typography and spacing.", "Select a category tab and verify the visible rows change.", "Verify keyboard access and reading order at the narrow target."]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<meta charset="utf-8">
|
|
4
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
5
|
+
<title>Field Notes · Journal</title>
|
|
6
|
+
<style>
|
|
7
|
+
* { box-sizing: border-box; }
|
|
8
|
+
body { margin: 0; background: #faf9f5; color: #22231e; font: 16px/1.5 Arial, sans-serif; }
|
|
9
|
+
header, main { max-width: 1152px; width: calc(100% - 64px); margin: auto; }
|
|
10
|
+
header { display: flex; align-items: center; justify-content: space-between; padding: 26px 0; border-bottom: 1px solid #c6c6bb; }
|
|
11
|
+
.eyebrow, .meta { font-size: 12px; letter-spacing: 0.13em; text-transform: uppercase; }
|
|
12
|
+
.intro { display: grid; grid-template-columns: 3fr 2fr; align-items: end; gap: 36px; padding: 72px 0 56px; }
|
|
13
|
+
h1, h2 { font-family: Georgia, serif; font-weight: normal; margin: 0; line-height: 1.04; }
|
|
14
|
+
h1 { font-size: clamp(56px, 9vw, 126px); letter-spacing: -0.075em; }
|
|
15
|
+
h2 { font-size: clamp(27px, 3.2vw, 46px); letter-spacing: -0.035em; }
|
|
16
|
+
.intro p { margin: 0 0 10px; font: 22px/1.4 Georgia, serif; max-width: 18em; }
|
|
17
|
+
.tabs { display: flex; gap: 26px; align-items: center; border-bottom: 1px solid #22231e; padding-bottom: 13px; }
|
|
18
|
+
.active { font-weight: bold; }
|
|
19
|
+
article { display: grid; grid-template-columns: minmax(90px, 1fr) 4fr 2fr; align-items: center; gap: 24px; min-height: 130px; border-bottom: 1px solid #c6c6bb; }
|
|
20
|
+
article p { margin: 0; color: #4c5143; }
|
|
21
|
+
@media (max-width: 660px) {
|
|
22
|
+
header, main { width: calc(100% - 40px); }
|
|
23
|
+
.intro, article { grid-template-columns: 1fr; gap: 8px; }
|
|
24
|
+
.intro { padding-block: 48px 28px; }
|
|
25
|
+
article { padding-block: 20px; }
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
28
|
+
<header><strong>Field Notes</strong><span class="eyebrow">Independent Journal</span></header>
|
|
29
|
+
<main>
|
|
30
|
+
<section class="intro">
|
|
31
|
+
<div><div class="eyebrow">Volume 01 / Index</div><h1>The Journal</h1></div>
|
|
32
|
+
<p>Writing on how places change, who shapes them, and what we learn from looking closely.</p>
|
|
33
|
+
</section>
|
|
34
|
+
<div class="tabs"><span class="active">All entries</span><span>Places</span><span>Practice</span></div>
|
|
35
|
+
<article><div class="meta">01 / Places</div><h2>Along the Tidal Line</h2><p>How a harbor marks the passage of time.</p></article>
|
|
36
|
+
<article><div class="meta">02 / Practice</div><h2>The Useful Sketch</h2><p>Drawing as a way to notice.</p></article>
|
|
37
|
+
<article><div class="meta">03 / Places</div><h2>A Garden in Winter</h2><p>Reading a landscape after the leaves fall.</p></article>
|
|
38
|
+
</main>
|
|
39
|
+
</html>
|
package/bin/ui.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
2
3
|
import { existsSync } from 'node:fs';
|
|
3
4
|
import { resolve } from 'node:path';
|
|
4
5
|
import {
|
|
@@ -11,7 +12,9 @@ import {
|
|
|
11
12
|
installProvider,
|
|
12
13
|
loadLock,
|
|
13
14
|
lockExists,
|
|
15
|
+
missingSkillFiles,
|
|
14
16
|
packageVersion,
|
|
17
|
+
packageRoot,
|
|
15
18
|
providerDir,
|
|
16
19
|
providersConfig,
|
|
17
20
|
resolveCapability,
|
|
@@ -40,9 +43,17 @@ Usage: ui [command] [arguments]
|
|
|
40
43
|
ui init Install the skill and restore managed providers
|
|
41
44
|
ui init --local Install the skill using built-in guidance
|
|
42
45
|
ui upgrade Back up and refresh the project skill
|
|
46
|
+
ui skill install|upgrade Install or upgrade a host skill with backup
|
|
47
|
+
ui bundle Preview or install companion skill profiles
|
|
48
|
+
ui companions status Inspect managed companion skills
|
|
49
|
+
ui companions check-updates Check pinned upstream commits
|
|
50
|
+
ui companions update Update managed companion skills
|
|
51
|
+
ui companions rollback Restore the previous companion transaction
|
|
52
|
+
ui companions recover Recover an interrupted companion transaction
|
|
43
53
|
ui doctor Check the installation and any managed providers
|
|
44
54
|
ui route "<request>" Preview intent, platform, deliverable and mode
|
|
45
55
|
Options: --intent, --platform, --deliverable, --mode
|
|
56
|
+
Modes: quick, standard, high-fidelity
|
|
46
57
|
ui design-init Create missing design documents and project profile
|
|
47
58
|
ui migrate Draft DESIGN.md for an existing MASTER.md
|
|
48
59
|
Both accept --platform and --dry-run
|
|
@@ -57,9 +68,20 @@ Usage: ui [command] [arguments]
|
|
|
57
68
|
ui --help Show this help
|
|
58
69
|
|
|
59
70
|
Managed providers: ui-ux-pro-max, jakub-skills, design-system, impeccable
|
|
71
|
+
Host skill commands require Python 3.9+. Companion management also requires Git.
|
|
60
72
|
`);
|
|
61
73
|
}
|
|
62
74
|
|
|
75
|
+
function runInstaller(installerArgs) {
|
|
76
|
+
const command = process.platform === 'win32' ? 'py' : 'python3';
|
|
77
|
+
const prefix = process.platform === 'win32' ? ['-3'] : [];
|
|
78
|
+
const result = spawnSync(command, [...prefix, '-B', resolve(packageRoot, 'install.py'), ...installerArgs], {
|
|
79
|
+
stdio: 'inherit',
|
|
80
|
+
});
|
|
81
|
+
if (result.error) throw new Error(`Python 3.9+ is required for this command: ${result.error.message}`);
|
|
82
|
+
process.exitCode = result.status ?? 1;
|
|
83
|
+
}
|
|
84
|
+
|
|
63
85
|
function readOptions(tokens, labels, flags = []) {
|
|
64
86
|
const options = {};
|
|
65
87
|
for (let i = 0; i < tokens.length; i++) {
|
|
@@ -103,9 +125,30 @@ async function main() {
|
|
|
103
125
|
if (cmd === '--help' || cmd === '-h' || cmd === 'help') return help();
|
|
104
126
|
if (cmd === '--version' || cmd === '-v' || cmd === 'version') return console.log(VERSION);
|
|
105
127
|
|
|
128
|
+
if (cmd === 'skill') {
|
|
129
|
+
const action = args[1];
|
|
130
|
+
const allowed = new Set(['install', 'upgrade', 'doctor', 'check-upstreams']);
|
|
131
|
+
if (!allowed.has(action)) throw new Error("Usage: ui skill <install|upgrade|doctor|check-upstreams> [options]");
|
|
132
|
+
return runInstaller([action, ...args.slice(2)]);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (cmd === 'bundle') return runInstaller(['bundle', ...args.slice(1)]);
|
|
136
|
+
|
|
137
|
+
if (cmd === 'companions') {
|
|
138
|
+
const action = new Map([
|
|
139
|
+
['status', 'status'],
|
|
140
|
+
['check-updates', 'check-updates'],
|
|
141
|
+
['update', 'update-upstreams'],
|
|
142
|
+
['rollback', 'rollback-upstreams'],
|
|
143
|
+
['recover', 'recover-upstreams'],
|
|
144
|
+
]).get(args[1]);
|
|
145
|
+
if (!action) throw new Error("Usage: ui companions <status|check-updates|update|rollback|recover> [options]");
|
|
146
|
+
return runInstaller([action, ...args.slice(2)]);
|
|
147
|
+
}
|
|
148
|
+
|
|
106
149
|
if (cmd === 'route') {
|
|
107
150
|
const options = readOptions(args.slice(2), ['--intent', '--platform', '--deliverable', '--mode']);
|
|
108
|
-
console.log(JSON.stringify(previewRoute(target ?? '', options), null, 2));
|
|
151
|
+
console.log(JSON.stringify(previewRoute(target ?? '', { ...options, root }), null, 2));
|
|
109
152
|
return;
|
|
110
153
|
}
|
|
111
154
|
|
|
@@ -199,15 +242,15 @@ async function main() {
|
|
|
199
242
|
console.log('· Built-in guidance (no managed providers configured)');
|
|
200
243
|
}
|
|
201
244
|
|
|
202
|
-
const
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
245
|
+
const projectTargets = directorSkillTargets(root);
|
|
246
|
+
const installedTargets = projectTargets.filter((target) => existsSync(target));
|
|
247
|
+
for (const target of (installedTargets.length ? installedTargets : projectTargets)) {
|
|
248
|
+
const missing = missingSkillFiles(target);
|
|
249
|
+
console.log(`${missing.length ? '✗' : '✓'} ${target}`);
|
|
250
|
+
if (missing.length) {
|
|
251
|
+
console.log(` - missing ${missing.join(', ')}`);
|
|
252
|
+
errors.push(`skill installation is incomplete: ${target}`);
|
|
253
|
+
}
|
|
211
254
|
}
|
|
212
255
|
|
|
213
256
|
if (errors.length) {
|
package/examples/usage.md
CHANGED
|
@@ -1,68 +1,37 @@
|
|
|
1
|
-
# Usage
|
|
1
|
+
# Usage examples
|
|
2
2
|
|
|
3
|
-
## Existing
|
|
3
|
+
## Existing workflow
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
> Use ui-director to improve the reporting filters in our existing admin console. Users should return from a report with the same filters applied. Reuse the data table and existing components. Exercise the retry path and keyboard navigation in the browser.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
Use ui-director to add an AI agent management page to the existing admin console.
|
|
9
|
-
```
|
|
7
|
+
Use Standard. Inspect the existing flow, locate its state owner, define the return and retry behavior, implement the changes and recheck the observed states.
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
## Original flagship page
|
|
12
10
|
|
|
13
|
-
|
|
14
|
-
NEW_SCREEN / STANDARD / implementation
|
|
11
|
+
> Use ui-director to design a High Fidelity home page for an independent ceramics studio. Explore compositions and typography that convey the feel of the pieces, choose a direction, then render the result at desktop and mobile sizes.
|
|
15
12
|
|
|
16
|
-
|
|
17
|
-
```
|
|
13
|
+
Explore materially distinct directions before implementation. Compare them against the brief, site content and purchase path.
|
|
18
14
|
|
|
19
|
-
|
|
15
|
+
## Small fix
|
|
20
16
|
|
|
21
|
-
|
|
17
|
+
> Use ui-director to make a Quick fix to keyboard focus when closing the existing settings dialog.
|
|
22
18
|
|
|
23
|
-
|
|
19
|
+
Check the current focus order and restoration, make the smallest change and exercise the affected input path.
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
Use ui-director to create a professional quantitative trading dashboard from scratch. The visual direction is not defined yet.
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Expected route:
|
|
30
|
-
|
|
31
|
-
```text
|
|
32
|
-
NEW_SCREEN / CRAFT / implementation
|
|
33
|
-
|
|
34
|
-
research → system → visual → prototype → qa
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
## Small accessibility fix
|
|
38
|
-
|
|
39
|
-
Prompt:
|
|
40
|
-
|
|
41
|
-
```text
|
|
42
|
-
Use ui-director to fix keyboard navigation and focus behavior in this settings form.
|
|
43
|
-
```
|
|
21
|
+
## Read-only review
|
|
44
22
|
|
|
45
|
-
|
|
23
|
+
> Use ui-director to audit the desktop settings flow. Report findings with screenshots or reproduction steps. Leave product source untouched.
|
|
46
24
|
|
|
47
|
-
|
|
48
|
-
FAST / implementation
|
|
25
|
+
Record gate statuses and important experience and visual findings. State which checks required a missing desktop runtime.
|
|
49
26
|
|
|
50
|
-
|
|
51
|
-
```
|
|
27
|
+
## Reference matching
|
|
52
28
|
|
|
53
|
-
|
|
29
|
+
> Use ui-director to match the supplied screenshot for just the existing account header. Keep the rest of the screen scoped out and use Quick depth.
|
|
54
30
|
|
|
55
|
-
|
|
56
|
-
Use ui-director to audit the desktop settings flow. Report findings with screenshots
|
|
57
|
-
or reproduction steps. Leave product source untouched.
|
|
58
|
-
```
|
|
31
|
+
Match the requested properties and verify the header in the same rendered state.
|
|
59
32
|
|
|
60
|
-
|
|
33
|
+
## Cocos HMI
|
|
61
34
|
|
|
62
|
-
|
|
35
|
+
> Use ui-director to update the Cocos Creator trip summary. Keep speed visible, preserve the current scene and approved tokens, and exercise stale-signal and reconnect flows on the target build.
|
|
63
36
|
|
|
64
|
-
|
|
65
|
-
Use ui-director in REFERENCE mode to implement a new account screen using the supplied
|
|
66
|
-
reference for hierarchy and density. Use approved product tokens. Compare the same
|
|
67
|
-
viewport and states after rendering.
|
|
68
|
-
```
|
|
37
|
+
Check the runtime Canvas scale and input paths using the project dimensions and signal replay.
|
package/install.py
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""UI Director host installation, migration and diagnostics (stdlib only)."""
|
|
3
|
+
import argparse
|
|
4
|
+
import hashlib
|
|
5
|
+
import json
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
import re
|
|
8
|
+
import shutil
|
|
9
|
+
import stat
|
|
10
|
+
import sys
|
|
11
|
+
import tempfile
|
|
12
|
+
import subprocess
|
|
13
|
+
import skill_manager as manager
|
|
14
|
+
from datetime import datetime, timezone
|
|
15
|
+
|
|
16
|
+
BASE = Path(__file__).resolve().parent
|
|
17
|
+
SOURCE = BASE
|
|
18
|
+
NAME = 'ui-director'
|
|
19
|
+
VERSION = json.loads((BASE/'package.json').read_text(encoding='utf-8'))['version']
|
|
20
|
+
|
|
21
|
+
def load(name):
|
|
22
|
+
return json.loads((SOURCE/'assets'/name).read_text(encoding='utf-8'))
|
|
23
|
+
|
|
24
|
+
RULES = load('routing-rules.json')
|
|
25
|
+
MANIFEST = load('install-manifest.json')
|
|
26
|
+
AGENTS = ['all','codex','claude','opencode','hermes']
|
|
27
|
+
|
|
28
|
+
def locations(root, agent, scope):
|
|
29
|
+
home=Path.home()
|
|
30
|
+
if scope=='project':
|
|
31
|
+
paths={a:root/'.agents'/'skills'/NAME for a in ['codex','opencode','hermes']}
|
|
32
|
+
paths['claude']=root/'.claude'/'skills'/NAME
|
|
33
|
+
else:
|
|
34
|
+
paths={'codex':home/'.agents'/'skills'/NAME,'claude':home/'.claude'/'skills'/NAME,'opencode':home/'.config'/'opencode'/'skills'/NAME,'hermes':home/'.hermes'/'skills'/NAME}
|
|
35
|
+
return list(dict.fromkeys(paths.values())) if agent=='all' else [paths[agent]]
|
|
36
|
+
|
|
37
|
+
def copy_payload(src, dest):
|
|
38
|
+
if dest.is_symlink():
|
|
39
|
+
raise ValueError(f'Unsafe file destination: {dest}')
|
|
40
|
+
if src.is_dir():
|
|
41
|
+
dest.mkdir(exist_ok=True)
|
|
42
|
+
dest.chmod(dest.stat().st_mode | stat.S_IWUSR)
|
|
43
|
+
for child in src.iterdir():
|
|
44
|
+
copy_payload(child, dest/child.name)
|
|
45
|
+
else:
|
|
46
|
+
if dest.exists():
|
|
47
|
+
if not dest.is_file():
|
|
48
|
+
raise ValueError(f'Unsafe file destination: {dest}')
|
|
49
|
+
# Only the staging copy is changed. The live copy keeps its permissions.
|
|
50
|
+
dest.chmod(dest.stat().st_mode | stat.S_IWUSR)
|
|
51
|
+
dest.unlink()
|
|
52
|
+
shutil.copy2(src, dest)
|
|
53
|
+
|
|
54
|
+
def validate_destination(dst):
|
|
55
|
+
if dst.resolve() != dst or (dst.exists() and not dst.is_dir()):
|
|
56
|
+
raise ValueError(f'Refusing to replace unexpected path: {dst}')
|
|
57
|
+
if dst == SOURCE:
|
|
58
|
+
raise ValueError('Refusing to replace source package')
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def resume_host_upgrade(dst, journal):
|
|
62
|
+
if journal.is_symlink() or (journal.exists() and not journal.is_file()):
|
|
63
|
+
raise ValueError(f'Unsafe upgrade journal: {journal}')
|
|
64
|
+
if not journal.exists():
|
|
65
|
+
return
|
|
66
|
+
data = json.loads(journal.read_text(encoding='utf-8'))
|
|
67
|
+
if not isinstance(data, dict):
|
|
68
|
+
raise ValueError(f'Invalid upgrade journal: {journal}')
|
|
69
|
+
backup_name, stage_name = data.get('backup'), data.get('stage')
|
|
70
|
+
if (not isinstance(backup_name, str) or not backup_name.startswith(NAME+'-')
|
|
71
|
+
or not manager.STAMP.fullmatch(backup_name[len(NAME)+1:])
|
|
72
|
+
or not isinstance(stage_name, str) or not re.fullmatch(r'\.stage-[\w-]+', stage_name)):
|
|
73
|
+
raise ValueError(f'Invalid upgrade journal: {journal}')
|
|
74
|
+
backup, staging = journal.parent/backup_name, journal.parent/stage_name
|
|
75
|
+
if backup.resolve() != backup or staging.resolve() != staging:
|
|
76
|
+
raise ValueError(f'Unsafe path in upgrade journal: {journal}')
|
|
77
|
+
if backup.exists() and not dst.exists():
|
|
78
|
+
if manager.skill_name(backup) != NAME:
|
|
79
|
+
raise ValueError(f'Invalid upgrade backup: {backup}')
|
|
80
|
+
backup.rename(dst)
|
|
81
|
+
print(f'RESTORED {dst}')
|
|
82
|
+
elif not dst.exists() or (backup.exists() and (staging/NAME).exists()):
|
|
83
|
+
raise ValueError(f'Cannot resume upgrade automatically. Inspect {journal}')
|
|
84
|
+
journal.unlink()
|
|
85
|
+
shutil.rmtree(staging, ignore_errors=True)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def install_host(dst, args):
|
|
89
|
+
validate_destination(dst)
|
|
90
|
+
backup_root = dst.parent.parent/'ui-director-backups'
|
|
91
|
+
if backup_root.resolve() != backup_root:
|
|
92
|
+
raise ValueError(f'Unsafe backup directory: {backup_root}')
|
|
93
|
+
journal = backup_root/'pending-upgrade.json'
|
|
94
|
+
if args.dry_run:
|
|
95
|
+
if journal.exists():
|
|
96
|
+
print(f'WOULD RECOVER interrupted upgrade at {dst}')
|
|
97
|
+
elif dst.exists() and not args.force and args.cmd != 'upgrade':
|
|
98
|
+
print(f'SKIP {dst}; use upgrade to back up and replace')
|
|
99
|
+
else:
|
|
100
|
+
print(f'WOULD {"BACK UP AND REPLACE" if dst.exists() else "INSTALL"} {dst}')
|
|
101
|
+
return
|
|
102
|
+
|
|
103
|
+
backup_root.mkdir(parents=True, exist_ok=True)
|
|
104
|
+
with manager.process_lock(backup_root/'upgrade.lock'):
|
|
105
|
+
validate_destination(dst)
|
|
106
|
+
resume_host_upgrade(dst, journal)
|
|
107
|
+
if dst.exists() and manager.skill_name(dst) != NAME:
|
|
108
|
+
raise ValueError(f'Not a UI Director installation: {dst}')
|
|
109
|
+
if dst.exists() and not args.force and args.cmd != 'upgrade':
|
|
110
|
+
print(f'SKIP {dst}; use upgrade to back up and replace')
|
|
111
|
+
return
|
|
112
|
+
dst.parent.mkdir(parents=True, exist_ok=True)
|
|
113
|
+
with tempfile.TemporaryDirectory(prefix='.stage-', dir=backup_root) as tmp:
|
|
114
|
+
stage = Path(tmp)
|
|
115
|
+
staged = stage/NAME
|
|
116
|
+
if dst.exists():
|
|
117
|
+
shutil.copytree(dst, staged, symlinks=True)
|
|
118
|
+
else:
|
|
119
|
+
staged.mkdir()
|
|
120
|
+
staged.chmod(staged.stat().st_mode | stat.S_IWUSR)
|
|
121
|
+
for item in MANIFEST['paths']:
|
|
122
|
+
copy_payload(SOURCE/item, staged/item)
|
|
123
|
+
|
|
124
|
+
backup = None
|
|
125
|
+
if dst.exists():
|
|
126
|
+
stamp = datetime.now(timezone.utc).strftime(manager.STAMP_FORMAT)
|
|
127
|
+
backup = backup_root/f'{NAME}-{stamp}'
|
|
128
|
+
manager.atomic_json(journal, {'backup': backup.name, 'stage': stage.name})
|
|
129
|
+
try:
|
|
130
|
+
if backup:
|
|
131
|
+
dst.rename(backup)
|
|
132
|
+
staged.rename(dst)
|
|
133
|
+
except BaseException:
|
|
134
|
+
if backup and backup.is_dir() and not dst.exists():
|
|
135
|
+
backup.rename(dst)
|
|
136
|
+
raise
|
|
137
|
+
if backup:
|
|
138
|
+
journal.unlink()
|
|
139
|
+
print(f'BACKUP {backup}')
|
|
140
|
+
print(f'INSTALLED {VERSION} {dst}')
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
def install(args):
|
|
144
|
+
targets = locations(Path(args.path).resolve(), args.agent, args.scope)
|
|
145
|
+
if args.scope == 'global':
|
|
146
|
+
# Users can keep their host configuration in a linked dotfiles directory.
|
|
147
|
+
# Resolve its parent only so a symlink for the skill itself is still rejected.
|
|
148
|
+
targets = list(dict.fromkeys(path.parent.resolve()/path.name for path in targets))
|
|
149
|
+
for dst in targets:
|
|
150
|
+
install_host(dst, args)
|
|
151
|
+
print('Optional upstreams are not installed or updated. Restart/reload the host as needed.')
|
|
152
|
+
return 0
|
|
153
|
+
|
|
154
|
+
def roots(root):
|
|
155
|
+
project=[root/'.agents'/'skills',root/'.claude'/'skills',root/'.opencode'/'skills',root/'.hermes'/'skills']
|
|
156
|
+
user=[p.parent for p in locations(root,'all','global')]
|
|
157
|
+
return list(dict.fromkeys(project+user))
|
|
158
|
+
|
|
159
|
+
def scan(root):
|
|
160
|
+
results=[]
|
|
161
|
+
candidates=[]
|
|
162
|
+
for parent in roots(root):
|
|
163
|
+
if not parent.is_dir():continue
|
|
164
|
+
for path in sorted(parent.glob('*/SKILL.md')):
|
|
165
|
+
try:
|
|
166
|
+
data=path.read_bytes();t=data.decode('utf-8-sig')
|
|
167
|
+
header=t.split('---',2)[1] if t.startswith('---') and t.count('---')>=2 else ''
|
|
168
|
+
name=re.search(r'^name:\s*[\"\']?([\w-]+)',header,re.M)
|
|
169
|
+
version=re.search(r'^version:\s*([^\n]+)',header,re.M)
|
|
170
|
+
if name:candidates.append((name.group(1),path,version.group(1).strip() if version else None,hashlib.sha256(data).hexdigest()))
|
|
171
|
+
except (OSError,UnicodeError):continue
|
|
172
|
+
for e in load('capabilities.json'):
|
|
173
|
+
matches=[dict(name=n,path=str(p),version=v,sha256=h) for n,p,v,h in candidates if n in e['aliases']]
|
|
174
|
+
results.append(dict(id=e['id'],source=e['source'],status='CANDIDATE' if matches else 'NOT FOUND',matches=matches))
|
|
175
|
+
return results
|
|
176
|
+
|
|
177
|
+
def check_upstreams(args):
|
|
178
|
+
print(json.dumps({'scope':'local metadata only; provenance and runtime activation not verified','providers':scan(Path(args.path).resolve())},ensure_ascii=False,indent=2));return 0
|
|
179
|
+
|
|
180
|
+
def doctor(args):
|
|
181
|
+
root = Path(args.path).resolve()
|
|
182
|
+
def missing_files(path):
|
|
183
|
+
return [name for name in MANIFEST['required']
|
|
184
|
+
if not (path/name).is_file() or (path/name).is_symlink()]
|
|
185
|
+
|
|
186
|
+
if args.scope:
|
|
187
|
+
targets = locations(root, args.agent, args.scope)
|
|
188
|
+
else:
|
|
189
|
+
candidates = [p/NAME for p in roots(root)] if args.agent == 'all' else [
|
|
190
|
+
path for scope in ('project', 'global') for path in locations(root, args.agent, scope)
|
|
191
|
+
]
|
|
192
|
+
targets = [path for path in candidates if path.exists() or path.is_symlink()]
|
|
193
|
+
installs = [{'path': str(path), 'missing': missing_files(path)} for path in targets]
|
|
194
|
+
missing = missing_files(SOURCE)
|
|
195
|
+
print(json.dumps({
|
|
196
|
+
'version': VERSION,
|
|
197
|
+
'local_installs': [entry['path'] for entry in installs if Path(entry['path']).is_dir()],
|
|
198
|
+
'installations': installs,
|
|
199
|
+
'missing_package_files': missing,
|
|
200
|
+
'upstreams': scan(root),
|
|
201
|
+
'managed_companions': [{'root': str(p), 'skills': manager.status(p)}
|
|
202
|
+
for p in roots(root) if (manager.state_dir(p)/'lock.json').is_file()],
|
|
203
|
+
'note': 'local scan only, not runtime verification',
|
|
204
|
+
}, ensure_ascii=False, indent=2))
|
|
205
|
+
return int(bool(missing or not installs or any(entry['missing'] for entry in installs)))
|
|
206
|
+
|
|
207
|
+
def create(path,content,dry):
|
|
208
|
+
if path.exists() or path.is_symlink():print(f'SKIP {path}');return
|
|
209
|
+
if dry:print(f'WOULD CREATE {path}');return
|
|
210
|
+
path.parent.mkdir(parents=True,exist_ok=True)
|
|
211
|
+
with path.open('x',encoding='utf-8') as f:f.write(content)
|
|
212
|
+
print(f'CREATED {path}')
|
|
213
|
+
|
|
214
|
+
def init(args):
|
|
215
|
+
root=Path(args.path).resolve();legacy=root/'design-system'/'MASTER.md'
|
|
216
|
+
profile=load('project-profile.example.json');profile.update(project=root.name,platform=args.platform)
|
|
217
|
+
if legacy.is_file():profile['design_system']='design-system/MASTER.md';profile['migration_status']='legacy-authoritative-until-reviewed'
|
|
218
|
+
create(root/'.ui-director'/'project.json',json.dumps(profile,ensure_ascii=False,indent=2)+'\n',args.dry_run)
|
|
219
|
+
for name,target in [('PRODUCT.md','PRODUCT.md'),('DESIGN.md','DESIGN.md'),('DECISIONS.md','design-system/DECISIONS.md')]:
|
|
220
|
+
content=(SOURCE/'templates'/name).read_text(encoding='utf-8')
|
|
221
|
+
if name=='DESIGN.md' and legacy.is_file():content+='\n## Legacy migration\nDraft only. Read `design-system/MASTER.md`; reconcile approved values before adopting this file.\n'
|
|
222
|
+
create(root/target,content,args.dry_run)
|
|
223
|
+
return 0
|
|
224
|
+
|
|
225
|
+
def migrate(args):
|
|
226
|
+
root=Path(args.path).resolve();legacy=root/'design-system'/'MASTER.md';profile=root/'.ui-director'/'project.json'
|
|
227
|
+
if not legacy.is_file():print('No legacy MASTER.md; use init for a new project.');return 0
|
|
228
|
+
# No destructive conversion; archive content stays in place and is referenced.
|
|
229
|
+
if (root/'DESIGN.md').exists():print('Existing DESIGN.md retained; review conflicts manually.')
|
|
230
|
+
if profile.is_file():
|
|
231
|
+
old=json.loads(profile.read_text(encoding='utf-8'))
|
|
232
|
+
platform=old.get('platform','other')
|
|
233
|
+
if platform not in RULES['platforms']:platform='other'
|
|
234
|
+
args.platform=platform
|
|
235
|
+
init(args)
|
|
236
|
+
print('Legacy MASTER.md and existing project config untouched. After reviewing DESIGN.md, manually update project.json design_system to DESIGN.md and schema_version to 2.')
|
|
237
|
+
return 0
|
|
238
|
+
|
|
239
|
+
def preview(task, platform='auto', deliverable='auto', mode='auto', intent='auto'):
|
|
240
|
+
command = ['node', str(BASE/'bin/ui.mjs'), 'route', task]
|
|
241
|
+
options = {'platform': platform, 'deliverable': deliverable, 'mode': mode, 'intent': intent}
|
|
242
|
+
for key, value in options.items():
|
|
243
|
+
if value != 'auto':
|
|
244
|
+
command.extend(['--'+key, value])
|
|
245
|
+
result = subprocess.run(command, capture_output=True, text=True, encoding='utf-8')
|
|
246
|
+
if result.returncode:
|
|
247
|
+
raise ValueError(result.stderr.strip())
|
|
248
|
+
route = json.loads(result.stdout)
|
|
249
|
+
route['provider_hint'] = 'core'
|
|
250
|
+
route['max_repair_rounds'] = route.pop('maxRepairRounds')
|
|
251
|
+
route['source_writes_allowed'] = route.pop('sourceWritesAllowed')
|
|
252
|
+
route['product_source_writes_allowed'] = route.pop('productSourceWritesAllowed')
|
|
253
|
+
return route
|
|
254
|
+
|
|
255
|
+
def route(args):
|
|
256
|
+
result = preview(args.task, args.platform, args.deliverable, args.mode, args.intent)
|
|
257
|
+
print(json.dumps(result, ensure_ascii=False, indent=2))
|
|
258
|
+
return 0
|
|
259
|
+
|
|
260
|
+
def validate(args):
|
|
261
|
+
path=Path(args.file);t=path.read_text(encoding='utf-8-sig');warnings=[]
|
|
262
|
+
if t.startswith('---\n') and '\n---\n' not in t[4:]:warnings.append('Unclosed YAML front matter')
|
|
263
|
+
for heading in ['Overview','Colors','Typography','Layout','Components']:
|
|
264
|
+
if not re.search(r'^#+\s+'+heading+r'\b',t,re.M|re.I):warnings.append(f'Expected section not found: {heading}')
|
|
265
|
+
if 'TODO' in t or 'Draft' in t:warnings.append('Draft / placeholders remain; approval needed')
|
|
266
|
+
print(json.dumps({'file':str(path),'structural_warnings':warnings,'status':'REVIEW NEEDED' if warnings else 'STRUCTURAL CHECK ONLY','note':'Not a YAML parser or official DESIGN.md schema validator; use official linter separately.'},ensure_ascii=False,indent=2));return int(bool(warnings))
|
|
267
|
+
|
|
268
|
+
def main():
|
|
269
|
+
pa=argparse.ArgumentParser(description='UI Director '+VERSION);pa.add_argument('--version',action='version',version=VERSION);sub=pa.add_subparsers(dest='cmd',required=True)
|
|
270
|
+
for cmd in ['install','upgrade']:
|
|
271
|
+
p=sub.add_parser(cmd);p.add_argument('--agent',choices=AGENTS,default='all');p.add_argument('--scope',choices=['project','global'],default='project');p.add_argument('--path',default='.');p.add_argument('--force',action='store_true');p.add_argument('--dry-run',action='store_true');p.set_defaults(run=install)
|
|
272
|
+
for cmd,fn in [('doctor',doctor),('check-upstreams',check_upstreams),('init',init),('migrate',migrate)]:
|
|
273
|
+
p=sub.add_parser(cmd);p.add_argument('--path',default='.')
|
|
274
|
+
if cmd=='doctor':
|
|
275
|
+
p.add_argument('--scope',choices=['project','global'])
|
|
276
|
+
p.add_argument('--agent',choices=AGENTS,default='all')
|
|
277
|
+
if cmd in ['init','migrate']:p.add_argument('--platform',choices=RULES['platforms'],default='web');p.add_argument('--dry-run',action='store_true')
|
|
278
|
+
p.set_defaults(run=fn)
|
|
279
|
+
p=sub.add_parser('route')
|
|
280
|
+
p.add_argument('task')
|
|
281
|
+
p.add_argument('--platform',choices=['auto']+RULES['platforms'],default='auto')
|
|
282
|
+
p.add_argument('--intent',default='auto',help='One of '+', '.join(RULES['workflows']))
|
|
283
|
+
p.add_argument('--deliverable',choices=['auto']+RULES['deliverables'],default='auto')
|
|
284
|
+
p.add_argument('--mode',default='auto',help='One of '+', '.join(RULES['modes']))
|
|
285
|
+
p.set_defaults(run=route)
|
|
286
|
+
p=sub.add_parser('validate-design');p.add_argument('file',nargs='?',default='DESIGN.md');p.set_defaults(run=validate)
|
|
287
|
+
for cmd in ['bundle','status','check-updates','update-upstreams','rollback-upstreams','recover-upstreams']:
|
|
288
|
+
p=sub.add_parser(cmd);p.add_argument('--agent',choices=AGENTS,default='all');p.add_argument('--scope',choices=['project','global'],default='project');p.add_argument('--path',default='.')
|
|
289
|
+
if cmd=='bundle':p.add_argument('--profile',choices=list(manager.REGISTRY['profiles']))
|
|
290
|
+
if cmd in ['bundle','update-upstreams']:p.add_argument('--provider',choices=list(manager.PROVIDERS),action='append',help='Select individual provider; repeat to select multiple')
|
|
291
|
+
if cmd in ['bundle','update-upstreams','rollback-upstreams']:p.add_argument('--dry-run',action='store_true')
|
|
292
|
+
if cmd in ['bundle','update-upstreams']:
|
|
293
|
+
p.add_argument('--plan',type=Path,help='Apply the exact changes from a reviewed JSON preview')
|
|
294
|
+
p.add_argument('--offline',action='store_true',help='With --dry-run, show local status only')
|
|
295
|
+
if cmd=='recover-upstreams':
|
|
296
|
+
p.add_argument('--legacy-stale-lock',action='store_true',help='Recover a legacy lock after its process has exited')
|
|
297
|
+
p.add_argument('--quarantine-legacy-partial',action='store_true',help='Preserve incomplete legacy files in history and restore the verified backup')
|
|
298
|
+
if cmd=='rollback-upstreams':
|
|
299
|
+
p.add_argument('--transaction',help='Select a history transaction whose end state matches the current lock')
|
|
300
|
+
p.set_defaults(run=lambda a:manager.run(a,[p.parent for p in locations(Path(a.path).resolve(),a.agent,a.scope)]))
|
|
301
|
+
args=pa.parse_args()
|
|
302
|
+
try:return args.run(args)
|
|
303
|
+
except (OSError,ValueError,subprocess.SubprocessError) as exc:print(f'ERROR: {exc}',file=sys.stderr);return 2
|
|
304
|
+
if __name__=='__main__':sys.exit(main())
|