opencode-avatar 0.2.0 → 0.3.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/README.md CHANGED
@@ -56,10 +56,26 @@ Get your FAL.ai API key from [fal.ai](https://fal.ai).
56
56
 
57
57
  ### Avatar Images
58
58
 
59
- The plugin comes with a default avatar (`avatar.png`). Place custom avatars in the plugin directory:
59
+ The plugin automatically downloads a default avatar (`avatar.png`) to `~/.config/opencode/avatar.png` if it doesn't exist. This serves as the source image for generating animated variants.
60
60
 
61
- - `avatar.png` - Default avatar (required)
62
- - `avatar.svg` - Fallback avatar (optional)
61
+ #### Using a Custom Avatar
62
+
63
+ To use your own custom avatar:
64
+
65
+ 1. Place your custom `avatar.png` image in `~/.config/opencode/`
66
+ 2. The plugin will use this as the base image for all avatar variants
67
+ 3. Ensure your image has a solid green background (RGB: 0, 255, 0) for best results with the chroma key processing
68
+
69
+ #### Generated Variants
70
+
71
+ The plugin generates and caches avatar variants in the same directory:
72
+
73
+ - `avatar_write.png` - Writing pose
74
+ - `avatar_read.png` - Reading pose
75
+ - `avatar_thinking_hard.png` - Thinking animation
76
+ - And more based on tool usage
77
+
78
+ All avatars are stored in `~/.config/opencode/` for persistence across updates.
63
79
 
64
80
  ## How It Works
65
81
 
package/dist/electron.js CHANGED
@@ -424,7 +424,7 @@ var FAL_REST_URL = "https://rest.alpha.fal.ai";
424
424
  var FAL_NANO_BANANA_URL = "https://fal.run/fal-ai/nano-banana-pro/edit";
425
425
  var __filename2 = fileURLToPath(import.meta.url);
426
426
  var __dirnameResolved = path.dirname(__filename2);
427
- var AVATAR_DIR = path.join(__dirnameResolved, "..");
427
+ var AVATAR_DIR = path.join(os.homedir(), ".config", "opencode");
428
428
  var HTML_CONTENT = `<!DOCTYPE html>
429
429
  <html>
430
430
  <head>
@@ -834,7 +834,17 @@ function createTray() {
834
834
  tray.on("click", () => mainWindow?.isVisible() ? mainWindow.hide() : mainWindow?.show());
835
835
  }
836
836
  app.commandLine.appendSwitch("enable-transparent-visuals");
837
- app.whenReady().then(() => {
837
+ app.whenReady().then(async () => {
838
+ fs.mkdirSync(AVATAR_DIR, { recursive: true });
839
+ const avatarPath = path.join(AVATAR_DIR, "avatar.png");
840
+ if (!fs.existsSync(avatarPath)) {
841
+ try {
842
+ await downloadImage("https://richardanaya.github.io/opencode-avatar/avatar.png", avatarPath);
843
+ console.log("Downloaded default avatar to", avatarPath);
844
+ } catch (error) {
845
+ console.warn("Failed to download default avatar:", error);
846
+ }
847
+ }
838
848
  setTimeout(() => {
839
849
  createWindow();
840
850
  createTray();
package/dist/index.js CHANGED
@@ -4,7 +4,7 @@ import { spawn } from "child_process";
4
4
  import * as path from "path";
5
5
  import * as http from "http";
6
6
  import * as fs from "fs";
7
- var __dirname = "/var/home/wizard/opencode-avatar";
7
+ var __dirname = "/var/home/wizard/av";
8
8
  var AVATAR_DIR = __dirname;
9
9
  var DEFAULT_AVATAR = "avatar.png";
10
10
  var THINKING_PROMPT = "thinking hard";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-avatar",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Dynamic desktop avatar plugin for OpenCode that reacts to your coding activities",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",