mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-02 03:35:09 +02:00
43c078f19a
* feat: make skill prefix a persistent, interactive user setting - Add --prefix flag alongside --no-prefix - Read/write skill_prefix from ~/.gstack/config.yaml (true/false) - Interactive prompt on first setup when no preference saved - Non-TTY environments default to flat names (no prefix) - Add cleanup_prefixed_claude_symlinks() for reverse direction - Fix gstack-config sed portability (mktemp+mv instead of BSD sed -i '') - Add SKILL_PREFIX to preamble output with namespace-aware instruction * test: add prefix config tests + README switching instructions 8 structural tests for persistent prefix setting: config reading, --prefix flag, config persistence, interactive prompt, TTY fallback, reverse cleanup, cleanup ordering, welcome. * chore: regenerate SKILL.md files with SKILL_PREFIX preamble * chore: bump version and changelog (v0.12.11.0) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * docs: reframe changelog as feature, not mea culpa * docs: update CONTRIBUTING + CLAUDE.md for prefix-aware vendoring - CONTRIBUTING: vendoring now includes ./setup step for per-skill symlinks - CONTRIBUTING: prefix choice documented in contributor workflow + dev diagram - CONTRIBUTING: switching prefix mode section added - CLAUDE.md: vendored symlink awareness section covers prefix setting Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.3 KiB
Bash
Executable File
41 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# gstack-config — read/write ~/.gstack/config.yaml
|
|
#
|
|
# Usage:
|
|
# gstack-config get <key> — read a config value
|
|
# gstack-config set <key> <value> — write a config value
|
|
# gstack-config list — show all config
|
|
#
|
|
# Env overrides (for testing):
|
|
# GSTACK_STATE_DIR — override ~/.gstack state directory
|
|
set -euo pipefail
|
|
|
|
STATE_DIR="${GSTACK_STATE_DIR:-$HOME/.gstack}"
|
|
CONFIG_FILE="$STATE_DIR/config.yaml"
|
|
|
|
case "${1:-}" in
|
|
get)
|
|
KEY="${2:?Usage: gstack-config get <key>}"
|
|
grep -E "^${KEY}:" "$CONFIG_FILE" 2>/dev/null | tail -1 | awk '{print $2}' | tr -d '[:space:]' || true
|
|
;;
|
|
set)
|
|
KEY="${2:?Usage: gstack-config set <key> <value>}"
|
|
VALUE="${3:?Usage: gstack-config set <key> <value>}"
|
|
mkdir -p "$STATE_DIR"
|
|
if grep -qE "^${KEY}:" "$CONFIG_FILE" 2>/dev/null; then
|
|
# Portable in-place edit (BSD sed uses -i '', GNU sed uses -i without arg)
|
|
_tmpfile="$(mktemp "${CONFIG_FILE}.XXXXXX")"
|
|
sed "s/^${KEY}:.*/${KEY}: ${VALUE}/" "$CONFIG_FILE" > "$_tmpfile" && mv "$_tmpfile" "$CONFIG_FILE"
|
|
else
|
|
echo "${KEY}: ${VALUE}" >> "$CONFIG_FILE"
|
|
fi
|
|
;;
|
|
list)
|
|
cat "$CONFIG_FILE" 2>/dev/null || true
|
|
;;
|
|
*)
|
|
echo "Usage: gstack-config {get|set|list} [key] [value]"
|
|
exit 1
|
|
;;
|
|
esac
|