diff --git a/.gitignore b/.gitignore index ce30d749e..08857d49d 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ cmd/picoclaw/workspace # PicoClaw .picoclaw/ +skills/*/data/ config.json sessions/ build/ diff --git a/workspace/skills/prayer-times/SKILL.md b/workspace/skills/prayer-times/SKILL.md index ea83ba9a9..3227d09a0 100644 --- a/workspace/skills/prayer-times/SKILL.md +++ b/workspace/skills/prayer-times/SKILL.md @@ -49,12 +49,12 @@ Saat user **pertama kali** minta reminder sholat: ```bash bash skills/prayer-times/scripts/prayer_notify.sh setup samarinda ``` -Ini akan save config ke `~/.picoclaw/prayer-times/config` dan fetch data bulan ini. +Ini akan save config ke `skills/prayer-times/data/config` dan fetch data bulan ini. ### 3. Setup ntfy (opsional, via exec tool) Jika user memberikan ntfy URL, tambahkan ke config: ```bash -sed -i 's|NTFY_TOPIC=".*"|NTFY_TOPIC="https://ntfy.sh/USER_TOPIC"|' ~/.picoclaw/prayer-times/config +sed -i 's|NTFY_TOPIC=".*"|NTFY_TOPIC="https://ntfy.sh/USER_TOPIC"|' skills/prayer-times/data/config ``` Simpan juga ke MEMORY.md agar tidak lupa. @@ -75,7 +75,7 @@ Simpan juga ke MEMORY.md agar tidak lupa. ## Config File -Disimpan di `~/.picoclaw/prayer-times/config` — **milik skill ini sendiri, tidak shared**: +Disimpan di `skills/prayer-times/data/config` — **milik skill ini sendiri, tidak shared**: ``` CITY="samarinda" SAHUR_MINS="30" diff --git a/workspace/skills/prayer-times/scripts/prayer_notify.sh b/workspace/skills/prayer-times/scripts/prayer_notify.sh index 8e69a00b7..e0f1fd98a 100644 --- a/workspace/skills/prayer-times/scripts/prayer_notify.sh +++ b/workspace/skills/prayer-times/scripts/prayer_notify.sh @@ -8,16 +8,18 @@ # prayer_notify.sh setup — Set city and fetch initial data # prayer_notify.sh status — Show current config and data status # -# Config file: ~/.picoclaw/prayer-times/config +# Config file: skills/prayer-times/data/config (co-located with skill) # Auto-fetch: schedule command auto-fetches if data is missing or stale set -euo pipefail -DATA_DIR="${PRAYER_DATA_DIR:-$HOME/.picoclaw/prayer-times}" +# Resolve paths relative to this script's location +SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" +SKILL_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +DATA_DIR="${PRAYER_DATA_DIR:-$SKILL_DIR/data}" CONFIG_FILE="$DATA_DIR/config" # Locate shared ntfy_send.sh relative to this script -SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)" NTFY_SEND="${SCRIPT_DIR}/../../shared/scripts/ntfy_send.sh" mkdir -p "$DATA_DIR" diff --git a/workspace/skills/reminder/SKILL.md b/workspace/skills/reminder/SKILL.md index 983675948..124409dcf 100644 --- a/workspace/skills/reminder/SKILL.md +++ b/workspace/skills/reminder/SKILL.md @@ -154,12 +154,12 @@ Execute a shell command instead of sending a message. Output is sent to chat. Se Saat user pertama kali minta reminder dengan ntfy, pastikan ntfy topic dikonfigurasi. -Config disimpan di `~/.picoclaw/reminder/ntfy.conf` — **milik skill ini sendiri, tidak shared**. +Config disimpan di `skills/reminder/data/ntfy.conf` — **milik skill ini sendiri, tidak shared**. ### 1. Tanya ntfy topic URL ke user ### 2. Simpan ke config (via exec tool) ```bash -mkdir -p ~/.picoclaw/reminder && echo 'NTFY_TOPIC="https://ntfy.sh/USER_TOPIC"' > ~/.picoclaw/reminder/ntfy.conf +mkdir -p skills/reminder/data && echo 'NTFY_TOPIC="https://ntfy.sh/USER_TOPIC"' > skills/reminder/data/ntfy.conf ``` ### 3. Simpan juga ke MEMORY.md agar tidak lupa @@ -171,7 +171,7 @@ Gunakan shared helper script. **WAJIB source config sendiri sebelum panggil ntfy ```bash # Semua perintah ntfy harus diawali source config -source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC="$NTFY_TOPIC" bash skills/shared/scripts/ntfy_send.sh "MESSAGE" --title "JUDUL" --tags alarm_clock +source skills/reminder/data/ntfy.conf 2>/dev/null; NTFY_TOPIC="$NTFY_TOPIC" bash skills/shared/scripts/ntfy_send.sh "MESSAGE" --title "JUDUL" --tags alarm_clock ``` > **JANGAN pakai curl langsung** ke ntfy. Selalu gunakan `ntfy_send.sh` agar URL dibaca dari config. @@ -186,7 +186,7 @@ source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC="$NTFY_TOPIC" bash ``` **Job 2 — ntfy push:** ```json -{"action": "add", "message": "ntfy: meeting", "command": "source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Meeting dengan tim marketing!' --title Reminder --tags alarm_clock", "at_seconds": 600} +{"action": "add", "message": "ntfy: meeting", "command": "source skills/reminder/data/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Meeting dengan tim marketing!' --title Reminder --tags alarm_clock", "at_seconds": 600} ``` ### Recurring reminder (2 jobs) @@ -197,7 +197,7 @@ source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC="$NTFY_TOPIC" bash ``` **Job 2 — ntfy push:** ```json -{"action": "add", "message": "ntfy: minum air", "command": "source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Jangan lupa minum air!' --title Hydration --tags droplet", "every_seconds": 3600} +{"action": "add", "message": "ntfy: minum air", "command": "source skills/reminder/data/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Jangan lupa minum air!' --title Hydration --tags droplet", "every_seconds": 3600} ``` ### Daily cron reminder (2 jobs) @@ -208,7 +208,7 @@ source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC="$NTFY_TOPIC" bash ``` **Job 2 — ntfy push:** ```json -{"action": "add", "message": "ntfy: daily review", "command": "source ~/.picoclaw/reminder/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Saatnya review laporan harian' --title 'Daily Review' --tags memo", "cron_expr": "0 17 * * 1-5"} +{"action": "add", "message": "ntfy: daily review", "command": "source skills/reminder/data/ntfy.conf 2>/dev/null; NTFY_TOPIC=\"$NTFY_TOPIC\" bash skills/shared/scripts/ntfy_send.sh 'Saatnya review laporan harian' --title 'Daily Review' --tags memo", "cron_expr": "0 17 * * 1-5"} ``` ### Daily report via agent (1 job only, no ntfy)