JohnXu22786/snippet-expander
dsh-steno
Steno - dsh plugin: inline #tag shorthand expansion before send (multi-library, aliases, {{variables}}, recursion guards)
Install
npx @deepseek-ai/dsh plugin --profile demo add github:JohnXu22786/snippet-expanderRestart `dsh web` after install. Bundle APIs can change during the developer preview.
README badge
[](https://dshhub.dev/plugins/snippet-expander)Paste this into your README. The star count updates with every catalog sync.
From the README
Excerpt from JohnXu22786/snippet-expander, cleaned of badges and images.
Steno — inline shorthand expansion plugin for dsh messages
Type #tag and it is automatically replaced with the full text configured in your snippet library before the message is sent. Write high-frequency instructions once, then trigger them with a single short tag.
User types: Please check this code with #review-lens
Actually sent: Please check this code with Please review strictly: first clarify the task goal, then reason step by step;
… (full review checklist) …
Features
- Instant expansion: you write
#tagin a message and themessage.beforeSendhook performs the replacement before sending. - Multiple snippet libraries: any number of YAML library files, loaded in configuration order with earlier files taking precedence; duplicate names across libraries trigger an automatic warning.
- Aliases: a single snippet can be attached to multiple trigger names (
aliases). - Variable placeholders: the body supports
{{name}}and{{name:default}}, with values supplied by the host. - Recursive composition: snippet bodies can reference other
#tags and expand layer by layer; built-in triple protection covers loop detection, a depth limit, and a count limit. - Code protection:
#tags inside fenced code blocks and inline code are never expanded by mistake. - Library management:
steno.save/steno.removetools plus a CLI let you edit and persist snippet libraries on the fly. - Search and preview:
steno.searchretrieves snippets by relevance; the CLIdsh-steno previewshows the fully expanded result. - Self-contained: only one runtime dependency (js-yaml), requires Node ≥ 22.18, no external services.
Quick Start
npm install # install dependencies and build (the prepare hook builds automatically)
npx dsh-steno init # initialize an example library at ~/.dsh/steno/core.yaml (or use --dir)
Edit ~/.dsh/steno/core.yaml and add a snippet:
name: core
entries:
- tag: careful
aliases: [safe]
description: strict mode
body: |
Reason step by step, self-check before output, ask when in doubt, do not speculate.
Write #careful in a message. Snippet libraries support two auto-discovery locations (both can be overridden by explicit configuration):
| Location | Path |
|---|---|
| Project-level | <project dir>/.dsh/steno/*.yaml |
| User-level | ~/.dsh/steno/*.yaml |
When you do not rely on auto-discovery, you can use the environment variable DSH_STENO_LIBRARIES (semicolon-separated path list) or the libraries configuration passed by the host.
Snippet Library Format
A snippet library is a YAML file, a single top-level mapping whose entries is a list of snippets:
name: dev-tools # library name (defaults to file name); used as target for steno.save
description: description # optional
entries:
- tag: review-lens # required: trigger tag
aliases: [review] # optional: string or string array
description: description # optional
body: | # required: string / multi-line string / string array
#focus
Review for correctness, maintainability, performance, and security.
- tag: commit
body: |
{{type:feat}}({{scope:optional}}): {{subject}}
Field rules:
…


