@eyeglass/cli 0.1.2 → 0.1.3

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.
Files changed (2) hide show
  1. package/dist/index.js +88 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -34,6 +34,71 @@ const CLAUDE_CONFIG = {
34
34
  },
35
35
  },
36
36
  };
37
+ const EYEGLASS_SKILL = `---
38
+ name: eyeglass
39
+ description: Listen for Eyeglass requests from the browser and make UI changes
40
+ user_invocable: true
41
+ ---
42
+
43
+ # Eyeglass Skill
44
+
45
+ Eyeglass lets users select UI elements in their browser and request changes. When invoked, enter a listening loop to handle requests.
46
+
47
+ ## How It Works
48
+
49
+ 1. User selects an element in their browser using the Eyeglass inspector
50
+ 2. User types a request (e.g., "make this blue", "add a button here")
51
+ 3. You receive the element context and make the requested changes
52
+ 4. User can send follow-up requests on the same element
53
+
54
+ ## Listening Loop
55
+
56
+ When this skill is invoked, enter a continuous listening mode:
57
+
58
+ \`\`\`
59
+ while listening:
60
+ 1. Call wait_for_request() - blocks until user selects an element
61
+ 2. Call update_status("fixing", "Working on it...") to show progress
62
+ 3. Use report_action() to show what files you're reading/writing
63
+ 4. Make the requested code changes
64
+ 5. Call update_status("success", "Done!") when complete
65
+ 6. IMMEDIATELY call wait_for_request() again to continue listening
66
+ \`\`\`
67
+
68
+ ## Available MCP Tools
69
+
70
+ - **wait_for_request()** - Block until user selects an element. Returns element context.
71
+ - **update_status(status, message)** - Update the browser UI. Status: "fixing" | "success" | "failed"
72
+ - **report_action(action, target)** - Show progress. Action: "reading" | "writing" | "searching"
73
+ - **send_thought(content)** - Share your reasoning with the user
74
+ - **ask_question(question, options)** - Ask the user a multiple choice question
75
+
76
+ ## Example Flow
77
+
78
+ \`\`\`
79
+ User invokes: /eyeglass
80
+
81
+ You: [Call wait_for_request()]
82
+ → Returns: User selected <Button /> and said "make this red"
83
+
84
+ You: [Call update_status("fixing", "Adding red variant to Button...")]
85
+ [Call report_action("reading", "src/components/Button.tsx")]
86
+ [Read the file, make changes]
87
+ [Call report_action("writing", "src/components/Button.tsx")]
88
+ [Write the changes]
89
+ [Call update_status("success", "Button is now red!")]
90
+
91
+ You: [Call wait_for_request()] ← IMPORTANT: Go back to listening!
92
+ → Waiting for next request...
93
+ \`\`\`
94
+
95
+ ## Key Points
96
+
97
+ - **Always loop back** - After completing a request, immediately call wait_for_request() again
98
+ - **Show progress** - Use update_status and report_action so the user sees what you're doing
99
+ - **Stay in the browser** - The user doesn't need to come back to the terminal
100
+ - **Handle follow-ups** - Users can send multiple requests on the same element
101
+ `;
37
102
  // ============================================================================
38
103
  // Utilities
39
104
  // ============================================================================
@@ -137,6 +202,26 @@ function detectProject() {
137
202
  // ============================================================================
138
203
  // Config Modifiers
139
204
  // ============================================================================
205
+ function setupEyeglassSkill(dryRun) {
206
+ const cwd = process.cwd();
207
+ const skillsDir = path.join(cwd, '.claude', 'skills');
208
+ const skillPath = path.join(skillsDir, 'eyeglass.md');
209
+ if (fileExists(skillPath)) {
210
+ log('Eyeglass skill already exists', 'success');
211
+ return true;
212
+ }
213
+ if (dryRun) {
214
+ log(`Would create ${path.relative(cwd, skillPath)}`);
215
+ }
216
+ else {
217
+ if (!fileExists(skillsDir)) {
218
+ fs.mkdirSync(skillsDir, { recursive: true });
219
+ }
220
+ writeFile(skillPath, EYEGLASS_SKILL);
221
+ log('Created .claude/skills/eyeglass.md', 'success');
222
+ }
223
+ return true;
224
+ }
140
225
  function setupClaudeConfig(dryRun) {
141
226
  const cwd = process.cwd();
142
227
  const claudeDir = path.join(cwd, '.claude');
@@ -343,7 +428,9 @@ function init(options) {
343
428
  }
344
429
  // Step 2: Setup Claude Code MCP config
345
430
  setupClaudeConfig(dryRun);
346
- // Step 3: Setup project-specific integration
431
+ // Step 3: Setup Eyeglass skill for Claude
432
+ setupEyeglassSkill(dryRun);
433
+ // Step 4: Setup project-specific integration
347
434
  console.log('');
348
435
  switch (project.type) {
349
436
  case 'vite':
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eyeglass/cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Visual debugging for AI coding agents - CLI",
5
5
  "type": "module",
6
6
  "bin": {