cli-tool-wrapping
Alias colliding CLI; dodge the symlink-clobber write.
- License 许可
- MIT
- 最近更新
- 2026-10-14
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- cli-tool-wrapping
- author
- hermes-agent
- license
- MIT
- version
- 1
- metadata
- { "hermes": { "tags": [ "cli", "symlink", "alias", "node", "packaging", "devops" ], "related_skills": [ "hermes-agent", "devops-golang-track" ] } }
- description
- Alias colliding CLI; dodge the symlink-clobber write.
02 资源文件 1
- 参考文档references/open-design-cli.md1.4 KB
03 SKILL.md 正文
CLI Tool Wrapping & Symlink Safety
When to use
- A tool you're setting up installs a binary whose name collides with an existing system command. Most common real case: Open Design's
odCLI vs GNU coreutilsodat/usr/bin/od. - You need a callable name for a tool without shadowing the system binary.
- You are creating a wrapper script or symlink that points at (or through) a symlink.
- You must force a specific runtime (e.g. Node 24) regardless of the default
nodeon PATH.
User-endorsed pattern: alias + symlink to a non-colliding name
Do NOT overwrite or shadow the system binary. Give the tool its own name:
- Pick a collision-free name (e.g.
opendesignfor Open Design'sod). - Put a wrapper or symlink at
~/.local/bin/<name>(confirm~/.local/binis on PATH:case ":$PATH:" in *":/home/deeone/.local/bin:"*) echo YES;; esac). - Leave the system binary (
/usr/bin/od) untouched.
This is the user's explicit instruction: "alias and symlink it to connect it to avoid name collision." It works — the tool becomes callable as opendesign, coreutils od stays intact.
CRITICAL PITFALL — the file writer follows symlinks and clobbers the real target
The agent's write_file (and similar write actions) resolve symlinks to their final target and overwrite THAT file. It does NOT create/replace the symlink itself.
Verified incident (this session)
While creating ~/.local/bin/opendesign as a wrapper, that path was already a symlink I had just made:
~/.local/bin/opendesign → node_modules/.bin/od (symlink) → apps/daemon/bin/od.mjs (the REAL source).
Writing the wrapper text to ~/.local/bin/opendesign followed the whole chain and corrupted od.mjs with wrapper content, so every od/opendesign invocation hung (exec of a shell script as if it were an .mjs). The write result even reported resolved_path: .../apps/daemon/bin/od.mjs, confirming the clobber.
How to avoid
- NEVER
write_fileto a path that is (or resolves through) a symlink to a file you must not overwrite. - Before writing a wrapper: if a symlink already occupies the target,
rmthe symlink FIRST, thenwrite_filethe real wrapper file as a plain file, then re-create any symlinks you need elsewhere. - If you corrupted a tracked source this way, restore it from VCS:
git checkout -- <file>(it's tracked), then re-linknode_modules/.bin/<bin>→ the real entry. - Diagnose with
sh -x <wrapper>— it shows exactly what gets exec'd and surfaces a clobbered entrypoint fast.
Verifying a wrapper is safe & correct
sh -x /path/to/wrapper --help— trace what it execs.- Test from an arbitrary cwd with a stripped PATH to prove it forces the right runtime regardless of defaults:
PATH="/usr/bin:/bin:/home/deeone/.local/bin" wrapper --help. - Confirm the system binary is untouched:
command -v od→ still/usr/bin/od;od --version→ coreutils, not the tool.
Wrapper template (forces a specific runtime, avoids collision)
#!/bin/sh
# Forces the runtime the tool requires; does NOT collide with system `od`.
NODE24=/home/deeone/.nvm/versions/node/v24.19.0/bin
export PATH="$NODE24:$PATH"
exec /abs/path/to/REAL/entrypoint "$@"
- Point
execat the real, restored entrypoint (e.g.apps/daemon/bin/od.mjsor the package'sbinfield target), NOT anode_modules/.binsymlink you might also be editing. - Find the real entry:
grep -E '"bin"' package.json(repo root) orapps/<app>/package.json; for Open Design it isapps/daemon/bin/od.mjsand the repo-root bin maps"od": "./apps/daemon/bin/od.mjs".
Keep system binaries intact — final check
Always confirm: od --version → od (GNU coreutils) 9.11, and the tool is reachable only via its alias (opendesign --help).
04 同仓库更多 Skills
blocked-page-recovery
Use when a fetch fails: 403/429, paywall, WAF, bot wall.
gemini-vision-fallback
Vision fallback: Gemini REST API if vision_analyze blocked.
twitter-cli
Use twitter-cli for ALL Twitter/X operations — reading tweets, posting, replying, quoting, liking, retweeting, following, searching, user lookups. Invoke whenever user requests any Twitter interaction.
prism-scan
Structural analysis through dynamically generated cognitive lenses. Generates the optimal analytical lens for the specific code/artifact, then executes it. Finds conservation laws, structural invariants, and concrete bugs that vanilla analysis misses. Use on any code file, system design, or text artifact.
prism-reflect
Constraint transparency: analyzes an artifact structurally, then analyzes what its own analysis concealed. Produces a conservation law AND a constraint report showing what was maximized, what was sacrificed, and what to investigate next. The only AI skill that knows what it can't see.
prism-full
Full Prism: multi-pass structural analysis with mandatory adversarial self-correction. Designs custom analytical passes, executes them with chaining, then attacks its own findings before synthesizing. Use for maximum depth on important code or artifacts.