session-planner 1.1.3 → 1.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -2
- package/package.json +2 -2
- package/scripts/hello-scheduler.sh +19 -2
package/README.md
CHANGED
|
@@ -118,6 +118,15 @@ scripts/hello-scheduler.sh (bash)
|
|
|
118
118
|
| **Bash** 4+ | macOS: `brew install bash` |
|
|
119
119
|
| **OS Support** | macOS and Linux (terminal use) |
|
|
120
120
|
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 🔐 Permissions (macOS)
|
|
124
|
+
|
|
125
|
+
To ensure `session-planner` can schedule jobs and show notifications without prompting every time, grant your terminal (Terminal or iTerm) the following:
|
|
126
|
+
|
|
127
|
+
1. **Full Disk Access**: Go to `System Settings > Privacy & Security > Full Disk Access` and add your terminal. This is required for `crontab` to save your schedule.
|
|
128
|
+
2. **Notifications**: Go to `System Settings > Notifications > Script Editor` and ensure "Allow Notifications" is on.
|
|
129
|
+
|
|
121
130
|
|
|
122
131
|
Logs: `~/.claude/session-planner.log`
|
|
123
132
|
|
|
@@ -127,9 +136,11 @@ Logs: `~/.claude/session-planner.log`
|
|
|
127
136
|
|
|
128
137
|
```
|
|
129
138
|
SessionPlanner/
|
|
130
|
-
├──
|
|
139
|
+
├── scripts/
|
|
140
|
+
│ └── hello-scheduler.sh ← core scheduling logic
|
|
141
|
+
├── commands/
|
|
142
|
+
│ └── hello.md ← command definition
|
|
131
143
|
├── session-planner.js ← npx / global CLI entry
|
|
132
|
-
├── {hello,hello-list,hello-remove}.md ← command definitions
|
|
133
144
|
├── package.json
|
|
134
145
|
└── README.md
|
|
135
146
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "session-planner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.5",
|
|
4
4
|
"description": "Schedule Hello! Claude Code sessions at specific times. Opens a session N hours before your chosen time.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -40,4 +40,4 @@
|
|
|
40
40
|
"README.md",
|
|
41
41
|
"LICENSE"
|
|
42
42
|
]
|
|
43
|
-
}
|
|
43
|
+
}
|
|
@@ -119,6 +119,16 @@ pretty_time() {
|
|
|
119
119
|
printf "%d:%02d %s" $ph $m $suffix
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
send_notification() {
|
|
123
|
+
local msg="$1"
|
|
124
|
+
local title="Session Planner"
|
|
125
|
+
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
126
|
+
osascript -e "display notification \"$msg\" with title \"$title\""
|
|
127
|
+
elif command -v notify-send >/dev/null; then
|
|
128
|
+
notify-send "$title" "$msg"
|
|
129
|
+
fi
|
|
130
|
+
}
|
|
131
|
+
|
|
122
132
|
# Seconds until next occurrence of HH:MM (today or tomorrow)
|
|
123
133
|
seconds_until() {
|
|
124
134
|
local th=$1 tm=$2
|
|
@@ -209,6 +219,9 @@ fi
|
|
|
209
219
|
mkdir -p "$HOME/.claude"
|
|
210
220
|
LOG="$HOME/.claude/session-planner.log"
|
|
211
221
|
|
|
222
|
+
# ── find claude path for cron ──────────────────────────────────────────────────
|
|
223
|
+
CLAUDE_PATH=$(which claude 2>/dev/null || echo "claude")
|
|
224
|
+
|
|
212
225
|
# ── load crontab, strip existing session-planner entries ─────────────────────
|
|
213
226
|
|
|
214
227
|
tmp=$(mktemp)
|
|
@@ -239,10 +252,11 @@ for T in "${TIMES[@]}"; do
|
|
|
239
252
|
TARGET_PRETTY=$(pretty_time "$TARGET_H" "$TARGET_M")
|
|
240
253
|
SCHED_PRETTY=$(pretty_time "$SCHED_H" "$SCHED_M")
|
|
241
254
|
|
|
242
|
-
# cron job: claude --print fires at session-open time
|
|
255
|
+
# cron job: claude --print fires at session-open time + notification
|
|
243
256
|
MSG="Hello! It is now ${TARGET_PRETTY}. This is your scheduled greeting."
|
|
244
257
|
CRON_EXPR="${SCHED_M} ${SCHED_H} * * *"
|
|
245
|
-
|
|
258
|
+
# We use a subshell for the notification to handle the environment/osascript better
|
|
259
|
+
CRON_LINE="${CRON_EXPR} ${CLAUDE_PATH} --print \"${MSG}\" >> ${LOG} 2>&1; if [ \"\$(uname)\" = \"Darwin\" ]; then osascript -e \"display notification \\\"${MSG}\\\" with title \\\"Session Planner\\\"\"; elif command -v notify-send >/dev/null; then notify-send \"Session Planner\" \"${MSG}\"; fi"
|
|
246
260
|
|
|
247
261
|
{
|
|
248
262
|
echo "# session-planner: session at ${SCHED_PRETTY} → greeting at ${TARGET_PRETTY} (offset: ${OFFSET_HOURS}h)"
|
|
@@ -258,6 +272,9 @@ for T in "${TIMES[@]}"; do
|
|
|
258
272
|
SOONEST_SESSION="$SCHED_PRETTY"
|
|
259
273
|
fi
|
|
260
274
|
|
|
275
|
+
# Success message for user
|
|
276
|
+
echo -e "${GREEN}✓${RESET} Scheduled Claude session to start at ${BOLD}${SCHED_PRETTY}${RESET} (greeting at ${TARGET_PRETTY})"
|
|
277
|
+
|
|
261
278
|
# Structured output for Claude to parse
|
|
262
279
|
echo "SCHEDULED: {\"target\":\"${TARGET_PRETTY}\",\"session_at\":\"${SCHED_PRETTY}\",\"cron\":\"${CRON_EXPR}\",\"loop_in_seconds\":${LOOP_SECS},\"offset_hours\":${OFFSET_HOURS}}"
|
|
263
280
|
|