@ammduncan/easel 0.2.4 → 0.2.6

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,20 @@
2
2
 
3
3
  All notable changes to easel. This project adheres to [Semantic Versioning](https://semver.org/).
4
4
 
5
+ ## 0.2.6 — 2026-05-22
6
+
7
+ ### Fixed
8
+ - **Locked-mode containers (terminal mockups, code blocks, brand-color heros) had invisible text in light mode** when pushed from non-Claude-Code clients. The push tool description's "inverse rule" was stated in prose but had no copy-paste code example — and the wrap/card example used `light-dark()` while the agent then applied the same pattern to a locked-dark terminal, leaving its inner text on `color: inherit` (which resolved to the wrap's dark text in light mode → dark text on dark bg).
9
+ - Added a second copy-paste starter block specifically for locked-mode containers, showing the canonical pattern (`background: #0f172a; color: #e6edf3;` + re-scoping `color: inherit` to children). Right next to the adaptive wrap/card pattern so the agent can't miss the difference.
10
+
11
+ ## 0.2.5 — 2026-05-22
12
+
13
+ ### Added
14
+ - **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.
15
+
16
+ ### Fixed
17
+ - **`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.
18
+
5
19
  ## 0.2.4 — 2026-05-22
6
20
 
7
21
  ### 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];
@@ -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
@@ -91,11 +91,17 @@ export async function main() {
91
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
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
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" +
94
+ "═══ COPY-PASTE STARTER (adaptive) ═══\n" +
95
95
  " :root { color-scheme: light dark; }\n" +
96
96
  " .wrap { color: light-dark(#111, #e8e8e8); padding: 56px 48px; font-family: -apple-system, 'Inter', system-ui, sans-serif; max-width: 820px; }\n" +
97
97
  " .wrap *, .wrap h1, .wrap h2, .wrap h3, .wrap p, .wrap li, .wrap span { color: inherit; }\n" +
98
98
  " .card { background: light-dark(#fff, #161616); border: 1px solid light-dark(#e0d9c3, #2a2a2a); border-radius: 12px; padding: 24px; }\n\n" +
99
+ "═══ COPY-PASTE STARTER (LOCKED-MODE container — terminal, code block, brand hero) ═══\n" +
100
+ "If a container has a FIXED background (not `light-dark()`), you MUST set its own text color AND re-scope `color: inherit` to its children. Otherwise the children inherit `light-dark(...)` from `.wrap` and the text flips to the wrong shade in one mode (e.g. dark text on a locked-dark terminal in light host mode → invisible). This is the #1 thing that goes wrong on terminals and code blocks.\n" +
101
+ " .terminal { background: #0f172a; color: #e6edf3; border-radius: 12px; padding: 20px 24px; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 13.5px; line-height: 1.7; }\n" +
102
+ " .terminal *, .terminal span, .terminal pre { color: inherit; }\n" +
103
+ " .terminal .muted { color: #94a3b8; }\n" +
104
+ " .terminal .accent { color: #6ee7b7; }\n\n" +
99
105
  "═══ TYPOGRAPHY (presentation scale, NOT dashboard) ═══\n" +
100
106
  "• Hero title: 44–52px, weight 500, letter-spacing -0.025em\n" +
101
107
  "• Section titles: 28–36px, weight 500\n" +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ammduncan/easel",
3
- "version": "0.2.4",
3
+ "version": "0.2.6",
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",