feat(install): install _primitives/ + soft pandoc warning
- install.sh:
- mkdir $AGENTS_DIR/_primitives
- copy *.sh + README.md from kit _primitives/ with backup_dir guard
- chmod +x for the primitive scripts
- extend hooks-copy loop to include tomd-preread.sh (skips if absent,
preserving back-compat with kits that predate the primitive)
- soft-warn (not hard-fail) if pandoc is missing — tomd primitive is
opt-in and works without pandoc for CSV/code/JSON/images
- settings-snippet.json: add PreToolUse(Read) entry for tomd-preread.sh
with statusMessage. New matcher block (no existing Read matcher).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2e8c8acced
commit
d59fc2ba59
2 changed files with 28 additions and 1 deletions
19
install.sh
19
install.sh
|
|
@ -189,12 +189,19 @@ if ! command -v jq >/dev/null 2>&1; then
|
|||
err " apt install jq (Debian/Ubuntu)"
|
||||
exit 1
|
||||
fi
|
||||
# Soft-warn on pandoc — the tomd primitive works without it for CSV / code /
|
||||
# JSON / images, but fails on .docx / .pptx / .html. Opt-in use, so not
|
||||
# promoted to a hard-fail.
|
||||
if ! command -v pandoc >/dev/null 2>&1; then
|
||||
warn "pandoc not found — tomd primitive will fail on .docx/.pptx. Install: brew install pandoc"
|
||||
fi
|
||||
|
||||
# --- create target dirs -----------------------------------------------------
|
||||
say "creating directories"
|
||||
mkdir -p \
|
||||
"$AGENTS_DIR/_blocks" \
|
||||
"$AGENTS_DIR/_manifests" \
|
||||
"$AGENTS_DIR/_primitives" \
|
||||
"$AGENTS_DIR/_templates" \
|
||||
"$AGENTS_DIR/_assembler/src" \
|
||||
"$AGENTS_DIR/_generated" \
|
||||
|
|
@ -221,6 +228,15 @@ say "copying shared blocks -> $AGENTS_DIR/_blocks/"
|
|||
backup_dir "$AGENTS_DIR/_blocks"
|
||||
cp -f "$KIT_DIR/_blocks/"*.md "$AGENTS_DIR/_blocks/"
|
||||
|
||||
# --- copy primitives (overwrite; primitives are SSoT from kit) -------------
|
||||
if [[ -d "$KIT_DIR/_primitives" ]]; then
|
||||
say "copying primitives -> $AGENTS_DIR/_primitives/"
|
||||
backup_dir "$AGENTS_DIR/_primitives"
|
||||
cp -f "$KIT_DIR/_primitives/"*.sh "$AGENTS_DIR/_primitives/" 2>/dev/null || true
|
||||
cp -f "$KIT_DIR/_primitives/README.md" "$AGENTS_DIR/_primitives/" 2>/dev/null || true
|
||||
chmod +x "$AGENTS_DIR/_primitives/"*.sh 2>/dev/null || true
|
||||
fi
|
||||
|
||||
# --- copy bridges (overwrite; templates are SSoT from kit) -----------------
|
||||
if [[ -d "$KIT_DIR/_bridges" ]]; then
|
||||
say "copying bridge templates -> $AGENTS_DIR/_bridges/"
|
||||
|
|
@ -272,7 +288,8 @@ fi
|
|||
# individually rather than the whole directory, so foreign hooks are not
|
||||
# dragged into .bak-TIMESTAMP snapshots on every re-run.
|
||||
say "copying hooks -> $HOOKS_DIR/"
|
||||
for h in assemble-agents.sh assemble-validate.sh no-hand-edit-agents.sh; do
|
||||
for h in assemble-agents.sh assemble-validate.sh no-hand-edit-agents.sh tomd-preread.sh; do
|
||||
[ -f "$KIT_DIR/hooks/$h" ] || continue
|
||||
backup_file "$HOOKS_DIR/$h"
|
||||
cp -f "$KIT_DIR/hooks/$h" "$HOOKS_DIR/$h"
|
||||
chmod +x "$HOOKS_DIR/$h"
|
||||
|
|
|
|||
|
|
@ -30,6 +30,16 @@
|
|||
"command": "~/.claude/hooks/no-hand-edit-agents.sh"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"matcher": "Read",
|
||||
"hooks": [
|
||||
{
|
||||
"type": "command",
|
||||
"command": "~/.claude/hooks/tomd-preread.sh",
|
||||
"statusMessage": "tomd pre-read auto-convert check..."
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue