mobileui-os 1.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/AGENTS.md +47 -0
- package/CHANGELOG.md +25 -0
- package/README.md +78 -0
- package/bin/cli.mjs +375 -0
- package/knowledge/android/00-apple-to-android-adaption.md +1499 -0
- package/knowledge/android/accessibility.md +333 -0
- package/knowledge/android/components-controls.md +270 -0
- package/knowledge/android/material-design-3.md +174 -0
- package/knowledge/android/navigation-patterns.md +212 -0
- package/knowledge/apple/00-skill-reading-protocol.md +1296 -0
- package/knowledge/apple/Accessibility, Inclusive Design & Human Factors Intelligence.md +735 -0
- package/knowledge/apple/Advanced Interaction Patterns, Gestures, Feedback & State Transitions.md +1140 -0
- package/knowledge/apple/Advanced Navigation, Information Architecture & Wayfinding.md +551 -0
- package/knowledge/apple/Autonomus Ui-UX Improvement Loop.md +611 -0
- package/knowledge/apple/Color, Materials, Contrast, Themes & Visual Depth.md +1351 -0
- package/knowledge/apple/Content, Copy, Microinteractions & UX Communication.md +642 -0
- package/knowledge/apple/Data-Heavy Interfaces, Tables, Lists, Search, Filtering & Large-Scale Content.md +721 -0
- package/knowledge/apple/Design Systems & Component Architecture.md +412 -0
- package/knowledge/apple/Forms, Input, Data Entry & Validation Intelligence.md +705 -0
- package/knowledge/apple/Interaction, State & Edge-Case Engineering.md +491 -0
- package/knowledge/apple/Interaction-behaviour.md +1378 -0
- package/knowledge/apple/Layout Architecture, Responsive Design & Spatial Systems.md +1365 -0
- package/knowledge/apple/MASTER UI-UX ORCHESTRATOR.md +1210 -0
- package/knowledge/apple/Navigation Architecture, Routing, Deep Linking & State Restoration.md +1392 -0
- package/knowledge/apple/Navigation, Information Architecture & Spatial Hierarchy.md +1613 -0
- package/knowledge/apple/Notifications, Permissions, Privacy and Trust.md +1540 -0
- package/knowledge/apple/Patterns-templates-composition.md +647 -0
- package/knowledge/apple/Performance, Perceived Speed, Motion & Rendering Intelligence.md +855 -0
- package/knowledge/apple/Responsive, Adaptive & Cross-Platform UI Intelligence.md +669 -0
- package/knowledge/apple/Responsive, Adaptive, Accessible & Performant UI.md +545 -0
- package/knowledge/apple/Tablet Adaptation & Multi-Device UX.md +1447 -0
- package/knowledge/apple/UI Implementation & Refactoring.md +498 -0
- package/knowledge/apple/UI-UX Decision-Making, Prioritization & Trade-offs.md +533 -0
- package/knowledge/apple/UI-UX Project Lifecycle & Delivery.md +544 -0
- package/knowledge/apple/User Flows & Experience Architecture.md +335 -0
- package/knowledge/apple/Visual Design Systems, Theming, Tokens & Brand Intelligence.md +764 -0
- package/knowledge/apple/Visual QA, Testing & Validation.md +557 -0
- package/knowledge/apple/accessibility-inclusive-interaction.md +1361 -0
- package/knowledge/apple/accessibility.md +2162 -0
- package/knowledge/apple/color.md +1933 -0
- package/knowledge/apple/component-architecture.md +2208 -0
- package/knowledge/apple/components.md +2172 -0
- package/knowledge/apple/design-decision-framework.md +1883 -0
- package/knowledge/apple/design-review-engine.md +2108 -0
- package/knowledge/apple/design-tokens.md +1943 -0
- package/knowledge/apple/designing-for-ios.md +1680 -0
- package/knowledge/apple/gestures, touch behavior, feedback, motion, and micro-interactions.md +1538 -0
- package/knowledge/apple/hig-foundation.md +1806 -0
- package/knowledge/apple/iconography.md +1903 -0
- package/knowledge/apple/interaction-patterns.md +2513 -0
- package/knowledge/apple/interaction.md +2141 -0
- package/knowledge/apple/ios-alerts-confirmations-destructive-actions.md +1342 -0
- package/knowledge/apple/ios-components-and-controls.md +1634 -0
- package/knowledge/apple/ios-components-patterns.md +1343 -0
- package/knowledge/apple/ios-design-system-architecture.md +1520 -0
- package/knowledge/apple/ios-empty-error-offline-states.md +1370 -0
- package/knowledge/apple/ios-empty-loading-error-recovery.md +1674 -0
- package/knowledge/apple/ios-forms-and-input.md +1458 -0
- package/knowledge/apple/ios-forms-input-data-entry.md +1308 -0
- package/knowledge/apple/ios-gestures-and-touch.md +1272 -0
- package/knowledge/apple/ios-lists-collections-and-data-display.md +1735 -0
- package/knowledge/apple/ios-loading-progress-async-states.md +1378 -0
- package/knowledge/apple/ios-materials-and-surfaces.md +1543 -0
- package/knowledge/apple/ios-motion-animation-transitions.md +1178 -0
- package/knowledge/apple/ios-navigation-and-information-architecture.md +1674 -0
- package/knowledge/apple/ios-navigation-user-flows-design-architecture.md +1195 -0
- package/knowledge/apple/ios-search-and-discovery.md +1456 -0
- package/knowledge/apple/ios-search-filtering-discovery.md +1402 -0
- package/knowledge/apple/ios-sheets-modals-popovers.md +1205 -0
- package/knowledge/apple/ios-typography-icons-visual-hierarchy.md +1431 -0
- package/knowledge/apple/layout.md +2331 -0
- package/knowledge/apple/media-centric-content-ui-patterns.md +1470 -0
- package/knowledge/apple/motion, transitions, physics, and animation language.md +1535 -0
- package/knowledge/apple/motion-and-animation.md +1698 -0
- package/knowledge/apple/motion.md +2087 -0
- package/knowledge/apple/navigation.md +2281 -0
- package/knowledge/apple/responsive-adaptive.md +2159 -0
- package/knowledge/apple/screen-architecture.md +2067 -0
- package/knowledge/apple/typography, Content Hierarchy & Readability.md +1411 -0
- package/knowledge/apple/typography.md +1802 -0
- package/knowledge/apple/ui-ux inteligence audit.md +106 -0
- package/knowledge/apple/visual-design-and-premium-ui.md +1555 -0
- package/knowledge/apple/visual-hierarchy-engine.md +1647 -0
- package/knowledge/apple/visual-materials.md +2189 -0
- package/package.json +53 -0
- package/principles/design-principles.md +37 -0
- package/principles/platform-principles.md +25 -0
- package/principles/ux-principles.md +16 -0
- package/references/official-links.md +11 -0
- package/skills/accessibility-engineer/SKILL.md +125 -0
- package/skills/analytics-engineer/SKILL.md +283 -0
- package/skills/animation-engineer/SKILL.md +316 -0
- package/skills/component-designer/SKILL.md +75 -0
- package/skills/component-library-engineer/SKILL.md +140 -0
- package/skills/component-library-ops/SKILL.md +155 -0
- package/skills/design-system/SKILL.md +77 -0
- package/skills/design-token-engineer/SKILL.md +203 -0
- package/skills/design-token-pipeline/SKILL.md +277 -0
- package/skills/device-lab-engineer/SKILL.md +387 -0
- package/skills/forms-engineer/SKILL.md +79 -0
- package/skills/internationalization-engineer/SKILL.md +256 -0
- package/skills/motion-designer/SKILL.md +77 -0
- package/skills/native-data-fetching/SKILL.md +50 -0
- package/skills/navigation-architect/SKILL.md +65 -0
- package/skills/performance-engineer/SKILL.md +250 -0
- package/skills/platform-specialist/SKILL.md +95 -0
- package/skills/pre-release-gate/SKILL.md +75 -0
- package/skills/screen-designer/SKILL.md +117 -0
- package/skills/security-engineer/SKILL.md +375 -0
- package/skills/skills.json +134 -0
- package/skills/testing-auditor/SKILL.md +62 -0
- package/skills/ui-architect/SKILL.md +86 -0
- package/skills/ui-implementer/SKILL.md +188 -0
- package/skills/ux-architect/SKILL.md +49 -0
- package/skills/ux-auditor/SKILL.md +52 -0
- package/skills/visual-auditor/SKILL.md +71 -0
- package/templates/audit-report.md +29 -0
- package/templates/design-tokens.ts +33 -0
- package/templates/screen-spec.md +61 -0
- package/workflows/new-screen.md +17 -0
- package/workflows/pre-release.md +21 -0
- package/workflows/redesign.md +14 -0
- package/workflows/ui-audit.md +22 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# MobileUI-OS Agent Constitution
|
|
2
|
+
|
|
3
|
+
You are a UI/UX engineering agent, not merely a code generator.
|
|
4
|
+
|
|
5
|
+
## Non-negotiable rules
|
|
6
|
+
|
|
7
|
+
1. Understand the user's task before designing.
|
|
8
|
+
2. Establish information hierarchy before styling.
|
|
9
|
+
3. Prefer familiar platform patterns unless there is a strong product reason to deviate.
|
|
10
|
+
4. Every visible element must earn its place.
|
|
11
|
+
5. Avoid "card soup": cards, gradients, shadows, and rounded containers are tools, not default decoration.
|
|
12
|
+
6. Use semantic design tokens instead of arbitrary values.
|
|
13
|
+
7. Design all meaningful states: loading, empty, content, error, offline, permission, disabled, success where applicable.
|
|
14
|
+
8. Design interaction states: pressed, focused, selected, disabled, loading.
|
|
15
|
+
9. Motion must communicate state, spatial continuity, or feedback. Do not animate decoration.
|
|
16
|
+
10. Accessibility is part of architecture.
|
|
17
|
+
11. Preserve user context during navigation and transitions.
|
|
18
|
+
12. Respect platform differences. Do not force one identical UI across iOS and Android.
|
|
19
|
+
13. Keep primary actions obvious and secondary actions quiet.
|
|
20
|
+
14. Favor direct manipulation and short paths to user goals.
|
|
21
|
+
15. Design for failure and recovery, not only the happy path.
|
|
22
|
+
16. Review the finished implementation visually and behaviorally before declaring it complete.
|
|
23
|
+
|
|
24
|
+
## Before implementation
|
|
25
|
+
|
|
26
|
+
Answer internally:
|
|
27
|
+
- What is the user's primary goal?
|
|
28
|
+
- What is the primary action?
|
|
29
|
+
- What information is most important?
|
|
30
|
+
- What can be removed?
|
|
31
|
+
- What platform convention applies?
|
|
32
|
+
- What states exist?
|
|
33
|
+
- What accessibility semantics are required?
|
|
34
|
+
- What happens if the operation fails?
|
|
35
|
+
- What happens with long content, large text, or small screens?
|
|
36
|
+
|
|
37
|
+
## After implementation
|
|
38
|
+
|
|
39
|
+
Run:
|
|
40
|
+
- Visual audit
|
|
41
|
+
- UX audit
|
|
42
|
+
- Accessibility audit
|
|
43
|
+
- State audit
|
|
44
|
+
- Platform audit
|
|
45
|
+
- Performance/motion sanity check
|
|
46
|
+
|
|
47
|
+
Fix critical and high-severity issues before shipping.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## v1.0.0 — Foundation
|
|
4
|
+
|
|
5
|
+
Initial MobileUI-OS architecture:
|
|
6
|
+
- Agent constitution
|
|
7
|
+
- Design principles
|
|
8
|
+
- UX principles
|
|
9
|
+
- Platform principles
|
|
10
|
+
- 10 specialized skills
|
|
11
|
+
- New-screen and redesign workflows
|
|
12
|
+
- UI audit and pre-release workflows
|
|
13
|
+
- Design token template
|
|
14
|
+
- Screen specification template
|
|
15
|
+
- Audit report template
|
|
16
|
+
- Official reference registry
|
|
17
|
+
|
|
18
|
+
Next planned:
|
|
19
|
+
- component pattern library
|
|
20
|
+
- detailed iOS patterns
|
|
21
|
+
- detailed Material patterns
|
|
22
|
+
- motion recipes
|
|
23
|
+
- accessibility test matrix
|
|
24
|
+
- screenshot/vision audit workflow
|
|
25
|
+
- project adapter templates for Claude/Codex/Cursor
|
package/README.md
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# MobileUI-OS v1.0
|
|
2
|
+
|
|
3
|
+
A portable agentic UI/UX quality system for premium mobile applications.
|
|
4
|
+
|
|
5
|
+
## Install via npx (skill-npx pkg)
|
|
6
|
+
|
|
7
|
+
No clone required. Run directly in any project:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Install all 26 skills + adapters for all platforms
|
|
11
|
+
npx mobileui-os init
|
|
12
|
+
|
|
13
|
+
# Only for specific platforms
|
|
14
|
+
npx mobileui-os init --platforms claude,opencode
|
|
15
|
+
|
|
16
|
+
# Install into another directory
|
|
17
|
+
npx mobileui-os init ./my-app --platforms cursor
|
|
18
|
+
|
|
19
|
+
# Add a single skill
|
|
20
|
+
npx mobileui-os add ui-architect
|
|
21
|
+
|
|
22
|
+
# List available skills
|
|
23
|
+
npx mobileui-os list
|
|
24
|
+
npx mobileui-os list --json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Via `npm exec` / `npx` from local checkout:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npm exec --package "C:\path\to\MobileUI-OS-v1" -- mobileui-os init
|
|
31
|
+
npx --package mobileui-os mobileui-os --help
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
After `publish`, consumers can also run `npx mobileui-os@latest init`. The package ships the canonical `skills/*/SKILL.md`, `templates/`, `knowledge/`, `principles/`, `workflows/` and generates the Agent Skills manifest `skills/skills.json` plus per-platform wrappers (`.claude/skills/`, `.opencode/skills/`, `.cursor/skills/`, `.codex/skills/`, `.gemini/skills/`).
|
|
35
|
+
|
|
36
|
+
Short alias is also available: `npx mobileui init`.
|
|
37
|
+
|
|
38
|
+
## Platform compatibility
|
|
39
|
+
|
|
40
|
+
Skills ship in the Agent Skills format (`skills/<name>/SKILL.md`) and are auto-discovered by major agentic platforms through adapter directories committed at the repo root. Each adapter is a thin `SKILL.md` wrapper that points to the canonical skill file, so there is a single source of truth.
|
|
41
|
+
|
|
42
|
+
| Platform | Skill directory | Notes |
|
|
43
|
+
|----------|-----------------|-------|
|
|
44
|
+
| Claude Code | `.claude/skills/` | Also auto-loaded by opencode from `~/.claude/skills/` |
|
|
45
|
+
| opencode | `.opencode/skills/` | Same layout works under `.opencode/skill/` |
|
|
46
|
+
| Cursor | `.cursor/skills/` | — |
|
|
47
|
+
| OpenAI Codex | `.codex/skills/` | — |
|
|
48
|
+
| Gemini CLI | `.gemini/skills/` | — |
|
|
49
|
+
| Any Agent Skills consumer | `skills/` + `skills/skills.json` | Standard manifest with `instructions` paths |
|
|
50
|
+
|
|
51
|
+
Regenerate or add platform adapters with:
|
|
52
|
+
|
|
53
|
+
```powershell
|
|
54
|
+
pwsh scripts/sync-platform-adapters.ps1
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Canonical skills stay in `skills/`; never edit the generated wrappers directly.
|
|
58
|
+
|
|
59
|
+
## Mission
|
|
60
|
+
Combine platform-aware design guidance, UX reasoning, design-system discipline, accessibility, motion, implementation rules, and visual/UX auditing into a reusable skill layer.
|
|
61
|
+
|
|
62
|
+
## Primary target
|
|
63
|
+
React Native + Expo + TypeScript, while keeping the principles framework-independent.
|
|
64
|
+
|
|
65
|
+
## Quality target
|
|
66
|
+
Apple-level UX discipline + Material systemization + modern premium product design + React Native/Expo engineering discipline.
|
|
67
|
+
|
|
68
|
+
## Core loop
|
|
69
|
+
REQUEST → ANALYZE → PLAN → DESIGN → IMPLEMENT → INSPECT → AUDIT → FIX → RE-AUDIT → SHIP
|
|
70
|
+
|
|
71
|
+
## Source hierarchy
|
|
72
|
+
1. Official platform guidance
|
|
73
|
+
2. Project design system
|
|
74
|
+
3. Product-specific UX decisions
|
|
75
|
+
4. Established interaction patterns
|
|
76
|
+
5. Inspiration/reference material
|
|
77
|
+
|
|
78
|
+
Never copy a visual style blindly. Extract the underlying design principle.
|
package/bin/cli.mjs
ADDED
|
@@ -0,0 +1,375 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* mobileui-os — npx skill package CLI
|
|
4
|
+
* Install MobileUI-OS skills into any project via:
|
|
5
|
+
* npx mobileui-os init
|
|
6
|
+
* npx mobileui-os add <skill>
|
|
7
|
+
* npx mobileui-os list
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync, readdirSync, copyFileSync, statSync } from 'node:fs';
|
|
11
|
+
import { join, dirname, resolve, relative, basename } from 'node:path';
|
|
12
|
+
import { fileURLToPath } from 'node:url';
|
|
13
|
+
|
|
14
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
+
const __dirname = dirname(__filename);
|
|
16
|
+
const PKG_ROOT = resolve(__dirname, '..');
|
|
17
|
+
const SKILLS_SRC = join(PKG_ROOT, 'skills');
|
|
18
|
+
const PKG_JSON = join(PKG_ROOT, 'package.json');
|
|
19
|
+
|
|
20
|
+
// ── platforms (same as scripts/sync-platform-adapters.ps1)
|
|
21
|
+
const PLATFORMS = {
|
|
22
|
+
claude: { dir: '.claude', label: 'Claude Code' },
|
|
23
|
+
opencode: { dir: '.opencode', label: 'opencode' },
|
|
24
|
+
cursor: { dir: '.cursor', label: 'Cursor' },
|
|
25
|
+
codex: { dir: '.codex', label: 'OpenAI Codex' },
|
|
26
|
+
gemini: { dir: '.gemini', label: 'Gemini CLI' },
|
|
27
|
+
};
|
|
28
|
+
const ALL_PLATFORMS = Object.keys(PLATFORMS);
|
|
29
|
+
|
|
30
|
+
function readPkg() {
|
|
31
|
+
try { return JSON.parse(readFileSync(PKG_JSON, 'utf8')); } catch { return { version: '0.0.0', name: 'mobileui-os' }; }
|
|
32
|
+
}
|
|
33
|
+
const PKG = readPkg();
|
|
34
|
+
|
|
35
|
+
function getSkills() {
|
|
36
|
+
if (!existsSync(SKILLS_SRC)) return [];
|
|
37
|
+
const entries = readdirSync(SKILLS_SRC, { withFileTypes: true });
|
|
38
|
+
const skills = [];
|
|
39
|
+
for (const e of entries) {
|
|
40
|
+
if (!e.isDirectory()) continue;
|
|
41
|
+
const skillMd = join(SKILLS_SRC, e.name, 'SKILL.md');
|
|
42
|
+
if (!existsSync(skillMd)) continue;
|
|
43
|
+
const lines = readFileSync(skillMd, 'utf8').split('\n');
|
|
44
|
+
let title = e.name;
|
|
45
|
+
const m = lines[0]?.match(/^#\s+(.+?)\s*$/);
|
|
46
|
+
if (m) title = m[1];
|
|
47
|
+
let desc = '';
|
|
48
|
+
if (lines.length >= 3) desc = (lines[2] || '').trim();
|
|
49
|
+
if (!desc) desc = title;
|
|
50
|
+
// strip markdown heading markers if description accidentally has them
|
|
51
|
+
skills.push({ name: e.name, title, description: desc, file: skillMd });
|
|
52
|
+
}
|
|
53
|
+
return skills.sort((a, b) => a.name.localeCompare(b.name));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function yamlScalar(v) {
|
|
57
|
+
return "'" + v.replace(/'/g, "''") + "'";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function ensureDir(p) { mkdirSync(p, { recursive: true }); }
|
|
61
|
+
|
|
62
|
+
function copyRecursive(src, dest) {
|
|
63
|
+
const st = statSync(src);
|
|
64
|
+
if (st.isDirectory()) {
|
|
65
|
+
ensureDir(dest);
|
|
66
|
+
for (const e of readdirSync(src)) copyRecursive(join(src, e), join(dest, e));
|
|
67
|
+
} else {
|
|
68
|
+
ensureDir(dirname(dest));
|
|
69
|
+
copyFileSync(src, dest);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// ── manifest generation (skills/skills.json)
|
|
74
|
+
function writeManifest(targetRoot, skills) {
|
|
75
|
+
const entries = skills.map(s => ({
|
|
76
|
+
name: s.name,
|
|
77
|
+
description: s.description,
|
|
78
|
+
instructions: `${s.name}/SKILL.md`,
|
|
79
|
+
}));
|
|
80
|
+
const manifest = { skills: entries };
|
|
81
|
+
const out = join(targetRoot, 'skills', 'skills.json');
|
|
82
|
+
ensureDir(dirname(out));
|
|
83
|
+
writeFileSync(out, JSON.stringify(manifest, null, 2) + '\n', 'utf8');
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// ── per-platform wrappers
|
|
87
|
+
function writeWrappers(targetRoot, skills, platforms, opts = {}) {
|
|
88
|
+
const { force = false } = opts;
|
|
89
|
+
let wrote = 0;
|
|
90
|
+
for (const pName of platforms) {
|
|
91
|
+
const p = PLATFORMS[pName];
|
|
92
|
+
if (!p) continue;
|
|
93
|
+
for (const s of skills) {
|
|
94
|
+
const skillDir = join(targetRoot, p.dir, 'skills', s.name);
|
|
95
|
+
const outFile = join(skillDir, 'SKILL.md');
|
|
96
|
+
if (existsSync(outFile) && !force) {
|
|
97
|
+
// skip if already exists unless forced
|
|
98
|
+
// still count as present
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
ensureDir(skillDir);
|
|
102
|
+
const canonicalRel = relative(skillDir, s.file).replace(/\\/g, '/');
|
|
103
|
+
// When vendoring, we copy canonical skills to targetRoot/skills/<name>/SKILL.md,
|
|
104
|
+
// so wrapper should point to that vendored copy. Use path from wrapper to vendored file.
|
|
105
|
+
// Compute vendored canonical path:
|
|
106
|
+
const vendored = join(targetRoot, 'skills', s.name, 'SKILL.md');
|
|
107
|
+
let relToVendored = relative(skillDir, vendored).replace(/\\/g, '/');
|
|
108
|
+
// If vendoring is done before wrapper, prefer relative to vendored; else fallback to pkg relative.
|
|
109
|
+
// We'll use vendored path if target will have skills/ dir.
|
|
110
|
+
const useRel = relToVendored.startsWith('..') ? relToVendored : relToVendored;
|
|
111
|
+
// If target is same as PKG_ROOT (self-install), use pkg-relative; otherwise vendored.
|
|
112
|
+
const finalRel = targetRoot === PKG_ROOT ? canonicalRel : useRel;
|
|
113
|
+
const wrapper = [
|
|
114
|
+
'---',
|
|
115
|
+
`name: ${s.name}`,
|
|
116
|
+
`description: ${yamlScalar(s.description)}`,
|
|
117
|
+
'---',
|
|
118
|
+
'',
|
|
119
|
+
`# ${s.title}`,
|
|
120
|
+
'',
|
|
121
|
+
`${p.label} adapter for the MobileUI-OS skill suite.`,
|
|
122
|
+
'',
|
|
123
|
+
'Load and follow the canonical skill:',
|
|
124
|
+
'',
|
|
125
|
+
`- **${finalRel}**`,
|
|
126
|
+
'',
|
|
127
|
+
'The canonical file in `skills/` is the single source of truth; this wrapper only registers the skill with ' + p.label + '.',
|
|
128
|
+
'',
|
|
129
|
+
].join('\n');
|
|
130
|
+
writeFileSync(outFile, wrapper, 'utf8');
|
|
131
|
+
wrote++;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
return wrote;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
function vendorSkills(targetRoot, skills, opts = {}) {
|
|
138
|
+
const { force = false } = opts;
|
|
139
|
+
let count = 0;
|
|
140
|
+
for (const s of skills) {
|
|
141
|
+
const srcDir = join(SKILLS_SRC, s.name);
|
|
142
|
+
const destDir = join(targetRoot, 'skills', s.name);
|
|
143
|
+
if (existsSync(destDir) && !force) continue;
|
|
144
|
+
// copy whole skill dir
|
|
145
|
+
copyRecursive(srcDir, destDir);
|
|
146
|
+
// also copy templates/knowledge/principles if needed? No, init only copies skills by default.
|
|
147
|
+
count++;
|
|
148
|
+
}
|
|
149
|
+
// copy shared assets if missing: templates, AGENTS.md
|
|
150
|
+
const shared = ['templates', 'knowledge', 'principles', 'references', 'workflows'];
|
|
151
|
+
for (const dir of shared) {
|
|
152
|
+
const src = join(PKG_ROOT, dir);
|
|
153
|
+
if (!existsSync(src)) continue;
|
|
154
|
+
const dest = join(targetRoot, dir);
|
|
155
|
+
if (existsSync(dest) && !force) continue;
|
|
156
|
+
copyRecursive(src, dest);
|
|
157
|
+
}
|
|
158
|
+
// AGENTS.md
|
|
159
|
+
const agentsSrc = join(PKG_ROOT, 'AGENTS.md');
|
|
160
|
+
if (existsSync(agentsSrc)) {
|
|
161
|
+
const dest = join(targetRoot, 'AGENTS.md');
|
|
162
|
+
if (!existsSync(dest) || force) copyFileSync(agentsSrc, dest);
|
|
163
|
+
}
|
|
164
|
+
writeManifest(targetRoot, skills);
|
|
165
|
+
return count;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// ── arg parsing
|
|
169
|
+
function parseArgs(argv) {
|
|
170
|
+
const args = argv.slice(2);
|
|
171
|
+
const cmd = args[0] && !args[0].startsWith('-') ? args[0] : null;
|
|
172
|
+
const rest = cmd ? args.slice(1) : args;
|
|
173
|
+
const opts = { _: [] };
|
|
174
|
+
let i = 0;
|
|
175
|
+
while (i < rest.length) {
|
|
176
|
+
const a = rest[i];
|
|
177
|
+
if (a === '--help' || a === '-h') opts.help = true;
|
|
178
|
+
else if (a === '--version' || a === '-v') opts.version = true;
|
|
179
|
+
else if (a === '--force' || a === '-f') opts.force = true;
|
|
180
|
+
else if (a === '--json') opts.json = true;
|
|
181
|
+
else if (a === '--all') { opts.all = true; }
|
|
182
|
+
else if (a.startsWith('--platforms=')) opts.platforms = a.split('=')[1].split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
|
|
183
|
+
else if (a === '--platforms' || a === '-p') { opts.platforms = (rest[++i] || '').split(',').map(s => s.trim().toLowerCase()).filter(Boolean); }
|
|
184
|
+
else if (a.startsWith('-p=')) opts.platforms = a.split('=')[1].split(',').map(s => s.trim().toLowerCase()).filter(Boolean);
|
|
185
|
+
else if (!a.startsWith('-')) opts._.push(a);
|
|
186
|
+
else { /* unknown flag */ opts.unknown = a; }
|
|
187
|
+
i++;
|
|
188
|
+
}
|
|
189
|
+
return { cmd, opts, raw: args };
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function printHelp() {
|
|
193
|
+
const v = PKG.version || '1.0.0';
|
|
194
|
+
console.log(`
|
|
195
|
+
mobileui-os v${v} — Portable UI/UX quality system for premium mobile apps
|
|
196
|
+
|
|
197
|
+
Usage:
|
|
198
|
+
npx mobileui-os [command] [options]
|
|
199
|
+
npx mobileui [command] [options]
|
|
200
|
+
|
|
201
|
+
Commands:
|
|
202
|
+
init [dir] Install all skills into <dir> (default: current dir)
|
|
203
|
+
Copies canonical skills to ./skills/ + generates
|
|
204
|
+
adapter wrappers for each platform.
|
|
205
|
+
add <skill> [dir] Install a single skill (e.g. ui-architect)
|
|
206
|
+
list List available skills
|
|
207
|
+
--help, -h Show this help
|
|
208
|
+
--version, -v Show version
|
|
209
|
+
|
|
210
|
+
Options:
|
|
211
|
+
-p, --platforms <list> Comma-separated: claude,opencode,cursor,codex,gemini,all
|
|
212
|
+
Default: all
|
|
213
|
+
--all Alias for --platforms=all
|
|
214
|
+
-f, --force Overwrite existing files
|
|
215
|
+
--json Machine-readable output (list)
|
|
216
|
+
|
|
217
|
+
Examples:
|
|
218
|
+
npx mobileui-os init
|
|
219
|
+
npx mobileui-os init ./my-app --platforms claude,opencode
|
|
220
|
+
npx mobileui-os add ui-architect --platforms cursor
|
|
221
|
+
npx mobileui-os list --json
|
|
222
|
+
npx mobileui-os --version
|
|
223
|
+
|
|
224
|
+
Docs: https://github.com/anomalyco/mobileui-os
|
|
225
|
+
Skills manifest: skills/skills.json (Agent Skills standard)
|
|
226
|
+
`.trim());
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
function resolvePlatforms(opts) {
|
|
230
|
+
if (opts.all) return [...ALL_PLATFORMS];
|
|
231
|
+
if (!opts.platforms || opts.platforms.length === 0) return [...ALL_PLATFORMS];
|
|
232
|
+
if (opts.platforms.includes('all')) return [...ALL_PLATFORMS];
|
|
233
|
+
const bad = opts.platforms.filter(p => !ALL_PLATFORMS.includes(p));
|
|
234
|
+
if (bad.length) {
|
|
235
|
+
console.error(`Unknown platforms: ${bad.join(', ')}\nValid: ${ALL_PLATFORMS.join(', ')}, all`);
|
|
236
|
+
process.exit(1);
|
|
237
|
+
}
|
|
238
|
+
return opts.platforms;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
function resolveTarget(dirArg) {
|
|
242
|
+
if (!dirArg) return process.cwd();
|
|
243
|
+
return resolve(process.cwd(), dirArg);
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// ── commands
|
|
247
|
+
function cmdList(opts) {
|
|
248
|
+
const skills = getSkills();
|
|
249
|
+
if (opts.json) {
|
|
250
|
+
console.log(JSON.stringify(skills.map(s => ({ name: s.name, description: s.description, title: s.title })), null, 2));
|
|
251
|
+
} else {
|
|
252
|
+
console.log(`\nAvailable skills (${skills.length}):\n`);
|
|
253
|
+
for (const s of skills) {
|
|
254
|
+
console.log(` ${s.name.padEnd(28)} ${s.description}`);
|
|
255
|
+
}
|
|
256
|
+
console.log(`\nRun: npx mobileui-os add <skill> or npx mobileui-os init`);
|
|
257
|
+
console.log(`Manifest: skills/skills.json\n`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function cmdInit(opts) {
|
|
262
|
+
const dirArg = opts._[0] && !ALL_PLATFORMS.includes(opts._[0]) ? opts._[0] : null;
|
|
263
|
+
// also support positional after skill name for add; for init only one arg
|
|
264
|
+
const targetArg = dirArg || opts._[1] || opts._[0];
|
|
265
|
+
// If first positional looks like a platform list, ignore
|
|
266
|
+
let target = process.cwd();
|
|
267
|
+
let maybeDir = opts._[0];
|
|
268
|
+
if (maybeDir && !getSkills().find(s => s.name === maybeDir)) {
|
|
269
|
+
// if maybeDir is not a skill name, treat as dir
|
|
270
|
+
// but need to distinguish: init ./foo => _ = ['./foo']
|
|
271
|
+
target = resolveTarget(maybeDir);
|
|
272
|
+
}
|
|
273
|
+
const platforms = resolvePlatforms(opts);
|
|
274
|
+
const skills = getSkills();
|
|
275
|
+
if (skills.length === 0) {
|
|
276
|
+
console.error('No skills found in package (expected skills/*/SKILL.md).');
|
|
277
|
+
process.exit(1);
|
|
278
|
+
}
|
|
279
|
+
console.log(`\nInstalling MobileUI-OS v${PKG.version} → ${relative(process.cwd(), target) || '.'}`);
|
|
280
|
+
console.log(`Skills: ${skills.length} Platforms: ${platforms.join(', ')} Force: ${!!opts.force}\n`);
|
|
281
|
+
|
|
282
|
+
const vended = vendorSkills(target, skills, { force: !!opts.force });
|
|
283
|
+
writeManifest(target, skills);
|
|
284
|
+
const wrapped = writeWrappers(target, skills, platforms, { force: !!opts.force });
|
|
285
|
+
|
|
286
|
+
console.log(`✓ Vendored ${vended} skill dirs → ${join(relative(process.cwd(), target) || '.', 'skills/')}`);
|
|
287
|
+
console.log(`✓ Generated ${wrapped} adapter wrappers`);
|
|
288
|
+
console.log(`✓ Manifest → ${join(relative(process.cwd(), target) || '.', 'skills/skills.json')}`);
|
|
289
|
+
platforms.forEach(p => {
|
|
290
|
+
const dir = join(relative(process.cwd(), target) || '.', PLATFORMS[p].dir, 'skills/');
|
|
291
|
+
console.log(` • ${p.padEnd(10)} → ${dir}`);
|
|
292
|
+
});
|
|
293
|
+
console.log(`\nDone. Run 'npx mobileui-os list' to see skills.\n`);
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function getInstalledSkillNames(targetRoot) {
|
|
297
|
+
const dir = join(targetRoot, 'skills');
|
|
298
|
+
if (!existsSync(dir)) return [];
|
|
299
|
+
return readdirSync(dir, { withFileTypes: true }).filter(d => d.isDirectory() && existsSync(join(dir, d.name, 'SKILL.md'))).map(d => d.name);
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
function cmdAdd(opts) {
|
|
303
|
+
const skillName = opts._[0];
|
|
304
|
+
if (!skillName) {
|
|
305
|
+
console.error('Usage: npx mobileui-os add <skill> [dir] [--platforms ...]\nRun: npx mobileui-os list');
|
|
306
|
+
process.exit(1);
|
|
307
|
+
}
|
|
308
|
+
const targetDirArg = opts._[1];
|
|
309
|
+
const target = resolveTarget(targetDirArg);
|
|
310
|
+
const platforms = resolvePlatforms(opts);
|
|
311
|
+
const all = getSkills();
|
|
312
|
+
const skill = all.find(s => s.name === skillName);
|
|
313
|
+
if (!skill) {
|
|
314
|
+
console.error(`Skill not found: ${skillName}\nAvailable: ${all.map(s => s.name).join(', ')}`);
|
|
315
|
+
process.exit(1);
|
|
316
|
+
}
|
|
317
|
+
console.log(`\nInstalling ${skill.name} → ${relative(process.cwd(), target) || '.'} [${platforms.join(', ')}]\n`);
|
|
318
|
+
// vendor only the requested skill (preserves existing vendored skills)
|
|
319
|
+
vendorSkills(target, [skill], { force: !!opts.force });
|
|
320
|
+
// rebuild manifest from actually installed skills on disk
|
|
321
|
+
const installedNames = getInstalledSkillNames(target);
|
|
322
|
+
const installedSkills = all.filter(s => installedNames.includes(s.name));
|
|
323
|
+
// fallback: if scan misses (e.g. fresh install), use the single skill
|
|
324
|
+
const manifestSkills = installedSkills.length ? installedSkills : [skill];
|
|
325
|
+
writeManifest(target, manifestSkills);
|
|
326
|
+
const wrapped = writeWrappers(target, [skill], platforms, { force: !!opts.force });
|
|
327
|
+
console.log(`✓ Skill ${skill.name} installed`);
|
|
328
|
+
console.log(`✓ Wrappers: ${wrapped}`);
|
|
329
|
+
console.log(`✓ Manifest updated → ${join(relative(process.cwd(), target) || '.', 'skills/skills.json')} (${manifestSkills.length} skills)\n`);
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
// ── main
|
|
333
|
+
const { cmd, opts } = parseArgs(process.argv);
|
|
334
|
+
|
|
335
|
+
if (opts.version) {
|
|
336
|
+
console.log(PKG.version || '1.0.0');
|
|
337
|
+
process.exit(0);
|
|
338
|
+
}
|
|
339
|
+
if (opts.help || opts.unknown) {
|
|
340
|
+
if (opts.unknown) console.error(`Unknown option: ${opts.unknown}\n`);
|
|
341
|
+
printHelp();
|
|
342
|
+
process.exit(opts.unknown ? 1 : 0);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
switch (cmd) {
|
|
346
|
+
case 'list':
|
|
347
|
+
case 'ls':
|
|
348
|
+
cmdList(opts);
|
|
349
|
+
break;
|
|
350
|
+
case 'init':
|
|
351
|
+
cmdInit(opts);
|
|
352
|
+
break;
|
|
353
|
+
case 'add':
|
|
354
|
+
cmdAdd(opts);
|
|
355
|
+
break;
|
|
356
|
+
case null:
|
|
357
|
+
case undefined:
|
|
358
|
+
// no command: if TTY, run init interactively; else help
|
|
359
|
+
if (process.stdout.isTTY && process.stdin.isTTY) {
|
|
360
|
+
// default to init with all platforms
|
|
361
|
+
cmdInit(opts);
|
|
362
|
+
} else {
|
|
363
|
+
printHelp();
|
|
364
|
+
}
|
|
365
|
+
break;
|
|
366
|
+
case '--help':
|
|
367
|
+
case '-h':
|
|
368
|
+
case 'help':
|
|
369
|
+
printHelp();
|
|
370
|
+
break;
|
|
371
|
+
default:
|
|
372
|
+
console.error(`Unknown command: ${cmd}\n`);
|
|
373
|
+
printHelp();
|
|
374
|
+
process.exit(1);
|
|
375
|
+
}
|