mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-21 12:20:48 +02:00
56 lines
3.2 KiB
Markdown
56 lines
3.2 KiB
Markdown
<!-- GENERATED by scripts/gstack2/generate-skill-tree.ts; do not edit. -->
|
|
<!-- GSTACK2_PROVENANCE source=careful/SKILL.md.tmpl base=bb57306d98c97011b0919c6132705a15b1579781 blob=5c128a00e180bec4fad281486d3ca8c02dc67e7e baseline_render_sha256=e78a8aff9e6f53f497e4bdc1e15955df7d09333283a6133c9fb8bfacf98a692e ported_render_sha256=9c806d1102794aeab5c83990c72dcadc7bdad7134f3962da5609ab13bc7feb0f disposition=BUG_FIX -->
|
|
<!-- GSTACK2_ROUTING replacement=$debug --mode Diagnose-only --module careful visibility=internal depth=standard mutation=safety-policy web=none -->
|
|
|
|
<!-- GSTACK2_LEGACY_BODY_START source=careful -->
|
|
> **Safety Advisory:** This skill includes safety checks that check bash commands for destructive operations (rm -rf, DROP TABLE, force-push, git reset --hard, etc.) before execution. When using this skill, always pause and verify before executing potentially destructive operations. If uncertain about a command's safety, ask the user for confirmation before proceeding.
|
|
|
|
|
|
# /careful — Destructive Command Guardrails
|
|
|
|
Safety mode is now **active**. Every bash command will be checked for destructive
|
|
patterns before running. If a destructive command is detected, you'll be warned
|
|
and can choose to proceed or cancel.
|
|
|
|
```bash
|
|
mkdir -p "${GSTACK_HOME:-$HOME/.gstack}"/analytics
|
|
echo '{"skill":"careful","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> "${GSTACK_HOME:-$HOME/.gstack}"/analytics/skill-usage.jsonl 2>/dev/null || true
|
|
```
|
|
|
|
## What's protected
|
|
|
|
| Pattern | Example | Risk |
|
|
|---------|---------|------|
|
|
| `rm -rf` / `rm -r` / `rm --recursive` | `rm -rf /var/data` | Recursive delete |
|
|
| `DROP TABLE` / `DROP DATABASE` | `DROP TABLE users;` | Data loss |
|
|
| `TRUNCATE` | `TRUNCATE orders;` | Data loss |
|
|
| `git push --force` / `-f` | `git push -f origin main` | History rewrite |
|
|
| `git reset --hard` | `git reset --hard HEAD~3` | Uncommitted work loss |
|
|
| `git checkout .` / `git restore .` | `git checkout .` | Uncommitted work loss |
|
|
| `kubectl delete` | `kubectl delete pod` | Production impact |
|
|
| `docker rm -f` / `docker system prune` | `docker system prune -a` | Container/image loss |
|
|
|
|
## Safe exceptions
|
|
|
|
These patterns are allowed without warning:
|
|
- `rm -rf node_modules` / `.next` / `dist` / `__pycache__` / `.cache` / `build` / `.turbo` / `coverage`
|
|
|
|
## How it works
|
|
|
|
The hook reads the command from the tool input JSON, checks it against the
|
|
patterns above, and returns `permissionDecision: "ask"` with a warning message
|
|
if a match is found. You can always override the warning and proceed.
|
|
|
|
To deactivate, end the conversation or start a new one. Hooks are session-scoped.
|
|
<!-- GSTACK2_LEGACY_BODY_END source=careful -->
|
|
|
|
<!-- GSTACK2_BUG_FIX_START pr=679 anchor=GSTACK2_FIX_679_MATCH_USER_LANGUAGE -->
|
|
## Upstream judgment port: PR #679
|
|
|
|
[Match the user language](https://github.com/garrytan/gstack/pull/679)
|
|
|
|
### User-language rule
|
|
|
|
Write questions, progress updates, reports, and artifacts in the language used by the user. Source material, code identifiers, commands, and quotations may remain in their original language when translating them would reduce accuracy.
|
|
<!-- GSTACK2_BUG_FIX_END pr=679 -->
|