@ammduncan/easel 0.2.2 → 0.2.5

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 CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to easel. This project adheres to [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## 0.2.5 — 2026-05-22
6
+
7
+ ### Added
8
+ - **Codex client support: `easel setup --client codex`.** Writes the MCP entry into `~/.codex/config.toml` under `[mcp_servers.easel]` and copies the `using-easel` skill into `~/.codex/skills/using-easel/SKILL.md` so Codex agents have the full style guide in addition to the tool description. Line-based TOML upsert preserves other sections and comments.
9
+
10
+ ### Fixed
11
+ - **`easel setup --help` no longer silently runs the destructive Claude Code setup.** Previously, the `--help` flag fell through the `--client` check and reached `cmdSetup()`, which writes to `~/.claude/settings.json`. Now a dedicated help branch fires before any side effects. Includes a manual-install JSON snippet for clients beyond the four officially supported ones.
12
+
13
+ ## 0.2.4 — 2026-05-22
14
+
15
+ ### Fixed
16
+ - **Pushes from non-Claude-Code clients (Claude Desktop, Cursor, Windsurf, etc.) ignored the easel style guide.** The full guide lives in the `using-easel` skill — but skills are a Claude Code feature; other MCP clients never see them. The MCP `push` tool's description only said "Pass full HTML" and contained none of the styling rules, so agents in non-CC clients hardcoded one mode's colors. Result: lede text colored `#475569` went invisible in dark mode, hardcoded `#e5e5e5` borders became hard white lines, mockups crammed into half-width columns, etc.
17
+ - The `push` tool description now carries the essentials inline: adaptive-color rules (`light-dark()` + `color: inherit` re-scoping + locked-mode container inverse rule), a copy-paste starter pattern, presentation-scale typography, whitespace, tangible-visual heuristics, vertical stacking of desktop mockups, and the proactive-push convention. Every MCP client surfaces tool descriptions to its agent, so this lands cross-client.
18
+
19
+ ## 0.2.3 — 2026-05-22
20
+
21
+ ### Fixed
22
+ - **Every push was being delivered twice.** The auto-run guard in `dist/mcp.js` had a sloppy fallback (`endsWith("/dist/mcp.js")`) that matched even when the file was imported, not just when it was invoked directly. Result: when the CLI's no-TTY path dynamically imported `mcp.js`, the guard fired AND the CLI explicitly called `main()`, so two MCP servers ran in the same process attached to the same stdin. Every tool call was processed twice. Guard now uses strict equality only.
23
+ - **Sessions index — trash icon overlapped the count/timestamp on short rows.** The hover-revealed delete button was absolutely positioned and collided with the right-column text whenever the row was tight. Promoted to its own grid column so it sits cleanly to the right of the count/when stack regardless of row height.
24
+
5
25
  ## 0.2.2 — 2026-05-22
6
26
 
7
27
  ### Fixed
package/dist/cli.js CHANGED
@@ -23,10 +23,11 @@ Usage:
23
23
  easel config preset paper set preset to paper | aurora | slate
24
24
  easel config theme dark set theme to light | dark
25
25
  easel config preset aurora theme light set both at once
26
- easel setup install Claude Code hook + register MCP in ~/.claude/settings.json
27
- easel setup --client cursor register the MCP in Cursor's config
28
- easel setup --client claude-desktop register the MCP in Claude Desktop's config
29
- easel setup --client windsurf register the MCP in Windsurf's config
26
+ easel setup install Claude Code hook + register MCP in ~/.claude/settings.json
27
+ easel setup --client cursor register MCP in ~/.cursor/mcp.json
28
+ easel setup --client claude-desktop register MCP in ~/Library/Application Support/Claude/claude_desktop_config.json
29
+ easel setup --client windsurf register MCP in ~/.codeium/windsurf/mcp_config.json
30
+ easel setup --client codex register MCP in ~/.codex/config.toml + copy skill to ~/.codex/skills/
30
31
  easel update git pull + npm install + build + setup (re-runs setup to apply new conventions)
31
32
  easel mcp run the stdio MCP server in the foreground (used by clients)
32
33
  easel restart kill the running HTTP server and respawn it (picks up new builds/paths)
@@ -336,6 +337,24 @@ async function main() {
336
337
  await cmdUrl();
337
338
  return;
338
339
  case "setup": {
340
+ // Catch --help BEFORE doing anything destructive. The default
341
+ // cmdSetup() writes to ~/.claude/settings.json, so an unguarded
342
+ // `easel setup --help` would silently reconfigure Claude Code.
343
+ if (rest.includes("--help") || rest.includes("-h") || rest[0] === "help") {
344
+ console.log([
345
+ "easel setup — install easel into one of the supported MCP clients.",
346
+ "",
347
+ "Usage:",
348
+ " easel setup Claude Code (default): MCP + SessionStart hook + skill",
349
+ " easel setup --client <name> register MCP in another client",
350
+ "",
351
+ `Available clients: ${listClients().join(", ")}`,
352
+ "",
353
+ "Manual install (any other MCP client): drop this into the client's MCP config —",
354
+ ' { "mcpServers": { "easel": { "command": "npx", "args": ["-y", "@ammduncan/easel"] } } }',
355
+ ].join("\n"));
356
+ return;
357
+ }
339
358
  const clientIdx = rest.indexOf("--client");
340
359
  if (clientIdx !== -1) {
341
360
  const name = rest[clientIdx + 1];
@@ -40,9 +40,9 @@
40
40
  .session-row {
41
41
  position: relative;
42
42
  display: grid;
43
- grid-template-columns: 1fr auto;
43
+ grid-template-columns: 1fr auto auto;
44
44
  gap: 18px;
45
- align-items: start;
45
+ align-items: center;
46
46
  padding: 20px 22px;
47
47
  background: var(--ds-surface);
48
48
  border: 1px solid var(--ds-line);
@@ -55,14 +55,11 @@
55
55
  }
56
56
 
57
57
  .session-del {
58
- position: absolute;
59
- top: 14px;
60
- right: 14px;
61
58
  display: inline-flex;
62
59
  align-items: center;
63
60
  justify-content: center;
64
- width: 22px;
65
- height: 22px;
61
+ width: 28px;
62
+ height: 28px;
66
63
  background: transparent;
67
64
  border: 0;
68
65
  border-radius: 6px;
@@ -70,8 +67,9 @@
70
67
  cursor: pointer;
71
68
  opacity: 0;
72
69
  transition: opacity 120ms ease, background 120ms ease, color 120ms ease;
70
+ align-self: center;
73
71
  }
74
- .session-row:hover .session-del { opacity: 0.6; }
72
+ .session-row:hover .session-del { opacity: 0.55; }
75
73
  .session-del:hover {
76
74
  background: var(--ds-surface-soft);
77
75
  color: var(--ds-danger);
@@ -178,7 +176,6 @@
178
176
  align-items: flex-end;
179
177
  gap: 6px;
180
178
  white-space: nowrap;
181
- padding-right: 34px;
182
179
  }
183
180
 
184
181
  .session-pushcount {
@@ -179,8 +179,10 @@
179
179
  when.textContent = relTime(session.lastActivity);
180
180
  right.appendChild(when);
181
181
 
182
- // Hover-revealed delete — placed inside the right column so it sits
183
- // above the count text in the reserved 22px slot.
182
+ a.appendChild(right);
183
+
184
+ // Hover-revealed delete — sits in its own grid column to the right of
185
+ // the count/when stack so it never overlaps the text on short rows.
184
186
  const del = document.createElement("button");
185
187
  del.className = "session-del";
186
188
  del.type = "button";
@@ -197,9 +199,7 @@
197
199
  });
198
200
  load();
199
201
  });
200
- right.appendChild(del);
201
-
202
- a.appendChild(right);
202
+ a.appendChild(del);
203
203
 
204
204
  return a;
205
205
  }
@@ -1,36 +1,39 @@
1
- import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
- import { dirname, join } from "node:path";
1
+ import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { dirname, join, resolve } from "node:path";
3
+ import { fileURLToPath } from "node:url";
3
4
  import { homedir, platform } from "node:os";
5
+ const __dirname = dirname(fileURLToPath(import.meta.url));
6
+ const PROJECT_ROOT = resolve(__dirname, "..");
4
7
  const CLIENTS = {
5
8
  "claude-desktop": {
6
9
  name: "claude-desktop",
7
10
  label: "Claude Desktop",
8
- configPath: () => {
9
- const home = homedir();
10
- if (platform() === "darwin") {
11
- return join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
12
- }
13
- if (platform() === "win32") {
14
- const appData = process.env.APPDATA ?? join(home, "AppData", "Roaming");
15
- return join(appData, "Claude", "claude_desktop_config.json");
16
- }
17
- return join(home, ".config", "Claude", "claude_desktop_config.json");
18
- },
11
+ run: () => upsertJsonMcpServer(claudeDesktopConfigPath()),
19
12
  postSetup: "Quit and relaunch Claude Desktop to load the MCP server.",
20
13
  },
21
14
  cursor: {
22
15
  name: "cursor",
23
16
  label: "Cursor",
24
- configPath: () => join(homedir(), ".cursor", "mcp.json"),
17
+ run: () => upsertJsonMcpServer(join(homedir(), ".cursor", "mcp.json")),
25
18
  postSetup: "Open Cursor and toggle MCP servers in Settings → Features → MCP, " +
26
19
  "or restart Cursor for the registration to take effect.",
27
20
  },
28
21
  windsurf: {
29
22
  name: "windsurf",
30
23
  label: "Windsurf",
31
- configPath: () => join(homedir(), ".codeium", "windsurf", "mcp_config.json"),
24
+ run: () => upsertJsonMcpServer(join(homedir(), ".codeium", "windsurf", "mcp_config.json")),
32
25
  postSetup: "Restart Windsurf to load the MCP server.",
33
26
  },
27
+ codex: {
28
+ name: "codex",
29
+ label: "Codex",
30
+ run: () => {
31
+ upsertTomlMcpServer(join(homedir(), ".codex", "config.toml"));
32
+ installEaselSkillTo(join(homedir(), ".codex", "skills", "using-easel"));
33
+ },
34
+ postSetup: "Restart Codex to load the MCP server. The using-easel skill has " +
35
+ "been copied to ~/.codex/skills/ so Codex will know when to push.",
36
+ },
34
37
  };
35
38
  export function listClients() {
36
39
  return Object.keys(CLIENTS);
@@ -40,7 +43,17 @@ export function setupClient(name) {
40
43
  if (!spec) {
41
44
  throw new Error(`unknown client: ${name}`);
42
45
  }
43
- const configPath = spec.configPath();
46
+ spec.run();
47
+ console.log(`[easel] ${spec.label} configured`);
48
+ console.log(` - ${spec.postSetup}`);
49
+ }
50
+ /**
51
+ * Installs the easel MCP entry into a JSON config file with the standard
52
+ * `mcpServers: { name: { command, args } }` shape — used by Claude Desktop,
53
+ * Cursor, Windsurf, and friends. Merges into any existing config; preserves
54
+ * sibling top-level keys and other registered MCP servers.
55
+ */
56
+ function upsertJsonMcpServer(configPath) {
44
57
  const config = readJson(configPath);
45
58
  const mcpServers = config.mcpServers ?? {};
46
59
  mcpServers.easel = {
@@ -50,9 +63,74 @@ export function setupClient(name) {
50
63
  config.mcpServers = mcpServers;
51
64
  mkdirSync(dirname(configPath), { recursive: true });
52
65
  writeFileSync(configPath, `${JSON.stringify(config, null, 2)}\n`);
53
- console.log(`[easel] ${spec.label} configured`);
54
66
  console.log(` - wrote ${configPath}`);
55
- console.log(` - ${spec.postSetup}`);
67
+ }
68
+ /**
69
+ * Installs the easel MCP entry into a TOML config file under the
70
+ * `[mcp_servers.easel]` section — used by Codex. Line-based upsert: replaces
71
+ * the existing `[mcp_servers.easel]` block in place if it's there, otherwise
72
+ * appends. Other sections and comments preserved.
73
+ */
74
+ function upsertTomlMcpServer(configPath) {
75
+ const newSection = "[mcp_servers.easel]\n" +
76
+ 'command = "npx"\n' +
77
+ 'args = ["-y", "@ammduncan/easel"]\n';
78
+ const existing = existsSync(configPath) ? readFileSync(configPath, "utf-8") : "";
79
+ const updated = upsertTomlSection(existing, "mcp_servers.easel", newSection);
80
+ mkdirSync(dirname(configPath), { recursive: true });
81
+ writeFileSync(configPath, updated);
82
+ console.log(` - wrote ${configPath}`);
83
+ }
84
+ /**
85
+ * Line-based TOML section upsert. Replaces an existing `[<header>]` block
86
+ * (defined as the lines from the header up to the next top-level `[...]`
87
+ * header or EOF) with `newBlock`; appends if no such block exists. Other
88
+ * sections are left untouched. Adequate for our narrow use case — not a
89
+ * general-purpose TOML editor.
90
+ */
91
+ function upsertTomlSection(content, header, newBlock) {
92
+ const targetHeader = `[${header}]`;
93
+ const lines = content.split("\n");
94
+ let startIdx = -1;
95
+ let endIdx = lines.length;
96
+ for (let i = 0; i < lines.length; i++) {
97
+ if (lines[i].trim() === targetHeader) {
98
+ startIdx = i;
99
+ for (let j = i + 1; j < lines.length; j++) {
100
+ const stripped = lines[j].trim();
101
+ if (/^\[[^\]]+\]$/.test(stripped)) {
102
+ endIdx = j;
103
+ break;
104
+ }
105
+ }
106
+ break;
107
+ }
108
+ }
109
+ const newBlockLines = newBlock.replace(/\n+$/, "").split("\n");
110
+ if (startIdx === -1) {
111
+ const trailing = content.length === 0 || content.endsWith("\n") ? "" : "\n";
112
+ const spacer = content.length === 0 ? "" : "\n";
113
+ return content + trailing + spacer + newBlockLines.join("\n") + "\n";
114
+ }
115
+ const before = lines.slice(0, startIdx);
116
+ const after = lines.slice(endIdx);
117
+ const trailingBlank = after.length > 0 && after[0] !== "" ? [""] : [];
118
+ return [...before, ...newBlockLines, ...trailingBlank, ...after].join("\n");
119
+ }
120
+ /**
121
+ * Copies the bundled `using-easel/SKILL.md` into a target skills directory.
122
+ * Used by clients that have a skill-discovery mechanism (Claude Code,
123
+ * Codex).
124
+ */
125
+ export function installEaselSkillTo(destDir) {
126
+ const src = resolve(PROJECT_ROOT, "skills", "using-easel", "SKILL.md");
127
+ if (!existsSync(src)) {
128
+ console.warn(` - skipped skill install: source missing at ${src}`);
129
+ return;
130
+ }
131
+ mkdirSync(destDir, { recursive: true });
132
+ copyFileSync(src, join(destDir, "SKILL.md"));
133
+ console.log(` - installed using-easel skill into ${destDir}`);
56
134
  }
57
135
  function readJson(path) {
58
136
  if (!existsSync(path))
@@ -71,3 +149,14 @@ function readJson(path) {
71
149
  throw new Error(`couldn't parse existing config at ${path}: ${err.message}`);
72
150
  }
73
151
  }
152
+ function claudeDesktopConfigPath() {
153
+ const home = homedir();
154
+ if (platform() === "darwin") {
155
+ return join(home, "Library", "Application Support", "Claude", "claude_desktop_config.json");
156
+ }
157
+ if (platform() === "win32") {
158
+ const appData = process.env.APPDATA ?? join(home, "AppData", "Roaming");
159
+ return join(appData, "Claude", "claude_desktop_config.json");
160
+ }
161
+ return join(home, ".config", "Claude", "claude_desktop_config.json");
162
+ }
package/dist/mcp.js CHANGED
@@ -85,7 +85,40 @@ export async function main() {
85
85
  tools: [
86
86
  {
87
87
  name: TOOL_PUSH,
88
- description: "Push an HTML card to this session's live browser tab (easel). Every card appends to a single scrolling page that the user keeps open in split-screen. Use proactively (per global Rule 33) for wordy explanations, mockups, diagrams, diffs, ≥3-option comparisons, or progress views do NOT ask permission. Pass full HTML (not Markdown).",
88
+ description: "Push an HTML card to this session's live browser tab. Renders in a sandboxed iframe over a host-controlled canvas that can be LIGHT or DARK depending on the user's OS theme. Treat each card as a presentation slide — generous whitespace, presentation-scale type, tangible visuals. Your HTML MUST adapt to both light and dark modes.\n\n" +
89
+ "═══ ADAPTIVE COLOR (gets wrong most often) ═══\n" +
90
+ "• Do NOT set `background` on `body` or your root wrapper. The host paints the canvas — setting bg fights it and creates a wrong-shade block in the opposite mode.\n" +
91
+ "• Use `light-dark()` for ALL text colors, card backgrounds, borders, and decorative shades. Add `:root { color-scheme: light dark; }` so the function resolves. Hardcoded `color: #475569` goes invisible in dark mode; hardcoded `border: 1px solid #e5e5e5` becomes a hard white line.\n" +
92
+ "• After setting `.wrap { color: light-dark(...); }`, re-scope `color: inherit` to every descendant so child elements don't fall back to the host's default.\n" +
93
+ "• Inverse rule: if you DO paint a fixed background on a container (a code block locked to dark, a brand-color hero), you MUST also set its text color AND re-scope `color: inherit` to its children. Background and text are a pair.\n\n" +
94
+ "═══ COPY-PASTE STARTER ═══\n" +
95
+ " :root { color-scheme: light dark; }\n" +
96
+ " .wrap { color: light-dark(#111, #e8e8e8); padding: 56px 48px; font-family: -apple-system, 'Inter', system-ui, sans-serif; max-width: 820px; }\n" +
97
+ " .wrap *, .wrap h1, .wrap h2, .wrap h3, .wrap p, .wrap li, .wrap span { color: inherit; }\n" +
98
+ " .card { background: light-dark(#fff, #161616); border: 1px solid light-dark(#e0d9c3, #2a2a2a); border-radius: 12px; padding: 24px; }\n\n" +
99
+ "═══ TYPOGRAPHY (presentation scale, NOT dashboard) ═══\n" +
100
+ "• Hero title: 44–52px, weight 500, letter-spacing -0.025em\n" +
101
+ "• Section titles: 28–36px, weight 500\n" +
102
+ "• Body: 18–22px, line-height 1.55+\n" +
103
+ "• Eyebrow / kicker: 13–14px uppercase, letter-spacing 0.14em+, colored as a muted accent\n" +
104
+ "• Inter or system sans-serif. Never go below 13px for readable content.\n\n" +
105
+ "═══ WHITESPACE ═══\n" +
106
+ "• Page padding: 56–80px vertical, 40–56px horizontal\n" +
107
+ "• Card padding: 24–32px\n" +
108
+ "• Between major sections: 56–96px\n\n" +
109
+ "═══ VISUALS — tangible beats abstract ═══\n" +
110
+ "The test: 'Could a bullet list communicate this just as well?' If yes, the visual is decoration not explanation — rebuild it as something tangible.\n" +
111
+ "• YES: skeuomorphic browser chrome (3 traffic-light dots + URL bar), terminal windows with monospace + prompt, code-editor frames with line gutters, real device mockups, proportional timeline bars with phase markers, pipe-shaped funnels.\n" +
112
+ "• NO: 5 labeled rectangles connected by arrows; abstract 'sequence diagrams' of thin lines with text labels; numbered-box explainers where each box is just a title + 1 sentence.\n\n" +
113
+ "═══ LAYOUT ═══\n" +
114
+ "• Stack desktop mockups VERTICALLY with labels ('Now', 'Proposed') — don't squeeze them side-by-side. The iframe is ~900px wide; two desktop screens at half-width crush columns, wrap headings to 3 lines, and turn tables unreadable.\n" +
115
+ "• Side-by-side is fine only for narrow mobile mockups, small cards, or short text columns that genuinely fit in half-width.\n" +
116
+ "• One accent color, 3–4 instances max per card. Status colors (red/amber/green) only when state genuinely maps to status.\n\n" +
117
+ "═══ WHEN TO PUSH ═══\n" +
118
+ "A response that would otherwise contain: >2 paragraphs of explanation, any UI mockup, a diagram, a code diff, a ≥3-option comparison, or a multi-step progress view. Do NOT ask permission — push proactively. After pushing, reply in chat with ONE LINE: 'pushed to easel ↗ — #<index>'. Don't restate the card's content.\n\n" +
119
+ "═══ OTHER ═══\n" +
120
+ "• Pass full HTML only — no Markdown. The iframe injects baseline typography so plain `<h1>/<p>` works without extra CSS, but for anything multi-section define your own `<style>` block.\n" +
121
+ "• `<script>` tags trying to mutate the parent window are sandbox-blocked; in-iframe `<script>` (for animations, charts, interactivity) is fine.",
89
122
  inputSchema,
90
123
  },
91
124
  {
@@ -229,10 +262,13 @@ export async function main() {
229
262
  const transport = new StdioServerTransport();
230
263
  await server.connect(transport);
231
264
  }
232
- // Auto-run when invoked directly (e.g. `node dist/mcp.js`), not when imported.
233
- const invokedDirectly = import.meta.url === `file://${process.argv[1]}` ||
234
- import.meta.url.endsWith("/dist/mcp.js");
235
- if (invokedDirectly) {
265
+ // Auto-run only when invoked directly (e.g. `node dist/mcp.js`), not when
266
+ // imported (e.g. by the CLI's no-arg / `mcp` subcommand path). The strict
267
+ // equality is what guarantees this — anything fuzzier (like an endsWith
268
+ // check) matches on import too and ends up running main() twice, which the
269
+ // stdio transport then connects to the same stdin → every message
270
+ // processed twice → every push duplicated. Don't add fallbacks here.
271
+ if (import.meta.url === `file://${process.argv[1]}`) {
236
272
  main().catch((err) => {
237
273
  console.error("[easel mcp] fatal:", err);
238
274
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ammduncan/easel",
3
- "version": "0.2.2",
3
+ "version": "0.2.5",
4
4
  "description": "A live browser tab for every Claude Code (and MCP) session. The push MCP tool appends HTML cards to a scrolling feed you keep open in split-screen.",
5
5
  "type": "module",
6
6
  "license": "MIT",