omp-designer 2.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 +131 -0
- package/architecture.md +102 -0
- package/data/ui-ux-pro-max/app-interface.csv +31 -0
- package/data/ui-ux-pro-max/charts.csv +26 -0
- package/data/ui-ux-pro-max/colors.csv +162 -0
- package/data/ui-ux-pro-max/design.csv +1776 -0
- package/data/ui-ux-pro-max/draft.csv +1779 -0
- package/data/ui-ux-pro-max/google-fonts.csv +1924 -0
- package/data/ui-ux-pro-max/icons.csv +106 -0
- package/data/ui-ux-pro-max/landing.csv +35 -0
- package/data/ui-ux-pro-max/products.csv +162 -0
- package/data/ui-ux-pro-max/react-performance.csv +45 -0
- package/data/ui-ux-pro-max/stacks/angular.csv +51 -0
- package/data/ui-ux-pro-max/stacks/astro.csv +54 -0
- package/data/ui-ux-pro-max/stacks/flutter.csv +53 -0
- package/data/ui-ux-pro-max/stacks/html-tailwind.csv +56 -0
- package/data/ui-ux-pro-max/stacks/jetpack-compose.csv +53 -0
- package/data/ui-ux-pro-max/stacks/laravel.csv +51 -0
- package/data/ui-ux-pro-max/stacks/nextjs.csv +53 -0
- package/data/ui-ux-pro-max/stacks/nuxt-ui.csv +51 -0
- package/data/ui-ux-pro-max/stacks/nuxtjs.csv +59 -0
- package/data/ui-ux-pro-max/stacks/react-native.csv +52 -0
- package/data/ui-ux-pro-max/stacks/react.csv +54 -0
- package/data/ui-ux-pro-max/stacks/shadcn.csv +61 -0
- package/data/ui-ux-pro-max/stacks/svelte.csv +54 -0
- package/data/ui-ux-pro-max/stacks/swiftui.csv +51 -0
- package/data/ui-ux-pro-max/stacks/threejs.csv +54 -0
- package/data/ui-ux-pro-max/stacks/vue.csv +50 -0
- package/data/ui-ux-pro-max/styles.csv +85 -0
- package/data/ui-ux-pro-max/typography.csv +74 -0
- package/data/ui-ux-pro-max/ui-reasoning.csv +162 -0
- package/data/ui-ux-pro-max/ux-guidelines.csv +100 -0
- package/docs/config.yml.example +24 -0
- package/docs/extension-api.md +93 -0
- package/docs/mcp-setup.md +76 -0
- package/docs/mcp.json.example +37 -0
- package/docs/problems.md +97 -0
- package/extensions/designer.ts +186 -0
- package/package.json +41 -0
- package/skills/animate.md +219 -0
- package/skills/designer-master.md +179 -0
- package/skills/review-skill.md +50 -0
- package/skills/taste-skill.md +981 -0
- package/skills/ui-ux-pro-max.md +50 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
symbolPreset: ascii
|
|
2
|
+
theme:
|
|
3
|
+
dark: titanium
|
|
4
|
+
light: light
|
|
5
|
+
setupVersion: 1
|
|
6
|
+
modelRoles:
|
|
7
|
+
default: opencode-go/deepseek-v4-flash:xhigh
|
|
8
|
+
advisor: opencode-go/deepseek-v4-flash:high
|
|
9
|
+
smol: opencode-go/deepseek-v4-flash:xhigh
|
|
10
|
+
colorBlindMode: false
|
|
11
|
+
display:
|
|
12
|
+
showTokenUsage: true
|
|
13
|
+
steeringMode: one-at-a-time
|
|
14
|
+
compaction:
|
|
15
|
+
enabled: false
|
|
16
|
+
autolearn:
|
|
17
|
+
enabled: false
|
|
18
|
+
edit:
|
|
19
|
+
mode: hashline
|
|
20
|
+
bash:
|
|
21
|
+
autoBackground:
|
|
22
|
+
enabled: false
|
|
23
|
+
checkpoint:
|
|
24
|
+
enabled: true
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# omp Extension API Rules
|
|
2
|
+
|
|
3
|
+
## The Factory Function Rule (CRITICAL)
|
|
4
|
+
|
|
5
|
+
omp extensions MUST export a factory function — a plain object will crash:
|
|
6
|
+
|
|
7
|
+
```typescript
|
|
8
|
+
// ✅ CORRECT:
|
|
9
|
+
export default function (pi: any) {
|
|
10
|
+
pi.registerCommand("designer", { ... });
|
|
11
|
+
pi.on("resources_discover", () => { ... });
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// ❌ WRONG — crashes with "not a valid factory function":
|
|
15
|
+
export default {
|
|
16
|
+
commands: new Map([["designer", { ... }]]),
|
|
17
|
+
handlers: new Map([["resources_discover", [...]]]),
|
|
18
|
+
};
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## The `return {}` Rule (CRITICAL)
|
|
22
|
+
|
|
23
|
+
Handlers that should return nothing MUST return `undefined` (no return or `return;`).
|
|
24
|
+
Returning `{}` will crash:
|
|
25
|
+
|
|
26
|
+
```typescript
|
|
27
|
+
// ✅ CORRECT (mode OFF):
|
|
28
|
+
pi.on("resources_discover", () => {
|
|
29
|
+
if (!isOn()) return; // ← undefined, fine
|
|
30
|
+
return { skillPaths: [...] };
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// ❌ WRONG — will crash somewhere in omp internals:
|
|
34
|
+
pi.on("resources_discover", () => {
|
|
35
|
+
if (!isOn()) return {}; // ← EXPLODES
|
|
36
|
+
});
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## The `message` vs `systemPrompt` Rule (CRITICAL)
|
|
40
|
+
|
|
41
|
+
In `before_agent_start`, NEVER use `message` — it crashes with
|
|
42
|
+
`h.content is undefined`. Always use `systemPrompt`:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// ✅ CORRECT:
|
|
46
|
+
pi.on("before_agent_start", (event: any) => {
|
|
47
|
+
if (!isOn()) return;
|
|
48
|
+
const existing = event?.systemPrompt;
|
|
49
|
+
const prompts = Array.isArray(existing) ? existing : existing ? [existing] : [];
|
|
50
|
+
return { systemPrompt: [...prompts, MY_PROMPT] };
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
// ❌ WRONG — crashes:
|
|
54
|
+
pi.on("before_agent_start", () => {
|
|
55
|
+
return { message: "some text" };
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Available Events
|
|
60
|
+
|
|
61
|
+
| Event | Returns | Purpose |
|
|
62
|
+
|-------|---------|---------|
|
|
63
|
+
| `resources_discover` | `{ skillPaths: string[] } \| undefined` | Inject skills into context |
|
|
64
|
+
| `before_agent_start` | `{ systemPrompt: string[], message?: any } \| undefined` | Modify system prompt |
|
|
65
|
+
| `context` | Modified messages array | Alter conversation before sending |
|
|
66
|
+
| `tool_result` | Modified tool result | Intercept/alter tool output |
|
|
67
|
+
| `input` | Modified text/image input | Alter user input before processing |
|
|
68
|
+
|
|
69
|
+
## Available Commands (registerCommand)
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
pi.registerCommand("command-name", {
|
|
73
|
+
description: "what it does",
|
|
74
|
+
aliases: ["alt-name"],
|
|
75
|
+
handler: (args: any, ctx: any) => {
|
|
76
|
+
ctx?.ui?.notify?.("message", "info");
|
|
77
|
+
ctx?.editor?.setText?.("");
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Available API Methods (`pi`)
|
|
83
|
+
|
|
84
|
+
| Method | Purpose |
|
|
85
|
+
|--------|---------|
|
|
86
|
+
| `pi.registerCommand(name, opts)` | Register slash command |
|
|
87
|
+
| `pi.on(event, callback)` | Register event handler |
|
|
88
|
+
| `pi.registerTool(tool)` | Register a custom tool |
|
|
89
|
+
| `pi.registerShortcut(key, opts)` | Register keyboard shortcut |
|
|
90
|
+
| `pi.registerFlag(name, opts)` | Register CLI flag |
|
|
91
|
+
| `pi.setModel(f)` | Change active model |
|
|
92
|
+
| `pi.getFlag(name)` | Get flag value |
|
|
93
|
+
| `pi.on(event, callback)` | Event listener |
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# MCP Server Setup
|
|
2
|
+
|
|
3
|
+
Configured in `~/.omp/agent/mcp.json`. Two MCP servers:
|
|
4
|
+
|
|
5
|
+
## 21st-dev-magic
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"21st-dev-magic": {
|
|
10
|
+
"command": "npx",
|
|
11
|
+
"args": ["-y", "@21st-dev/magic@latest"],
|
|
12
|
+
"env": { "API_KEY": "db28ed54db43b5bab1db3dfdda099b28e4242eaad4bb7d17c99a30c0c25673b3" }
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
**Tools:**
|
|
18
|
+
| Tool | Status | Use |
|
|
19
|
+
|------|--------|-----|
|
|
20
|
+
| `logo_search` | ✅ Works | SVG icons, brand graphics (named `logo_search`, NOT `21st_magic_logo_search`) |
|
|
21
|
+
| `21st_magic_component_inspiration` | ✅ Works | Component patterns, variants, code |
|
|
22
|
+
| `21st_magic_component_refiner` | ✅ Works | Refine existing components |
|
|
23
|
+
| `21st_magic_component_builder` | ❌ Timeout (30s) | NEVER call — blocked by prompt |
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
**API Key source:** From old Pi backup (`~/pi-backup/configs/mcp-servers.json`)
|
|
27
|
+
|
|
28
|
+
## chrome-devtools
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"chrome-devtools": {
|
|
33
|
+
"command": "npx",
|
|
34
|
+
"args": [
|
|
35
|
+
"-y", "chrome-devtools-mcp@latest",
|
|
36
|
+
"--isolated", "--headless",
|
|
37
|
+
"--no-usage-statistics", "--no-performance-crux",
|
|
38
|
+
"--executable-path", "/home/leandro/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome",
|
|
39
|
+
"--chrome-arg=--no-sandbox", "--chrome-arg=--disable-gpu",
|
|
40
|
+
"--chrome-arg=--disable-dev-shm-usage"
|
|
41
|
+
],
|
|
42
|
+
"env": {
|
|
43
|
+
"CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS": "1",
|
|
44
|
+
"CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS": "1"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Chrome Binary:** Puppeteer's bundled Chrome v149.0.7827.22 (641 MB)
|
|
51
|
+
at `~/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome`.
|
|
52
|
+
Leftover from the old Pi installation — no download needed.
|
|
53
|
+
|
|
54
|
+
**Headless:** Yes — runs without visible window. Configured via `--headless` flag.
|
|
55
|
+
|
|
56
|
+
**Tools used in designer mode:** navigate_page, take_screenshot, take_snapshot,
|
|
57
|
+
list_console_messages, evaluate_script, resize_page.
|
|
58
|
+
|
|
59
|
+
**Note:** Lighthouse audit on `localhost` often fails (needs public URL).
|
|
60
|
+
|
|
61
|
+
## MCP Discovery
|
|
62
|
+
|
|
63
|
+
omp discovers MCP servers from:
|
|
64
|
+
- `{cwd}/.omp/mcp.json` (project)
|
|
65
|
+
- `{cwd}/.omp/.mcp.json` (project)
|
|
66
|
+
- `~/.omp/mcp.json` (user)
|
|
67
|
+
- `~/.omp/.mcp.json` (user)
|
|
68
|
+
- `~/.omp/agent/mcp.json` (user — current location)
|
|
69
|
+
|
|
70
|
+
Current config stored at `~/.omp/agent/mcp.json` (added `/mcp add` created this path).
|
|
71
|
+
|
|
72
|
+
## MCP Visibility
|
|
73
|
+
|
|
74
|
+
Both MCP servers are ALWAYS running (configured in mcp.json).
|
|
75
|
+
But the agent only KNOWS about them when Designer Mode is ON (via PROMPT_INJECT).
|
|
76
|
+
This mimics the "only visible when /designer is ON" behavior.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://raw.githubusercontent.com/can1357/oh-my-pi/main/packages/coding-agent/src/config/mcp-schema.json",
|
|
3
|
+
"mcpServers": {
|
|
4
|
+
"21st-dev-magic": {
|
|
5
|
+
"type": "stdio",
|
|
6
|
+
"command": "npx",
|
|
7
|
+
"args": [
|
|
8
|
+
"-y",
|
|
9
|
+
"@21st-dev/magic@latest"
|
|
10
|
+
],
|
|
11
|
+
"env": {
|
|
12
|
+
"API_KEY": "db28ed54db43b5bab1db3dfdda099b28e4242eaad4bb7d17c99a30c0c25673b3"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"chrome-devtools": {
|
|
16
|
+
"type": "stdio",
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": [
|
|
19
|
+
"-y",
|
|
20
|
+
"chrome-devtools-mcp@latest",
|
|
21
|
+
"--isolated",
|
|
22
|
+
"--headless",
|
|
23
|
+
"--no-usage-statistics",
|
|
24
|
+
"--no-performance-crux",
|
|
25
|
+
"--executable-path",
|
|
26
|
+
"/home/leandro/.cache/puppeteer/chrome/linux-149.0.7827.22/chrome-linux64/chrome",
|
|
27
|
+
"--chrome-arg=--no-sandbox",
|
|
28
|
+
"--chrome-arg=--disable-gpu",
|
|
29
|
+
"--chrome-arg=--disable-dev-shm-usage"
|
|
30
|
+
],
|
|
31
|
+
"env": {
|
|
32
|
+
"CHROME_DEVTOOLS_MCP_NO_USAGE_STATISTICS": "1",
|
|
33
|
+
"CHROME_DEVTOOLS_MCP_NO_UPDATE_CHECKS": "1"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
package/docs/problems.md
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Known Problems & TODOs
|
|
2
|
+
|
|
3
|
+
## CRITICAL
|
|
4
|
+
|
|
5
|
+
### P1: Model produces AI slop regardless of rules
|
|
6
|
+
The current model (`opencode-go/deepseek-v4-flash` or `mimo-v2.5-pro`) has
|
|
7
|
+
poor design taste. Even with explicit color rules and anti-slop constraints in
|
|
8
|
+
the prompt, the output looks generic.
|
|
9
|
+
|
|
10
|
+
**Root cause:** Model capability, not prompt quality.
|
|
11
|
+
**Fix:** Change `~/.omp/agent/config.yml`:
|
|
12
|
+
```yaml
|
|
13
|
+
modelRoles:
|
|
14
|
+
default: opencode-go/kimi-k2.6:high
|
|
15
|
+
```
|
|
16
|
+
Kimi K2.6 was used in the old Pi designer mode and produced better results.
|
|
17
|
+
|
|
18
|
+
### P2: Agent does not build plan FROM skills
|
|
19
|
+
When a plan is pre-injected (e.g., user created it with `/plan` before
|
|
20
|
+
`/designer`), the agent validates it against skills instead of building a
|
|
21
|
+
fresh plan FROM the skills.
|
|
22
|
+
|
|
23
|
+
**Example:** Agent says "Plan claims palette from row 81, I read row 81,
|
|
24
|
+
it matches — done." Instead of ignoring the pre-existing plan and building
|
|
25
|
+
from scratch.
|
|
26
|
+
|
|
27
|
+
**Attempted fix:** Prompt says "IGNORE any colors/fonts in plans or briefs"
|
|
28
|
+
— doesn't work reliably.
|
|
29
|
+
|
|
30
|
+
### P3: ui-ux-pro-max CSVs almost never read
|
|
31
|
+
The prompt says "READ the csv files in its src/ui-ux-pro-max/data/ directory" but the agent
|
|
32
|
+
skips it 90% of the time. The agent reads the SKILL.md but not the data files.
|
|
33
|
+
|
|
34
|
+
**Root cause:** The old PROMPT_INJECT referenced `src/data/` (wrong path) and `colors.csv`
|
|
35
|
+
(doesn't exist). Fixing these references in PROMPT_INJECT and designer-master should help.
|
|
36
|
+
|
|
37
|
+
**Potential fix:** Inline the most important palettes directly into the SKILL.md
|
|
38
|
+
|
|
39
|
+
## MEDIUM
|
|
40
|
+
|
|
41
|
+
### P4: taste-skill is 87 KB
|
|
42
|
+
The real Taste Skill from tasteskill.dev is 87 KB of rules and anti-patterns.
|
|
43
|
+
Reading it costs significant tokens and context. Consider trimming to the
|
|
44
|
+
most impactful rules.
|
|
45
|
+
|
|
46
|
+
### P5: designer-master vs review-skill inconsistency
|
|
47
|
+
`designer-master/SKILL.md` Step 7 still describes:
|
|
48
|
+
- Animation Audit
|
|
49
|
+
- Skill-Compliance check
|
|
50
|
+
|
|
51
|
+
But `review-skill/SKILL.md` was simplified to:
|
|
52
|
+
- Build test, Console, A11y, Color hex audit only.
|
|
53
|
+
|
|
54
|
+
These need to be reconciled — either add animation/skill checks back to
|
|
55
|
+
review-skill, or update designer-master to match.
|
|
56
|
+
|
|
57
|
+
### P6: review skill animation audit removed
|
|
58
|
+
Was removed because it overloaded the agent. But the user WANTS animation
|
|
59
|
+
quality checked. Needs re-adding in a simpler form.
|
|
60
|
+
|
|
61
|
+
## LOW
|
|
62
|
+
|
|
63
|
+
### P7: No subagents
|
|
64
|
+
The old Pi had architect/implementer/reviewer team profiles (backed up at
|
|
65
|
+
`~/pi-backup/team-profiles/`). These were never migrated to omp.
|
|
66
|
+
|
|
67
|
+
### P8: chrome-devtools MCP sometimes doesn't connect
|
|
68
|
+
The review step may fail if the dev server port isn't correctly detected,
|
|
69
|
+
or if Chrome isn't ready. The agent should handle this gracefully.
|
|
70
|
+
|
|
71
|
+
### P9: 21st-dev component_builder timeouts
|
|
72
|
+
|
|
73
|
+
### P10: 21st-dev tool name mismatch
|
|
74
|
+
All docs reference `21st_magic_logo_search` but the actual tool is named `logo_search`.
|
|
75
|
+
Also `21st_magic_component_refiner` exists but is undocumented.
|
|
76
|
+
|
|
77
|
+
**Fix applied:** Updated PROMPT_INJECT, designer-master skill, and all doc files.
|
|
78
|
+
|
|
79
|
+
### P11: SVGs/icons not automatically found
|
|
80
|
+
The 21st-dev MCP tools need `search_tool_bm25` to be activated — they aren't
|
|
81
|
+
automatically available. The agent must explicitly discover them. Consider adding
|
|
82
|
+
|
|
83
|
+
## DONE (recent fixes)
|
|
84
|
+
|
|
85
|
+
- [x] SKILL_PATHS had wrong path: `emil-skill/` → `animate/`
|
|
86
|
+
- [x] Taste-skill was fake `taste-ink-skill` (API connector) → replaced with
|
|
87
|
+
real Taste Skill from `Leonxlnx/taste-skill` (87 KB anti-slop framework)
|
|
88
|
+
- [x] Color rule was too permissive ("one primary, one secondary max" →
|
|
89
|
+
agent used 3 accents). Changed to "ONE accent color only."
|
|
90
|
+
- [x] review-skill was too large (150+ lines, animation/style audits) →
|
|
91
|
+
simplified to functional checks only (41 lines)
|
|
92
|
+
- [x] Extension used wrong export format (`export default { ... }`) →
|
|
93
|
+
changed to factory function (`export default function(pi)`)
|
|
94
|
+
- [x] `before_agent_start` used `message` → crashed. Changed to `systemPrompt`
|
|
95
|
+
- [x] `return {}` caused crashes → changed to `return;`
|
|
96
|
+
- [x] YAML frontmatter parse errors in taste-skill → quoted description + tools
|
|
97
|
+
- [x] chrome-devtools MCP added (headless, existing Chrome binary from Puppeteer cache)
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Designer Mode v2 Extension for Pi (pi.dev)
|
|
3
|
+
*
|
|
4
|
+
* Adds /designer toggle command.
|
|
5
|
+
* When ON: injects design workflow system prompt + CSV data path.
|
|
6
|
+
* Skills are auto-discovered by Pi from the skills/ directory.
|
|
7
|
+
* MCPs: 21st-dev, chrome-devtools, ui-layouts, designmd.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
11
|
+
import { homedir } from "node:os";
|
|
12
|
+
import { join, dirname } from "node:path";
|
|
13
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "node:fs";
|
|
14
|
+
import { fileURLToPath } from "node:url";
|
|
15
|
+
|
|
16
|
+
// ── Paths ──────────────────────────────────────────────────────────────
|
|
17
|
+
|
|
18
|
+
const HOME = homedir();
|
|
19
|
+
const AGENT_DIR = join(HOME, ".pi", "agent");
|
|
20
|
+
const STATE_FILE = join(AGENT_DIR, "designer-state.json");
|
|
21
|
+
const MCP_CONFIG = join(AGENT_DIR, "mcp.json");
|
|
22
|
+
|
|
23
|
+
// ── MCP server names managed by designer mode ──────────────────────────
|
|
24
|
+
|
|
25
|
+
const DESIGNER_MCP_NAMES: Record<string, true> = {
|
|
26
|
+
"21st-dev-magic": true,
|
|
27
|
+
"chrome-devtools": true,
|
|
28
|
+
"ui-layouts": true,
|
|
29
|
+
"designmd": true,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// ── State ──────────────────────────────────────────────────────────────
|
|
33
|
+
|
|
34
|
+
interface DesignerState {
|
|
35
|
+
enabled: boolean;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
function readState(): DesignerState {
|
|
39
|
+
try {
|
|
40
|
+
if (existsSync(STATE_FILE)) {
|
|
41
|
+
const raw = JSON.parse(readFileSync(STATE_FILE, "utf-8")) as unknown;
|
|
42
|
+
if (raw && typeof raw === "object" && "enabled" in raw) {
|
|
43
|
+
return { enabled: (raw as Record<string, unknown>).enabled === true };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
} catch { /* corrupt → disabled */ }
|
|
47
|
+
return { enabled: false };
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function isOn(): boolean {
|
|
51
|
+
return readState().enabled;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
function setEnabled(v: boolean): void {
|
|
55
|
+
mkdirSync(AGENT_DIR, { recursive: true });
|
|
56
|
+
writeFileSync(STATE_FILE, JSON.stringify({ enabled: v }));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// ── MCP config management ──────────────────────────────────────────────
|
|
60
|
+
|
|
61
|
+
function setDesignerMcpEnabled(enabled: boolean): void {
|
|
62
|
+
try {
|
|
63
|
+
if (!existsSync(MCP_CONFIG)) return;
|
|
64
|
+
const raw = readFileSync(MCP_CONFIG, "utf-8");
|
|
65
|
+
const config = JSON.parse(raw) as Record<string, unknown>;
|
|
66
|
+
|
|
67
|
+
if (!config || typeof config !== "object") return;
|
|
68
|
+
const servers = config.mcpServers as Record<string, Record<string, unknown>> | undefined;
|
|
69
|
+
if (!servers || typeof servers !== "object") return;
|
|
70
|
+
|
|
71
|
+
let changed = false;
|
|
72
|
+
for (const [name, server] of Object.entries(servers)) {
|
|
73
|
+
if (name in DESIGNER_MCP_NAMES && server && typeof server === "object") {
|
|
74
|
+
if (server.enabled !== enabled) {
|
|
75
|
+
server.enabled = enabled;
|
|
76
|
+
changed = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (changed) {
|
|
82
|
+
writeFileSync(MCP_CONFIG, JSON.stringify(config, null, 2) + "\n");
|
|
83
|
+
}
|
|
84
|
+
} catch { /* mcp.json broken/missing — no crash */ }
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function syncMcpConfigOnStartup(): void {
|
|
88
|
+
setDesignerMcpEnabled(isOn());
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// ── System prompt injection ────────────────────────────────────────────
|
|
92
|
+
|
|
93
|
+
/** Resolved at module load time from the extension's location. */
|
|
94
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
95
|
+
const __dirname = dirname(__filename);
|
|
96
|
+
// Package root is the parent of extensions/
|
|
97
|
+
const PACKAGE_ROOT = join(__dirname, "..");
|
|
98
|
+
const CSV_DATA_ROOT = join(PACKAGE_ROOT, "data", "ui-ux-pro-max");
|
|
99
|
+
|
|
100
|
+
function buildPrompt(): string {
|
|
101
|
+
return `
|
|
102
|
+
|
|
103
|
+
[DESIGNER MODE v2: ACTIVE]
|
|
104
|
+
|
|
105
|
+
⚠️ CRITICAL: Context rules — read before anything else.
|
|
106
|
+
|
|
107
|
+
- **This mode stays ON for the entire project.** Never switch to plan-mode or read-only mode.
|
|
108
|
+
Designer mode preserves context because before_agent_start re-injects this prompt every turn.
|
|
109
|
+
- **Auto-detect new projects.** User describes a new site/app → follow the 8-step workflow.
|
|
110
|
+
"Small change" = modify an existing component, fix a bug, adjust a value, rename something.
|
|
111
|
+
"New project" = any request for a site, page, section, or component that doesn't exist yet.
|
|
112
|
+
- **Subagents have NO designer context.** They get a fresh system prompt with zero skills.
|
|
113
|
+
Pass EVERY design token (colors, fonts, spacing, animation) explicitly in their context.
|
|
114
|
+
- **Plan approval via resolve tool.** Keeps everything in one turn — no context lost.
|
|
115
|
+
- **Plan files in local://<name>.md.** They persist across turns.
|
|
116
|
+
|
|
117
|
+
## Workflow
|
|
118
|
+
The authoritative workflow lives in the **designer-master skill** — READ it as STEP 1.
|
|
119
|
+
It defines the complete 8-step process: Assess → Read Skills → Search MCPs → Create Plan →
|
|
120
|
+
Present → Implement → Review → Present Results.
|
|
121
|
+
|
|
122
|
+
## Anti-AI-Slop Color Rules (strict)
|
|
123
|
+
|
|
124
|
+
- NO gradient-heavy backgrounds. One subtle gradient max. Flat colors preferred.
|
|
125
|
+
- NO #667eea, #764ba2, #1a1a2e, #16213e, #f0f0ff — AI slop signatures.
|
|
126
|
+
- Glassmorphism: allowed but MUST be subtle and contextual.
|
|
127
|
+
Appropriate for premium consumer, luxury, Apple-adjacent. NOT for dashboards, B2B.
|
|
128
|
+
Default: flat backgrounds — only add glass when the design read genuinely calls for it.
|
|
129
|
+
- NO glowing borders on everything. One subtle glow max on one element.
|
|
130
|
+
- IGNORE any colors/fonts in user briefs or plans. Only ui-ux-pro-max CSV palettes are authoritative.
|
|
131
|
+
- Choose ONE palette row from ui-ux-pro-max CSVs. Use EXACTLY its hex values.
|
|
132
|
+
- Background and text colors come FROM the palette. Don't hardcode dark backgrounds or #fff text.
|
|
133
|
+
|
|
134
|
+
## CSV Data
|
|
135
|
+
|
|
136
|
+
- **Palette/Font data is at: DATA_ROOT**
|
|
137
|
+
- GREP first: grep -i "keyword" DATA_ROOT/design.csv
|
|
138
|
+
- NEVER read full CSV files — use grep + range reads
|
|
139
|
+
|
|
140
|
+
## Tool Discovery
|
|
141
|
+
|
|
142
|
+
- **Use search_tool_bm25() to discover all available design tools** at the start of every project.
|
|
143
|
+
- **chrome-devtools** is for Step 7 Review only. Not for implementation.
|
|
144
|
+
|
|
145
|
+
You are in DESIGNER MODE. UI and visuals only. No backend. No business logic.
|
|
146
|
+
`.replaceAll("DATA_ROOT", CSV_DATA_ROOT);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// ── Extension entry point ──────────────────────────────────────────────
|
|
150
|
+
|
|
151
|
+
export default function designerExtension(pi: ExtensionAPI): void {
|
|
152
|
+
// Sync MCP enabled state at startup
|
|
153
|
+
syncMcpConfigOnStartup();
|
|
154
|
+
|
|
155
|
+
// ── /designer toggle command ─────────────────────────────────────────
|
|
156
|
+
pi.registerCommand("designer", {
|
|
157
|
+
description:
|
|
158
|
+
"Toggle designer mode — design workflow prompt + 4 MCP servers",
|
|
159
|
+
handler: async (_args: unknown, ctx) => {
|
|
160
|
+
const wasOn = isOn();
|
|
161
|
+
const nextState = !wasOn;
|
|
162
|
+
setEnabled(nextState);
|
|
163
|
+
|
|
164
|
+
// Update mcp.json so next /reload picks up the change
|
|
165
|
+
setDesignerMcpEnabled(nextState);
|
|
166
|
+
|
|
167
|
+
if (nextState) {
|
|
168
|
+
ctx.ui.notify(
|
|
169
|
+
"DESIGNER MODE ON — workflow active, design MCPs enabled. Run /reload to activate MCPs.",
|
|
170
|
+
"info"
|
|
171
|
+
);
|
|
172
|
+
} else {
|
|
173
|
+
ctx.ui.notify(
|
|
174
|
+
"DESIGNER MODE OFF — workflow hidden, MCPs disabled. Run /reload to deactivate MCPs.",
|
|
175
|
+
"info"
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
});
|
|
180
|
+
// ── Inject system prompt ONLY when designer mode is ON ────────────────
|
|
181
|
+
pi.on("before_agent_start", (event, ctx) => {
|
|
182
|
+
if (!isOn()) return;
|
|
183
|
+
const currentPrompt = event.systemPrompt ?? ctx.getSystemPrompt?.() ?? "";
|
|
184
|
+
return { systemPrompt: currentPrompt + buildPrompt() };
|
|
185
|
+
});
|
|
186
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "omp-designer",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Designer Mode for Pi — toggleable UI/UX design workflow with 5 specialized skills, 161 color palettes, 57 font pairings, and 4 MCP integrations",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi",
|
|
9
|
+
"design",
|
|
10
|
+
"ui",
|
|
11
|
+
"ux",
|
|
12
|
+
"design-system",
|
|
13
|
+
"animation",
|
|
14
|
+
"frontend",
|
|
15
|
+
"color-palette",
|
|
16
|
+
"typography",
|
|
17
|
+
"anti-slop"
|
|
18
|
+
],
|
|
19
|
+
"author": "Leandro",
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"repository": {
|
|
22
|
+
"url": "git+https://github.com/LePro10/omp-designer.git"
|
|
23
|
+
},
|
|
24
|
+
"pi": {
|
|
25
|
+
"extensions": ["./extensions"],
|
|
26
|
+
"skills": ["./skills"],
|
|
27
|
+
"image": "https://pi.dev/logo-auto.svg"
|
|
28
|
+
},
|
|
29
|
+
"omp": {
|
|
30
|
+
"extensions": ["./extension/index.ts"]
|
|
31
|
+
},
|
|
32
|
+
"files": [
|
|
33
|
+
"extensions/",
|
|
34
|
+
"skills/",
|
|
35
|
+
"data/",
|
|
36
|
+
"docs/",
|
|
37
|
+
"AGENTS.md",
|
|
38
|
+
"architecture.md",
|
|
39
|
+
"package.json"
|
|
40
|
+
]
|
|
41
|
+
}
|