whendone 0.0.0-stage → 1.0.0
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 +31 -2
- package/bin/install.js +18 -0
- package/package.json +24 -4
package/README.md
CHANGED
|
@@ -1,3 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# whendone (Windows)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A Claude Code plugin that puts the PC to sleep or shuts it down once every running Claude Code task has finished.
|
|
4
|
+
|
|
5
|
+
## How it works
|
|
6
|
+
- Plugin hooks mark each session as running when you send a prompt (`UserPromptSubmit`) and as finished when Claude stops (`Stop`, `StopFailure` for API errors, `SessionEnd`). The markers live in `%LOCALAPPDATA%\claude-autoshutdown`.
|
|
7
|
+
- When you arm it, a watcher window waits until no session is running, then counts down 60 s and acts. If a task starts again during the countdown, it goes back to waiting.
|
|
8
|
+
- A session whose transcript hasn't changed for 30 min counts as finished. This catches interrupted or crashed sessions, which never fire `Stop`.
|
|
9
|
+
- It only acts after it has seen at least one task running since you armed it. Arming from inside Claude counts that session too, so arming with nothing else running sleeps the PC about a minute later.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
```powershell
|
|
13
|
+
npx whendone
|
|
14
|
+
```
|
|
15
|
+
Then restart Claude Code. The command adds this repo as a plugin marketplace and installs the plugin from it.
|
|
16
|
+
|
|
17
|
+
Without npm, run these instead:
|
|
18
|
+
```powershell
|
|
19
|
+
claude plugin marketplace add nischal-masand/whendone
|
|
20
|
+
claude plugin install whendone@whendone
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
To work on a local copy, add the folder itself as the marketplace (`claude plugin marketplace add <path>`). The plugin runs from a copy in `~/.claude/plugins/cache`, so after editing files, bump `version` in `.claude-plugin/plugin.json` and run `claude plugin update whendone@whendone`.
|
|
24
|
+
|
|
25
|
+
## Use
|
|
26
|
+
- In any Claude Code session: `/whendone-sleep` or `/whendone-shutdown`. You can queue it behind a running task in the same session.
|
|
27
|
+
- Or double-click **Sleep when done.cmd** / **Shutdown when done.cmd** in this folder.
|
|
28
|
+
- To cancel, close the watcher window or press Ctrl+C in it.
|
|
29
|
+
|
|
30
|
+
Options: `autoshutdown.ps1 -Action Sleep|Shutdown -CountdownSeconds 60 -StaleMinutes 30 -DryRun`
|
|
31
|
+
|
|
32
|
+
`-DryRun` prints what it would do instead of doing it. `test.ps1` runs a self-check and never sleeps or shuts down the PC.
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// One-command install: npx whendone
|
|
3
|
+
// Adds this repo as a Claude Code plugin marketplace, then installs the plugin from it.
|
|
4
|
+
const { spawnSync } = require('node:child_process');
|
|
5
|
+
|
|
6
|
+
// Commands are fixed strings, so running them through the shell is safe (needed to find claude.cmd on Windows).
|
|
7
|
+
const run = (cmd, quiet) => spawnSync(cmd, { shell: true, stdio: quiet ? 'ignore' : 'inherit' }).status;
|
|
8
|
+
|
|
9
|
+
if (run('claude --version', true) !== 0) {
|
|
10
|
+
console.error('Claude Code is not installed or not on PATH. Install it first: https://claude.com/claude-code');
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// Fails harmlessly when the marketplace was added before; the install below still runs.
|
|
15
|
+
run('claude plugin marketplace add nischal-masand/whendone');
|
|
16
|
+
if (run('claude plugin install whendone@whendone') !== 0) process.exit(1);
|
|
17
|
+
|
|
18
|
+
console.log('\nInstalled. Restart Claude Code, then type /whendone-sleep or /whendone-shutdown in any session.');
|
package/package.json
CHANGED
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "whendone",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Sleep or shut down Windows once every running Claude Code task has finished.",
|
|
5
|
+
"bin": {
|
|
6
|
+
"whendone": "bin/install.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin/"
|
|
10
|
+
],
|
|
11
|
+
"os": [
|
|
12
|
+
"win32"
|
|
13
|
+
],
|
|
14
|
+
"keywords": [
|
|
15
|
+
"claude-code",
|
|
16
|
+
"claude-code-plugin",
|
|
17
|
+
"windows",
|
|
18
|
+
"sleep",
|
|
19
|
+
"shutdown"
|
|
20
|
+
],
|
|
21
|
+
"repository": {
|
|
22
|
+
"type": "git",
|
|
23
|
+
"url": "git+https://github.com/nischal-masand/whendone.git"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/nischal-masand/whendone"
|
|
26
|
+
}
|