ui-director-skill 0.1.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/bin/ui.mjs ADDED
@@ -0,0 +1,206 @@
1
+ #!/usr/bin/env node
2
+ import { existsSync } from 'node:fs';
3
+ import { resolve } from 'node:path';
4
+ import {
5
+ commandExists,
6
+ currentCommit,
7
+ diffProvider,
8
+ ensureState,
9
+ installDirectorSkill,
10
+ installProvider,
11
+ loadLock,
12
+ lockExists,
13
+ packageVersion,
14
+ providerDir,
15
+ providersConfig,
16
+ resolveCapability,
17
+ rollbackProvider,
18
+ shortSha,
19
+ updateProvider,
20
+ validateAll,
21
+ validateLockConfig,
22
+ validateLockState,
23
+ validateProvider,
24
+ writeLock,
25
+ } from '../lib/core.mjs';
26
+
27
+ const VERSION = packageVersion();
28
+ const root = resolve(process.cwd());
29
+ const args = process.argv.slice(2);
30
+ const cmd = args[0] || 'status';
31
+ const target = args[1];
32
+
33
+ function help() {
34
+ console.log(`UI Director ${VERSION}\n\nUsage:\n ui [command] [provider|capability]\n\nCommands:\n ui init Initialize UI Director in current project\n ui status Show provider status (default)\n ui update [provider] Update all or one specialist provider\n ui doctor Validate runtime, providers and adapters\n ui diff [provider] Show upstream changes\n ui rollback [provider] Roll back all possible or one provider\n ui resolve <capability> Resolve a logical capability to current files\n ui --version Print version\n ui --help Show this help\n\nProviders:\n ui-ux-pro-max\n jakub-skills\n design-system\n impeccable\n`);
35
+ }
36
+
37
+ function names() {
38
+ return Object.keys(providersConfig().providers);
39
+ }
40
+
41
+ function assertRuntime() {
42
+ if (!commandExists('git')) throw new Error('Git is required but was not found on PATH.');
43
+ }
44
+
45
+ function status() {
46
+ console.log(`UI Director ${VERSION}`);
47
+ console.log(`Project: ${root}\n`);
48
+ const lock = loadLock(root);
49
+ for (const name of names()) {
50
+ const dir = providerDir(root, name);
51
+ const commit = currentCommit(dir);
52
+ const locked = lock.providers?.[name]?.commit;
53
+ const mark = commit ? '✓' : '·';
54
+ const lockInfo = locked && locked !== commit ? ` lock:${shortSha(locked)}` : '';
55
+ console.log(`${mark} ${name.padEnd(18)} ${commit ? shortSha(commit) : 'not installed'}${lockInfo}`);
56
+ }
57
+ console.log('\nUse `ui update` to fetch validated upstream updates.');
58
+ }
59
+
60
+ async function main() {
61
+ if (cmd === '--help' || cmd === '-h' || cmd === 'help') return help();
62
+ if (cmd === '--version' || cmd === '-v' || cmd === 'version') return console.log(VERSION);
63
+
64
+ if (cmd === 'init') {
65
+ assertRuntime();
66
+ ensureState(root);
67
+ const hasLock = lockExists(root);
68
+ const existingLock = loadLock(root);
69
+ if (hasLock) {
70
+ const lockCheck = validateLockConfig(root, existingLock);
71
+ if (!lockCheck.ok) {
72
+ throw new Error(`Existing lockfile cannot be reproduced:\n- ${lockCheck.errors.join('\n- ')}`);
73
+ }
74
+ }
75
+ console.log('Initializing UI Director...');
76
+ for (const [name, cfg] of Object.entries(providersConfig().providers)) {
77
+ installProvider(root, name, cfg, existingLock.providers?.[name]?.commit || null);
78
+ const check = validateProvider(root, name);
79
+ if (!check.ok) throw new Error(`${name} failed adapter validation:\n- ${check.errors.join('\n- ')}`);
80
+ console.log(` ✓ ${name} ${shortSha(currentCommit(providerDir(root, name)))}`);
81
+ }
82
+ if (hasLock) {
83
+ const stateCheck = validateLockState(root);
84
+ if (!stateCheck.ok) {
85
+ throw new Error(`Locked provider state is not reproducible:\n- ${stateCheck.errors.join('\n- ')}`);
86
+ }
87
+ }
88
+ const targets = installDirectorSkill(root);
89
+ writeLock(root);
90
+ console.log('\nInstalled UI Director skill:');
91
+ for (const t of targets) console.log(` ✓ ${t}`);
92
+ console.log('\nReady. Use your agent with ui-director, and run `ui update` occasionally.');
93
+ return;
94
+ }
95
+
96
+ if (cmd === 'status') return status();
97
+
98
+ if (cmd === 'doctor') {
99
+ const errors = [];
100
+ console.log('UI Director doctor\n');
101
+ const nodeMajor = Number(process.versions.node.split('.')[0]);
102
+ console.log(`${nodeMajor >= 18 ? '✓' : '✗'} Node ${process.versions.node}`);
103
+ if (nodeMajor < 18) errors.push('Node 18+ is required');
104
+ console.log(`${commandExists('git') ? '✓' : '✗'} Git`);
105
+ if (!commandExists('git')) errors.push('Git is required');
106
+
107
+ const results = validateAll(root);
108
+ for (const [name, result] of Object.entries(results)) {
109
+ console.log(`${result.ok ? '✓' : '✗'} ${name}`);
110
+ for (const e of result.errors) console.log(` - ${e}`);
111
+ if (!result.ok) errors.push(`${name}: ${result.errors.join('; ')}`);
112
+ }
113
+
114
+ const lockResult = validateLockState(root);
115
+ console.log(`${lockResult.ok ? '✓' : '✗'} lockfile`);
116
+ for (const e of lockResult.errors) console.log(` - ${e}`);
117
+ if (!lockResult.ok) errors.push(...lockResult.errors.map((e) => `lockfile: ${e}`));
118
+
119
+ const skillTargets = [
120
+ resolve(root, '.agents', 'skills', 'ui-director', 'SKILL.md'),
121
+ resolve(root, '.claude', 'skills', 'ui-director', 'SKILL.md'),
122
+ ];
123
+ for (const s of skillTargets) {
124
+ const target = resolve(s, '..');
125
+ const complete = existsSync(s)
126
+ && existsSync(resolve(target, 'bin', 'ui.mjs'))
127
+ && existsSync(resolve(target, 'config', 'providers.json'))
128
+ && existsSync(resolve(target, 'package.json'));
129
+ console.log(`${complete ? '✓' : '✗'} ${target}`);
130
+ if (!complete) errors.push(`skill installation is incomplete: ${target}`);
131
+ }
132
+
133
+ if (errors.length) {
134
+ console.log(`\nUNHEALTHY (${errors.length} issue${errors.length > 1 ? 's' : ''})`);
135
+ process.exitCode = 1;
136
+ } else {
137
+ console.log('\nHEALTHY');
138
+ }
139
+ return;
140
+ }
141
+
142
+ if (cmd === 'resolve') {
143
+ if (!target) throw new Error('Usage: ui resolve <capability>');
144
+ for (const p of resolveCapability(root, target)) console.log(p);
145
+ return;
146
+ }
147
+
148
+ if (cmd === 'diff') {
149
+ assertRuntime();
150
+ const selected = target ? [target] : names();
151
+ for (const name of selected) {
152
+ console.log(`\n${await diffProvider(root, name)}\n`);
153
+ }
154
+ return;
155
+ }
156
+
157
+ if (cmd === 'update' || cmd === 'up') {
158
+ assertRuntime();
159
+ const selected = target ? [target] : names();
160
+ const failures = [];
161
+ for (const name of selected) {
162
+ process.stdout.write(`Updating ${name}... `);
163
+ try {
164
+ const result = updateProvider(root, name);
165
+ console.log(result.changed ? `${shortSha(result.before)} -> ${shortSha(result.after)}` : 'up to date');
166
+ } catch (e) {
167
+ console.log('REJECTED');
168
+ console.error(String(e.message || e));
169
+ failures.push(name);
170
+ }
171
+ }
172
+ writeLock(root);
173
+ if (failures.length) {
174
+ console.error(`\n${failures.length} update(s) rejected; working versions were preserved.`);
175
+ process.exitCode = 1;
176
+ } else {
177
+ console.log('\nAll selected providers validated. Lockfile updated.');
178
+ }
179
+ return;
180
+ }
181
+
182
+ if (cmd === 'rollback') {
183
+ assertRuntime();
184
+ const selected = target ? [target] : names();
185
+ let changed = 0;
186
+ for (const name of selected) {
187
+ try {
188
+ const result = rollbackProvider(root, name);
189
+ console.log(`✓ ${name}: ${shortSha(result.before)} -> ${shortSha(result.after)}`);
190
+ changed++;
191
+ } catch (e) {
192
+ if (target) throw e;
193
+ console.log(`· ${name}: ${e.message}`);
194
+ }
195
+ }
196
+ if (changed) writeLock(root);
197
+ return;
198
+ }
199
+
200
+ throw new Error(`Unknown command '${cmd}'. Run 'ui --help'.`);
201
+ }
202
+
203
+ main().catch((err) => {
204
+ console.error(`\nUI Director error: ${err.message || err}`);
205
+ process.exit(1);
206
+ });
@@ -0,0 +1,17 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "capabilities": {
4
+ "research": { "provider": "ui-ux-pro-max", "adapterKey": "research" },
5
+ "interface": { "provider": "jakub-skills", "adapterKey": "interface" },
6
+ "layout": { "provider": "jakub-skills", "adapterKey": "layout" },
7
+ "typography": { "provider": "jakub-skills", "adapterKey": "typography" },
8
+ "colors": { "provider": "jakub-skills", "adapterKey": "colors" },
9
+ "accessibility": { "provider": "jakub-skills", "adapterKey": "accessibility" },
10
+ "writing": { "provider": "jakub-skills", "adapterKey": "writing" },
11
+ "design-system": { "provider": "design-system", "adapterKey": "design-system" },
12
+ "audit": { "provider": "impeccable", "adapterKey": "audit" },
13
+ "critique": { "provider": "impeccable", "adapterKey": "critique" },
14
+ "distill": { "provider": "impeccable", "adapterKey": "distill" },
15
+ "polish": { "provider": "impeccable", "adapterKey": "polish" }
16
+ }
17
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "schemaVersion": 1,
3
+ "providers": {
4
+ "ui-ux-pro-max": {
5
+ "role": "research",
6
+ "type": "git",
7
+ "repo": "https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git",
8
+ "branch": "main"
9
+ },
10
+ "jakub-skills": {
11
+ "role": "design-engineering",
12
+ "type": "git",
13
+ "repo": "https://github.com/jakubkrehel/skills.git",
14
+ "branch": "main"
15
+ },
16
+ "design-system": {
17
+ "role": "project-system",
18
+ "type": "git",
19
+ "repo": "https://github.com/chrometaphore/design-system-skill.git",
20
+ "branch": "main"
21
+ },
22
+ "impeccable": {
23
+ "role": "quality",
24
+ "type": "git",
25
+ "repo": "https://github.com/pbakaus/impeccable.git",
26
+ "branch": "main"
27
+ }
28
+ }
29
+ }
@@ -0,0 +1,70 @@
1
+ # Usage Examples
2
+
3
+ ## Existing admin product
4
+
5
+ Prompt:
6
+
7
+ ```text
8
+ Use ui-director to add an AI agent management page to the existing admin console.
9
+ ```
10
+
11
+ Expected logical route:
12
+
13
+ ```text
14
+ EXTEND / STANDARD
15
+
16
+ design-system
17
+ → layout
18
+ → typography
19
+ → interface
20
+ → implementation
21
+ → accessibility (if interactive/forms)
22
+ → audit
23
+ → polish
24
+ ```
25
+
26
+ `research` should normally be skipped.
27
+
28
+ ## Greenfield trading dashboard
29
+
30
+ Prompt:
31
+
32
+ ```text
33
+ Use ui-director to create a professional quantitative trading dashboard from scratch. The visual direction is not defined yet.
34
+ ```
35
+
36
+ Expected route:
37
+
38
+ ```text
39
+ CREATE / DEEP
40
+
41
+ research
42
+ → interface
43
+ → layout
44
+ → typography
45
+ → colors
46
+ → implementation
47
+ → accessibility
48
+ → audit
49
+ → distill
50
+ → polish
51
+ ```
52
+
53
+ ## Small accessibility fix
54
+
55
+ Prompt:
56
+
57
+ ```text
58
+ Use ui-director to fix keyboard navigation and focus behavior in this settings form.
59
+ ```
60
+
61
+ Expected route:
62
+
63
+ ```text
64
+ FIX / FAST
65
+
66
+ design-system
67
+ → accessibility
68
+ → implementation
69
+ → targeted audit
70
+ ```