session-planner 1.1.0 → 1.1.3
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/.claude-plugin/marketplace.json +11 -0
- package/.claude-plugin/plugin.json +10 -0
- package/README.md +2 -0
- package/{hello-list.md → commands/hello-list.md} +1 -1
- package/{hello-remove.md → commands/hello-remove.md} +2 -2
- package/{hello.md → commands/hello.md} +2 -2
- package/package.json +8 -5
- package/{hello-scheduler.sh → scripts/hello-scheduler.sh} +18 -12
- package/session-planner.js +9 -0
package/README.md
CHANGED
|
@@ -116,6 +116,8 @@ scripts/hello-scheduler.sh (bash)
|
|
|
116
116
|
| **Claude Code** | `claude` in PATH — [install](https://code.claude.com) |
|
|
117
117
|
| **cron** | Built-in on macOS; Linux: `sudo apt install cron` |
|
|
118
118
|
| **Bash** 4+ | macOS: `brew install bash` |
|
|
119
|
+
| **OS Support** | macOS and Linux (terminal use) |
|
|
120
|
+
|
|
119
121
|
|
|
120
122
|
Logs: `~/.claude/session-planner.log`
|
|
121
123
|
|
|
@@ -5,6 +5,6 @@ allowed-tools: Bash
|
|
|
5
5
|
|
|
6
6
|
List all scheduled hello sessions:
|
|
7
7
|
|
|
8
|
-
!`bash
|
|
8
|
+
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/hello-scheduler.sh --list`
|
|
9
9
|
|
|
10
10
|
Present the output as a clean table to the user. If no jobs are found, let them know and suggest running `/hello <time>` to schedule one.
|
|
@@ -7,9 +7,9 @@ allowed-tools: Bash
|
|
|
7
7
|
The user wants to remove a scheduled hello session. Their argument is: $ARGUMENTS
|
|
8
8
|
|
|
9
9
|
If the argument is "--all" or "all":
|
|
10
|
-
!`bash
|
|
10
|
+
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/hello-scheduler.sh --remove-all`
|
|
11
11
|
|
|
12
12
|
Otherwise treat $ARGUMENTS as a time and run:
|
|
13
|
-
!`bash
|
|
13
|
+
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/hello-scheduler.sh --remove $ARGUMENTS`
|
|
14
14
|
|
|
15
15
|
Confirm to the user what was removed.
|
|
@@ -10,7 +10,7 @@ The user wants to schedule hello sessions. Their arguments are: $ARGUMENTS
|
|
|
10
10
|
|
|
11
11
|
Execute the scheduler script:
|
|
12
12
|
|
|
13
|
-
!`bash
|
|
13
|
+
!`bash ${CLAUDE_PLUGIN_ROOT}/scripts/hello-scheduler.sh $ARGUMENTS`
|
|
14
14
|
|
|
15
15
|
## Step 2 — Parse the output and report
|
|
16
16
|
|
|
@@ -52,4 +52,4 @@ Tell the user:
|
|
|
52
52
|
2. The offset used (e.g. "4 hours before each target time")
|
|
53
53
|
3. That persistent cron jobs have been registered (survive terminal close)
|
|
54
54
|
4. That the `/loop` in-session reminder was set for the soonest session
|
|
55
|
-
5. How to list or remove jobs: `crontab -l` /
|
|
55
|
+
5. How to list or remove jobs: `crontab -l` / `${CLAUDE_PLUGIN_ROOT}/scripts/hello-scheduler.sh --list` / `--remove-all`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "session-planner",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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",
|
|
@@ -25,15 +25,18 @@
|
|
|
25
25
|
"engines": {
|
|
26
26
|
"node": ">=14.0.0"
|
|
27
27
|
},
|
|
28
|
+
"os": [
|
|
29
|
+
"darwin",
|
|
30
|
+
"linux"
|
|
31
|
+
],
|
|
28
32
|
"scripts": {
|
|
29
33
|
"test": "bash tests/test-parse.sh"
|
|
30
34
|
},
|
|
31
35
|
"files": [
|
|
32
|
-
"hello-scheduler.sh",
|
|
36
|
+
"scripts/hello-scheduler.sh",
|
|
37
|
+
"commands/",
|
|
38
|
+
".claude-plugin/",
|
|
33
39
|
"session-planner.js",
|
|
34
|
-
"hello.md",
|
|
35
|
-
"hello-list.md",
|
|
36
|
-
"hello-remove.md",
|
|
37
40
|
"README.md",
|
|
38
41
|
"LICENSE"
|
|
39
42
|
]
|
|
@@ -76,7 +76,7 @@ timestamp_for() {
|
|
|
76
76
|
|
|
77
77
|
# Parse any supported time format → sets PARSED_HOUR, PARSED_MIN
|
|
78
78
|
parse_time() {
|
|
79
|
-
local raw
|
|
79
|
+
local raw=$(echo "$1" | tr '[:upper:]' '[:lower:]')
|
|
80
80
|
PARSED_HOUR=""; PARSED_MIN=0
|
|
81
81
|
|
|
82
82
|
# 24-hour H:MM or HH:MM
|
|
@@ -103,7 +103,9 @@ parse_time() {
|
|
|
103
103
|
error "Unrecognised time format: '$1'. Try: 1am 2:30pm 14:00"
|
|
104
104
|
fi
|
|
105
105
|
|
|
106
|
-
[[ $PARSED_HOUR -gt 23 ]]
|
|
106
|
+
if [[ $PARSED_HOUR -gt 23 ]]; then
|
|
107
|
+
error "Hour out of range 0-23 (got: $1)"
|
|
108
|
+
fi
|
|
107
109
|
}
|
|
108
110
|
|
|
109
111
|
# 24h hour+min → pretty 12h string
|
|
@@ -130,7 +132,9 @@ seconds_until() {
|
|
|
130
132
|
|
|
131
133
|
# ── argument parsing ──────────────────────────────────────────────────────────
|
|
132
134
|
|
|
133
|
-
[[ $# -eq 0 ]]
|
|
135
|
+
if [[ $# -eq 0 ]]; then
|
|
136
|
+
usage
|
|
137
|
+
fi
|
|
134
138
|
|
|
135
139
|
while [[ $# -gt 0 ]]; do
|
|
136
140
|
case "$1" in
|
|
@@ -158,8 +162,8 @@ done
|
|
|
158
162
|
|
|
159
163
|
if $LIST_MODE; then
|
|
160
164
|
echo -e "${BOLD}Scheduled Hello jobs:${RESET}"
|
|
161
|
-
if crontab -l 2>/dev/null | grep -q "# session-planner"; then
|
|
162
|
-
crontab -l 2>/dev/null | grep "# session-planner"
|
|
165
|
+
if (((crontab -l 2>/dev/null || true) || true) || true) | grep -q "# session-planner"; then
|
|
166
|
+
(((crontab -l 2>/dev/null || true) || true) || true) | grep "# session-planner"
|
|
163
167
|
else
|
|
164
168
|
echo -e " ${YELLOW}No session-planner jobs found.${RESET}"
|
|
165
169
|
fi
|
|
@@ -170,11 +174,11 @@ fi
|
|
|
170
174
|
|
|
171
175
|
if $REMOVE_ALL; then
|
|
172
176
|
tmp=$(mktemp)
|
|
173
|
-
crontab -l 2>/dev/null \
|
|
177
|
+
((crontab -l 2>/dev/null || true) || true) \
|
|
174
178
|
| grep -v "# session-planner" \
|
|
175
179
|
| grep -v "session-planner" \
|
|
176
180
|
> "$tmp" || true
|
|
177
|
-
|
|
181
|
+
cat "$tmp" | crontab -; rm -f "$tmp"
|
|
178
182
|
echo -e "${GREEN}✓${RESET} All session-planner jobs removed."
|
|
179
183
|
exit 0
|
|
180
184
|
fi
|
|
@@ -185,18 +189,20 @@ if [[ -n "$REMOVE_TIME" ]]; then
|
|
|
185
189
|
parse_time "$REMOVE_TIME"
|
|
186
190
|
TARGET_PRETTY=$(pretty_time "$PARSED_HOUR" "$PARSED_MIN")
|
|
187
191
|
tmp=$(mktemp)
|
|
188
|
-
crontab -l 2>/dev/null \
|
|
192
|
+
((crontab -l 2>/dev/null || true) || true) \
|
|
189
193
|
| grep -v "# session-planner.*${TARGET_PRETTY}" \
|
|
190
194
|
| grep -v "Hello! It is now ${TARGET_PRETTY}" \
|
|
191
195
|
> "$tmp" || true
|
|
192
|
-
|
|
196
|
+
cat "$tmp" | crontab -; rm -f "$tmp"
|
|
193
197
|
echo -e "${GREEN}✓${RESET} Removed session-planner job for ${BOLD}${TARGET_PRETTY}${RESET}."
|
|
194
198
|
exit 0
|
|
195
199
|
fi
|
|
196
200
|
|
|
197
201
|
# ── validate at least one time was given ─────────────────────────────────────
|
|
198
202
|
|
|
199
|
-
[[ ${#TIMES[@]} -eq 0 ]]
|
|
203
|
+
if [[ ${#TIMES[@]} -eq 0 ]]; then
|
|
204
|
+
error "Please provide at least one time. E.g: hello-scheduler.sh 1am"
|
|
205
|
+
fi
|
|
200
206
|
|
|
201
207
|
# ── ensure log dir ────────────────────────────────────────────────────────────
|
|
202
208
|
|
|
@@ -206,7 +212,7 @@ LOG="$HOME/.claude/session-planner.log"
|
|
|
206
212
|
# ── load crontab, strip existing session-planner entries ─────────────────────
|
|
207
213
|
|
|
208
214
|
tmp=$(mktemp)
|
|
209
|
-
crontab -l 2>/dev/null \
|
|
215
|
+
((crontab -l 2>/dev/null || true) || true) \
|
|
210
216
|
| grep -v "# session-planner" \
|
|
211
217
|
| grep -v "session-planner" \
|
|
212
218
|
> "$tmp" || true
|
|
@@ -263,7 +269,7 @@ done
|
|
|
263
269
|
JOBS_JSON+="]"
|
|
264
270
|
|
|
265
271
|
# Commit updated crontab
|
|
266
|
-
|
|
272
|
+
cat "$tmp" | crontab -
|
|
267
273
|
rm -f "$tmp"
|
|
268
274
|
|
|
269
275
|
# Summary for Claude's confirmation message
|
package/session-planner.js
CHANGED
|
@@ -21,6 +21,14 @@ const path = require('path');
|
|
|
21
21
|
const fs = require('fs');
|
|
22
22
|
const os = require('os');
|
|
23
23
|
|
|
24
|
+
// ── OS Compatibility Check ───────────────────────────────────────────────────
|
|
25
|
+
if (process.platform === 'win32') {
|
|
26
|
+
console.error('\x1b[31mERROR:\x1b[0m session-planner currently only supports macOS and Linux.');
|
|
27
|
+
console.error('This tool relies on bash and cron, which are not natively available on Windows.');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
24
32
|
// ── colours ───────────────────────────────────────────────────────────────────
|
|
25
33
|
const isTTY = process.stdout.isTTY;
|
|
26
34
|
const c = {
|
|
@@ -38,6 +46,7 @@ const c = {
|
|
|
38
46
|
// 2. Installed as a Claude Code plugin ~/.claude/plugins/session-planner/scripts/
|
|
39
47
|
function findScript() {
|
|
40
48
|
const candidates = [
|
|
49
|
+
path.join(__dirname, 'scripts', 'hello-scheduler.sh'),
|
|
41
50
|
path.join(__dirname, 'hello-scheduler.sh'),
|
|
42
51
|
path.join(os.homedir(), '.claude', 'plugins', 'session-planner', 'scripts', 'hello-scheduler.sh'),
|
|
43
52
|
];
|