From e75c54ca1200a62751ae41ae548c42f981afb344 Mon Sep 17 00:00:00 2001 From: Tacit Lab Date: Thu, 16 Apr 2026 03:03:25 +0800 Subject: [PATCH] refactor: move shims from templates/ to scripts/ and drop legacy shims - Remove 4 legacy shim files; only the unified coinhunter_shim.py remains - Move the remaining shim from templates/ to scripts/ per skill best practices - Update all docs (README, CLAUDE, shim-templates) to reference scripts/ --- CLAUDE.md | 25 ++++++------------- README.md | 27 ++++----------------- references/shim-templates.md | 19 ++++----------- {templates => scripts}/coinhunter_shim.py | 0 templates/coinhunter_external_gate_shim.py | 12 --------- templates/coinhunter_precheck_shim.py | 12 --------- templates/coinhunter_review_context_shim.py | 12 --------- templates/rotate_external_gate_log_shim.py | 12 --------- 8 files changed, 18 insertions(+), 101 deletions(-) rename {templates => scripts}/coinhunter_shim.py (100%) delete mode 100644 templates/coinhunter_external_gate_shim.py delete mode 100644 templates/coinhunter_precheck_shim.py delete mode 100644 templates/coinhunter_review_context_shim.py delete mode 100644 templates/rotate_external_gate_log_shim.py diff --git a/CLAUDE.md b/CLAUDE.md index 0f4a384..5f35168 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,11 +19,8 @@ The actual trading CLI is an **external dependency**: the `coinhunter` package o - `review-template.md` — Hourly review report structure. - `scam-signals.md` — Red flags and classification guidance for meme-coin evaluation. - `auto-trading-guide.md` — Legacy-oriented guide for deploying `auto_trader.py` and Binance API setup. -- `templates/` — Thin shim scripts meant to be copied to your platform's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`). Each shim invokes the installed `coinhunter` CLI: - - `coinhunter_precheck_shim.py` — Runs `coinhunter pre`. - - `coinhunter_external_gate_shim.py` — Runs `coinhunter gate`. - - `coinhunter_review_context_shim.py` — Runs `coinhunter review`. - - `rotate_external_gate_log_shim.py` — Runs `coinhunter rotate-log`. +- `scripts/` — Thin shim scripts meant to be copied to your platform's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`). Currently contains: + - `coinhunter_shim.py` — Unified cross-platform shim that runs any `coinhunter` subcommand (`pre`, `gate`, `review`, `rotate-log`). There is no `pyproject.toml`, `Makefile`, or test suite in this repository. @@ -32,7 +29,7 @@ There is no `pyproject.toml`, `Makefile`, or test suite in this repository. ### Skill vs runtime separation - **Skill code/docs** live in this repository. - **Private user state** lives under `~/.coinhunter/` (positions, balances, logs, reviews, cache, gate state). Never commit user data into this repo. -- **Platform cron scripts** are copied from `templates/` to your runtime's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`) and invoke the installed `coinhunter` CLI. +- **Platform cron scripts** are copied from `scripts/` to your runtime's scripts directory (e.g. `~/.hermes/scripts/` or `~/.openclaw/scripts/`) and invoke the installed `coinhunter` CLI. ### Low-cost trigger architecture The framework is designed to minimize LLM invocations: @@ -73,21 +70,15 @@ When modifying or adding trading scripts, these safeguards from `SKILL.md` must coinhunter --version ``` -- **Validate a shim after editing:** +- **Validate the shim after editing:** ```bash - python3 -m py_compile templates/coinhunter_precheck_shim.py + python3 -m py_compile scripts/coinhunter_shim.py ``` -- **Copy shims to your platform's scripts directory:** +- **Copy the shim to your platform's scripts directory:** ```bash - # Unified shim (recommended) - cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py - # or: cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py - - # Legacy individual shims (Hermes backward compatibility) - cp templates/coinhunter_precheck_shim.py ~/.hermes/scripts/coinhunter_precheck.py - cp templates/coinhunter_external_gate_shim.py ~/.hermes/scripts/coinhunter_external_gate.py - cp templates/coinhunter_review_context_shim.py ~/.hermes/scripts/coinhunter_review_context.py + cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py + # or: cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py ``` - **Inspect user state:** diff --git a/README.md b/README.md index b648a56..3eb11f4 100644 --- a/README.md +++ b/README.md @@ -103,27 +103,14 @@ Create your initial `positions.json`: ### 4. Deploy the shims -**Option A — unified shim (recommended for new setups and cross-platform):** - -Copy the single unified shim into your platform's scripts directory. It accepts the subcommand as its first argument: +Copy the unified shim into your platform's scripts directory. It accepts the subcommand as its first argument: ```bash # Hermes -cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py +cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py # OpenClaw -cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py -``` - -**Option B — legacy shims (existing Hermes users, unchanged behavior):** - -The original individual shims are still provided for backward compatibility: - -```bash -cp templates/coinhunter_precheck_shim.py ~/.hermes/scripts/coinhunter_precheck.py -cp templates/coinhunter_external_gate_shim.py ~/.hermes/scripts/coinhunter_external_gate.py -cp templates/coinhunter_review_context_shim.py ~/.hermes/scripts/coinhunter_review_context.py -cp templates/rotate_external_gate_log_shim.py ~/.hermes/scripts/rotate_external_gate_log.py +cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py ``` ### 5. Configure the platform cron job @@ -207,12 +194,8 @@ coinhunter/ ├── README.md # You are here ├── SKILL.md # Full framework spec + gate blueprint ├── CLAUDE.md # Guidance for Claude Code -├── templates/ # Platform cron shims (call the installed coinhunter CLI) -│ ├── coinhunter_shim.py # Unified cross-platform shim (recommended) -│ ├── coinhunter_precheck_shim.py -│ ├── coinhunter_external_gate_shim.py -│ ├── coinhunter_review_context_shim.py -│ └── rotate_external_gate_log_shim.py +├── scripts/ # Platform cron shims (call the installed coinhunter CLI) +│ └── coinhunter_shim.py # Unified cross-platform shim └── references/ ├── short-term-trading-framework.md ├── review-template.md diff --git a/references/shim-templates.md b/references/shim-templates.md index 7e9fa5e..c419495 100644 --- a/references/shim-templates.md +++ b/references/shim-templates.md @@ -2,14 +2,14 @@ These files are tiny compatibility shims for cron-based platforms (Hermes, OpenClaw, etc.) that expect scripts under a scripts directory such as `~/.hermes/scripts/` or `~/.openclaw/scripts/`. -## Unified shim (recommended) +## Unified shim -`templates/coinhunter_shim.py` is the cross-platform wrapper. It takes the subcommand as its first argument and delegates to the installed `coinhunter` CLI: +`scripts/coinhunter_shim.py` is the cross-platform wrapper. It takes the subcommand as its first argument and delegates to the installed `coinhunter` CLI: ```bash -cp templates/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py +cp scripts/coinhunter_shim.py ~/.hermes/scripts/coinhunter_shim.py # or -cp templates/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py +cp scripts/coinhunter_shim.py ~/.openclaw/scripts/coinhunter_shim.py ``` Usage examples: @@ -18,16 +18,7 @@ Usage examples: - `coinhunter_shim.py review` - `coinhunter_shim.py rotate-log` -## Legacy shims (backward compatibility) - -The original individual shims are still provided for existing Hermes users who already have them deployed. Their behavior is unchanged: - -- `templates/coinhunter_precheck_shim.py` -> `~/.hermes/scripts/coinhunter_precheck.py` -- `templates/coinhunter_external_gate_shim.py` -> `~/.hermes/scripts/coinhunter_external_gate.py` -- `templates/coinhunter_review_context_shim.py` -> `~/.hermes/scripts/coinhunter_review_context.py` -- `templates/rotate_external_gate_log_shim.py` -> `~/.hermes/scripts/rotate_external_gate_log.py` - -The real business logic lives in the external `coinhunter` CLI package (installed from PyPI). These shims only delegate to it. +The real business logic lives in the external `coinhunter` CLI package (installed from PyPI). This shim only delegates to it. The user runtime data stays under: - `~/.coinhunter/` diff --git a/templates/coinhunter_shim.py b/scripts/coinhunter_shim.py similarity index 100% rename from templates/coinhunter_shim.py rename to scripts/coinhunter_shim.py diff --git a/templates/coinhunter_external_gate_shim.py b/templates/coinhunter_external_gate_shim.py deleted file mode 100644 index 04df070..0000000 --- a/templates/coinhunter_external_gate_shim.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -"""Hermes cron shim: runs coinhunter external-gate via CLI.""" -import shutil -import subprocess -import sys - -BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe") -if not BIN: - print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr) - sys.exit(127) - -sys.exit(subprocess.run([BIN, "gate", *sys.argv[1:]]).returncode) diff --git a/templates/coinhunter_precheck_shim.py b/templates/coinhunter_precheck_shim.py deleted file mode 100644 index f241bdd..0000000 --- a/templates/coinhunter_precheck_shim.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -"""Hermes cron shim: runs coinhunter precheck via CLI.""" -import shutil -import subprocess -import sys - -BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe") -if not BIN: - print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr) - sys.exit(127) - -sys.exit(subprocess.run([BIN, "pre", *sys.argv[1:]]).returncode) diff --git a/templates/coinhunter_review_context_shim.py b/templates/coinhunter_review_context_shim.py deleted file mode 100644 index 0220f34..0000000 --- a/templates/coinhunter_review_context_shim.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -"""Hermes cron shim: runs coinhunter review-context via CLI.""" -import shutil -import subprocess -import sys - -BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe") -if not BIN: - print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr) - sys.exit(127) - -sys.exit(subprocess.run([BIN, "review", *sys.argv[1:]]).returncode) diff --git a/templates/rotate_external_gate_log_shim.py b/templates/rotate_external_gate_log_shim.py deleted file mode 100644 index 980a261..0000000 --- a/templates/rotate_external_gate_log_shim.py +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env python3 -"""Hermes cron shim: runs coinhunter rotate-log via CLI.""" -import shutil -import subprocess -import sys - -BIN = shutil.which("coinhunter") or shutil.which("coinhunter.exe") -if not BIN: - print("error: coinhunter CLI not found in PATH. Install with: pipx install coinhunter", file=sys.stderr) - sys.exit(127) - -sys.exit(subprocess.run([BIN, "rotate-log", *sys.argv[1:]]).returncode)