← Commit history

component-hero 0.1.0: adom-hero 1.0 spec + generator

Ray ·fc48cbcd1f ·5d ago ·parent 050da5d
6 files changed +47
docs/hero.png
⋯ 1 unchanged line ⋯
install.shadded+4
@@ -0,0 +1,4 @@+#!/bin/sh+set -eu+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+exec python3 "$SCRIPT_DIR/scripts/install.py" "$@"
package.json+8
@@ -11,6 +11,10 @@     "package.json",     "SKILL.md",     "README.md",+    "install.sh",+    "uninstall.sh",+    "scripts/install.py",+    "scripts/uninstall.py",     "skills/**"   ],   "dependencies": {},@@ -47,5 +51,9 @@   ],   "hero": {     "path": "docs/hero.png"+  },+  "scripts": {+    "install": "./install.sh",+    "uninstall": "./uninstall.sh"   } }
scripts/install.pyadded+15
@@ -0,0 +1,15 @@+#!/usr/bin/env python3+"""Install this package's skill (component-hero) into Claude and Codex homes."""+import argparse, json, os, shutil+from pathlib import Path+ROOT=Path(__file__).resolve().parents[1]+parser=argparse.ArgumentParser();parser.add_argument('--home',type=Path,help='Isolated home for validation');args=parser.parse_args()+home=args.home or Path.home()+codex=home/'.codex' if args.home else Path(os.environ.get('CODEX_HOME',str(home/'.codex')))+for destination in [home/'.claude/skills',codex/'skills']:+    for source in sorted((ROOT/'skills').iterdir()):+        if not (source/'SKILL.md').is_file():continue+        target=destination/source.name+        target.mkdir(parents=True,exist_ok=True)+        shutil.copytree(source,target,dirs_exist_ok=True)+        print(target)
scripts/uninstall.pyadded+16
@@ -0,0 +1,16 @@+#!/usr/bin/env python3+"""Remove only unchanged files installed by this package; preserve local edits."""+import argparse,os+from pathlib import Path+root=Path(__file__).resolve().parents[1]+p=argparse.ArgumentParser();p.add_argument('--home',type=Path);args=p.parse_args()+home=args.home or Path.home();codex=home/'.codex' if args.home else Path(os.environ.get('CODEX_HOME',str(home/'.codex')))+for base in [home/'.claude/skills',codex/'skills']:+ for source in sorted((root/'skills').iterdir()):+  target=base/source.name+  for file in source.rglob('*'):+   out=target/file.relative_to(source)+   if file.is_file() and out.is_file() and out.read_bytes()==file.read_bytes():out.unlink()+  if target.exists():+   for d in sorted([p for p in target.rglob('*') if p.is_dir()]+[target],key=lambda p:len(p.parts),reverse=True):+    if not any(d.iterdir()):d.rmdir()
uninstall.shadded+4
@@ -0,0 +1,4 @@+#!/bin/sh+set -eu+SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)+exec python3 "$SCRIPT_DIR/scripts/uninstall.py" "$@"