Skip to content

Commit 13101ca

Browse files
committed
refactor: single template at templates/template-base.sh
Remove duplicate skeleton copies under references/ and examples/. Docs, CI, and skill mirrors now point at one file only.
1 parent 469b962 commit 13101ca

9 files changed

Lines changed: 71 additions & 553 deletions

File tree

.github/workflows/validate.yml

Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,21 @@ jobs:
1313
- name: Checkout
1414
uses: actions/checkout@v4
1515

16-
- name: bash -n shipped scripts
16+
- name: bash -n shipped script
1717
run: |
1818
set -euo pipefail
1919
root="skills/software-development/scripts-bash"
2020
test -f "$root/SKILL.md"
2121
test -f "$root/references/authoring.md"
2222
test -f "$root/references/screaming-snake-case-variables.md"
23-
for f in \
24-
"$root/references/template-base.sh" \
25-
"$root/templates/template-base.sh" \
26-
"$root/examples/minimal-service-installer.sh"
27-
do
28-
echo "bash -n $f"
29-
bash -n "$f"
30-
done
23+
test -f "$root/templates/template-base.sh"
24+
test ! -e "$root/references/template-base.sh"
25+
test ! -e "$root/examples"
26+
bash -n "$root/templates/template-base.sh"
3127
echo "OK"
3228
33-
- name: shellcheck (non-blocking if missing)
29+
- name: shellcheck
3430
run: |
35-
if command -v shellcheck >/dev/null 2>&1; then
36-
shellcheck -x skills/software-development/scripts-bash/references/template-base.sh \
37-
skills/software-development/scripts-bash/templates/template-base.sh \
38-
skills/software-development/scripts-bash/examples/minimal-service-installer.sh
39-
else
40-
sudo apt-get update -qq
41-
sudo apt-get install -y -qq shellcheck
42-
shellcheck -x skills/software-development/scripts-bash/references/template-base.sh \
43-
skills/software-development/scripts-bash/templates/template-base.sh \
44-
skills/software-development/scripts-bash/examples/minimal-service-installer.sh
45-
fi
31+
sudo apt-get update -qq
32+
sudo apt-get install -y -qq shellcheck
33+
shellcheck -x skills/software-development/scripts-bash/templates/template-base.sh

CONTRIBUTING.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ All PRs require review from CODEOWNERS before merge.
2020
6. **Verify before push:**
2121

2222
```bash
23-
bash -n skills/software-development/scripts-bash/references/template-base.sh
2423
bash -n skills/software-development/scripts-bash/templates/template-base.sh
25-
bash -n skills/software-development/scripts-bash/examples/minimal-service-installer.sh
24+
bash -n skills/software-development/scripts-bash/templates/template-base.sh
2625
# shellcheck if available
2726
```
2827

README.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ Full walkthrough: [`skills/software-development/scripts-bash/references/authorin
8181

8282
```text
8383
skills/software-development/scripts-bash/
84-
SKILL.md # Hermes skill entry
85-
references/template-base.sh # executable skeleton (source of truth)
86-
references/screaming-snake-case-variables.md # global name registry
87-
references/authoring.md # how to create excellent scripts
88-
templates/template-base.sh
89-
examples/minimal-service-installer.sh # ship-safe sample only
84+
SKILL.md
85+
templates/template-base.sh # ONLY executable skeleton
86+
references/screaming-snake-case-variables.md
87+
references/authoring.md
9088
README.md / PUBLISH.md
9189
```
9290

93-
**Not in this repo:** private production installers, host design briefs, API keys, Kaggle/Google app code.
91+
**Not in this repo:** private production installers, host design briefs, API keys, duplicate templates.
9492

9593
## What "good" looks like
9694

skills/software-development/scripts-bash/PUBLISH.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,33 +7,30 @@ skills/software-development/scripts-bash/
77
SKILL.md
88
README.md
99
PUBLISH.md
10-
references/template-base.sh
10+
templates/template-base.sh
1111
references/screaming-snake-case-variables.md
1212
references/authoring.md
13-
templates/template-base.sh
14-
examples/minimal-service-installer.sh
1513
```
1614

1715
## Do not ship
1816

17+
- Duplicate skeletons (`references/template-base.sh`, `examples/` clone)
1918
- Full production installer trees
2019
- Profile `workspace/prompts/` design briefs
21-
- Symlinks into a private profile workspace
22-
- Hostnames, API keys, machine-local paths as requirements
23-
- Duplicate archives of old SKILL.md versions
20+
- Symlinks
21+
- Secrets / host-private paths as requirements
2422

2523
## Checks
2624

2725
```bash
28-
bash -n references/template-base.sh
2926
bash -n templates/template-base.sh
30-
bash -n examples/minimal-service-installer.sh
3127
# frontmatter: name, description starts with "Use when"
3228
```
3329

34-
## Local dual install (optional)
30+
## Local installs
3531

3632
Canonical: `~/.hermes/skills/software-development/scripts-bash/`
3733
Mirror: `~/.hermes/profiles/<name>/skills/scripts-bash/`
34+
Git: `~/.hermes/projects/scripts-bash/skills/software-development/scripts-bash/`
3835

39-
After edits: copy canonical → mirror. Products stay in profile `workspace/`.
36+
After edits: update canonical, then `cp -a` to profile mirror and git skill tree.

skills/software-development/scripts-bash/README.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,12 @@ Lean Hermes skill: rigid standard for long-lived bash installer/manager scripts.
55
## Contents
66

77
- `SKILL.md` — agent rules
8-
- `references/template-base.sh` — executable skeleton
8+
- `templates/template-base.sh` **only** executable skeleton
99
- `references/screaming-snake-case-variables.md` — global name registry
10-
- `references/authoring.md` — tutorial (how to create excellent scripts with this skill)
11-
- `templates/template-base.sh` — same skeleton
12-
- `examples/minimal-service-installer.sh` — ship-safe sample only
10+
- `references/authoring.md` — how to create excellent scripts
1311
- `PUBLISH.md` — hub notes
1412

15-
**Not included:** production installers, host-specific design briefs, large archives.
13+
**Not included:** production installers, host briefs, duplicate templates, examples clone.
1614

1715
## Install
1816

@@ -23,7 +21,7 @@ cp -a scripts-bash ~/.hermes/skills/software-development/
2321
cp -a scripts-bash ~/.hermes/profiles/<profile>/skills/
2422
```
2523

26-
Reload skills in session.
24+
Reload skills in session. Load: `/skill scripts-bash`
2725

2826
## Products vs skill
2927

skills/software-development/scripts-bash/SKILL.md

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: scripts-bash
33
description: "Use when writing, revising, or reviewing long-lived bash installer/manager scripts. Enforces a rigid ops-script standard: fixed header, SCREAMING_SNAKE_CASE globals, ANSI log lines, spinner suite, case-driven routines, and hard verification gates."
4-
version: 4.2.0
4+
version: 4.2.1
55
author: Vituvo
66
license: MIT
77
platforms: [linux]
@@ -29,7 +29,7 @@ Standard for **long-lived bash installer / manager scripts**. Not for one-liners
2929

3030
| | What | Where |
3131
|--|------|--------|
32-
| **Skill** | Rules, template, variable registry, one minimal example | This skill directory |
32+
| **Skill** | Rules, single template, variable registry, authoring | This skill directory |
3333
| **Products** | Scripts you run day to day | Profile workspace (outside the skill) |
3434

3535
Default product layout (relative to the active Hermes profile home):
@@ -40,38 +40,36 @@ workspace/
4040
scripts/<purpose>/<name>.sh
4141
```
4242

43-
Do **not** write live products into the skill tree. Copy `templates/template-base.sh` (or `references/template-base.sh`) out to the product path.
43+
Do **not** write live products into the skill tree. Copy **`templates/template-base.sh`** out to the product path.
4444

4545
## Package contents (lean)
4646

4747
```text
4848
SKILL.md
4949
README.md
5050
PUBLISH.md
51-
references/template-base.sh
51+
templates/template-base.sh # ONLY executable skeleton
5252
references/screaming-snake-case-variables.md
53-
references/authoring.md # tutorial: how to use this skill
54-
templates/template-base.sh # same skeleton
55-
examples/minimal-service-installer.sh # ship-safe sample only
53+
references/authoring.md
5654
```
5755

58-
No production installer trees. No host-specific prompt packs.
56+
One skeleton only. No duplicate templates. No `examples/` clone of the same file. No symlinks.
5957

6058
## Tutorial
6159

62-
Read **`references/authoring.md`** first time you use the skill. It is the human/agent walkthrough (5-step recipe, good vs bad output, smoke test for reviewers).
60+
Read **`references/authoring.md`** first time you use the skill.
6361

6462
## Precedence
6563

66-
1. `references/template-base.sh` (executable truth)
64+
1. `templates/template-base.sh` (executable truth — single file)
6765
2. This `SKILL.md`
6866
3. `references/screaming-snake-case-variables.md` (append-only globals)
6967
4. `references/authoring.md` (how to apply the law)
7068

7169
## Workflow
7270

7371
1. Load this skill; skim `references/authoring.md` if new
74-
2. Read `references/template-base.sh`
72+
2. Read `templates/template-base.sh`
7573
3. Read variable registry before adding globals
7674
4. Copy template → product path under profile `workspace/`
7775
5. Fill header, vars, domain functions; keep skeleton helpers stable
@@ -136,7 +134,7 @@ Globals SCREAMING_SNAKE; function locals lowercase. Document new globals in the
136134

137135
## Standard functions
138136

139-
Copy from the template. Do not re-invent.
137+
Copy from `templates/template-base.sh`. Do not re-invent.
140138

141139
- `trap_exit` — SIGINT/TERM, kill spinner, Stopped, `sexit`, exit 1
142140
- `display_start_message` — banner gated on `DEBUG` only
@@ -156,36 +154,36 @@ Copy from the template. Do not re-invent.
156154

157155
## Craft bar (master-script expectations)
158156

159-
House style uses **explicit exit checks** + `sexit; exit 1` (see golden installers). Do **not** slap `set -euo pipefail` on a large installer unless you re-audit every command; optional on small new scripts if you understand `set -e` + pipelines.
157+
House style uses **explicit exit checks** + `sexit; exit 1`. Do **not** slap `set -euo pipefail` on a large installer unless you re-audit every command; optional on small new scripts if you understand `set -e` + pipelines.
160158

161159
| Expectation | Rule |
162160
|-------------|------|
163161
| Quoting | Quote expansions: `"${VAR}"`, `"${array[@]}"`. |
164162
| Tests | Prefer `[[ ... ]]` over `[ ... ]`. |
165163
| Spinner + exit | Capture `cmd_exit=$?` **before** `stop_spinner`; then branch on `cmd_exit`. |
166164
| dryrun | Prefer a `dryrun` routine that prints planned actions and exits 0 with no changes. |
167-
| Idempotent install | Re-run install safely when already installed (skip clone, reuse container, etc.). |
168-
| Dependencies | Check `command -v` for required tools; fail with install hint, no surprise package installs. |
169-
| Privileged ops | No `sudo` unless user explicitly approved this script/run. |
170-
| Secrets | Never embed keys/tokens; read from env or document external setup. |
171-
| shellcheck | Run when available; justify any remaining warnings. |
172-
| Port conflicts | Document and enforce mutual exclusion (e.g. only one listener on a shared port). |
173-
| Dual skill copies | Edit global skill first; `cp -a` to profile mirror. |
165+
| Idempotent install | Re-run install safely when already installed. |
166+
| Dependencies | Check `command -v`; fail with install hint, no surprise package installs. |
167+
| Privileged ops | No `sudo` unless user explicitly approved. |
168+
| Secrets | Never embed keys/tokens. |
169+
| shellcheck | Run when available; justify remaining warnings. |
170+
| Port conflicts | Document and enforce mutual exclusion. |
171+
| Dual skill installs | Edit global skill first; `cp -a` to profile mirror and git repo skill tree. |
174172

175173
## Pitfalls
176174

175+
- Duplicate skeleton files inside the skill (forbidden — one template only)
177176
- Shipping fat production installers inside the skill
178-
- Dual divergent copies of this skill (edit one place, sync the other)
177+
- Divergent skill copies (global / profile / github out of sync)
179178
- `START` as timer name (collides with `start` routine)
180179
- `show_usage` calling `sexit`
181180
- Blind `set -e` on scripts full of intentional non-zero tests
182-
- Forgetting `stop_spinner` on failure paths (leaves junk on the TTY)
181+
- Forgetting `stop_spinner` on failure paths
183182
- Skill name confusion: skill is **`scripts-bash`**, profile may be named `coder-bash`
184183

185184
## Version
186185

187-
- **4.2.0**Craft bar (quote/[[ ]]/spinner exit/dryrun/idempotency); SOUL/AGENTS alignment; skill name clarity
188-
- **4.1.1**Added `references/authoring.md` tutorial; host design briefs stay outside skill
189-
- **4.1.0**Lean hub package: no production installers, no host prompt pack, no v3 archive dump
186+
- **4.2.1**Single template at `templates/template-base.sh`; removed duplicate references/examples copies
187+
- **4.2.0**Craft bar; SOUL/AGENTS alignment
188+
- **4.1.x**Authoring tutorial; lean hub package
190189
- **4.0.0** — Initial hub-oriented layout
191-
- **3.x** — Spinner suite / SCRIPT_START / sleep 0.05 (superseded prose)

0 commit comments

Comments
 (0)