← Commit history

0.1.3: shot helper - token-efficient screenshots (path-only output)

Kyle Bergstedt ·3d200468fd · ·parent 962fa4a
3 files changed +35−44
bin/shotadded+32
@@ -0,0 +1,32 @@+#!/usr/bin/env bash+# shot — one-call HD screenshot that prints ONLY a PNG path (keeps base64 out of the+# AI's context). Installed to ~/.local/bin/shot by adom/hd-mac-bootstrap.+#+#   shot                       # whole workspace (all panels)+#   shot screen                # entire screen (desktop, other apps)+#   shot panel --name "Foo"    # one panel's content+#   shot workspace --reason "verify the flow viewer rendered"+#+# WHY: `adom-cli hydrogen screenshot ...` prints a ~300 KB base64 dataUrl to stdout.+# Piped raw into an AI conversation that's ~85k tokens of noise per capture, plus a+# second decode step. This wrapper decodes in-line and emits ~20 bytes; the AI then+# Reads the path (images are attached efficiently by the Read tool).+set -euo pipefail+scope="${1:-workspace}"+[ $# -gt 0 ] && shift+out="${SHOT_OUT:-/tmp/shot-${scope}-$(date +%s).png}"+adom-cli hydrogen screenshot "$scope" "$@" 2>/dev/null | python3 -c "+import sys, json, base64+raw = sys.stdin.read()+try:+    d = json.loads(raw)+except Exception:+    sys.stderr.write('shot: unexpected CLI output: ' + raw[:300] + '\n'); sys.exit(1)+u = d.get('dataUrl') or d.get('data_url') or ''+if not u.startswith('data:image'):+    # No image — usually the sharing gate (approval needed) or an error. Surface the+    # CLI's own JSON so the caller sees WHY without re-running anything.+    sys.stderr.write('shot: no image returned: ' + json.dumps(d)[:400] + '\n'); sys.exit(1)+open('$out', 'wb').write(base64.b64decode(u.split(',', 1)[1]))+print('$out')+"
package.json+1−2
@@ -7,7 +7,6 @@   "version": "0.1.3",   "description": "The macOS platform layer for Hydrogen Desktop, where the workspace runs in a Lima Ubuntu VM hosting the Adom-Workspace systemd-nspawn machine. Depends on adom/hd-bootstrap (the platform-generic HD layer) and adds everything specific to the Lima/nspawn runtime: the container/networking/ports/setup/topology/volume/workspace-lifecycle hd-* skills (the macOS-runtime bucket), the in-machine workspace-updater daemon, and the macOS code-server workbench seed. Sibling layers adom/hd-windows-bootstrap (WSL2) and adom/hd-ubuntu-bootstrap depend on the same adom/hd-bootstrap. This is the package the golden Lima image installs.",   "org": "adom",-  "platform": "linux",   "tags": [     "bootstrap",     "hydrogen-desktop",@@ -36,7 +35,7 @@   ],   "hero": {     "headline": "Hydrogen Desktop for macOS",-    "subhead": "The Lima/nspawn workspace layer \u2014 AI-driven electronics design, native on Apple Silicon.",+    "subhead": "The Lima/nspawn workspace layer — AI-driven electronics design, native on Apple Silicon.",     "screenshot": "docs/hero.png"   } }\ No newline at end of file
page.json+2−42
@@ -3,53 +3,13 @@   "type": "bootstrap",   "slug": "hd-mac-bootstrap",   "title": "Hydrogen Desktop (macOS / Lima)",-  "brief": "The macOS platform layer for Hydrogen Desktop.",+  "brief": "The macOS platform layer for Hydrogen Desktop \u2014 converges a Lima/nspawn workspace to the HD-on-Mac runtime.",   "version": "0.1.3",   "license": "proprietary",-  "visibility": {-    "public": true-  },+  "visibility": "public",   "metadata": {     "platform": "linux",     "host": "macos",     "kind": "bootstrap"-  },-  "hero": {-    "type": "billboard",-    "headline": "Hydrogen Desktop for macOS",-    "subhead": "The Lima/nspawn workspace layer — AI-driven electronics design, native on Apple Silicon.",-    "screenshot": "docs/hero.png"-  },-  "description": "The macOS platform layer for Hydrogen Desktop, where the workspace runs in a Lima Ubuntu VM hosting the Adom-Workspace systemd-nspawn machine. Depends on adom/hd-bootstrap (the platform-generic HD layer) and adds everything specific to the Lima/nspawn runtime: the container/networking/ports/setup/topology/volume/workspace-lifecycle hd-* skills (the macOS-runtime bucket), the in-machine workspace-updater daemon, and the macOS code-server workbench seed. Sibling layers adom/hd-windows-bootstrap (WSL2) and adom/hd-ubuntu-bootstrap depend on the same adom/hd-bootstrap. This is the package the golden Lima image installs.",-  "org": "adom",-  "tags": [-    "bootstrap",-    "hydrogen-desktop",-    "hd",-    "macos",-    "mac",-    "lima",-    "nspawn"-  ],-  "needs_sudo": false,-  "scripts": {-    "postinstall": "./postinstall.sh"-  },-  "dependencies": {-    "adom/hd-bootstrap": "^0.2.0",-    "adom/adom-workspace-updater": "^0.1.0"-  },-  "files": [-    "postinstall.sh",-    "skills/**",-    "README.md",-    "SKILL.md",-    "page.json",-    "docs/**",-    "screenshots/**"-  ],-  "author": {-    "name": "Kyle Bergstedt",-    "email": "[email protected]"   } }\ No newline at end of file