@akilles/soundcloud-watcher 2.0.3 → 2.0.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 CHANGED
@@ -2,214 +2,160 @@
2
2
 
3
3
  Monitor your SoundCloud account and track artist releases. Get notified when someone follows you, likes your tracks, or when artists you care about drop new music.
4
4
 
5
-
6
5
  ## Features
7
6
 
8
7
  - **Follower tracking** - See who followed you recently
9
8
  - **Track engagement** - Monitor who liked your tracks
10
9
  - **New releases** - Get notifications when tracked artists release new music
11
- - **Smart API usage** - Only fetches what changed, automatically skips dormant artists (configurable threshold)
10
+ - **Smart API usage** - Only fetches what changed, automatically skips dormant artists
12
11
  - **Rate limit handling** - Exponential backoff for API reliability
13
- - **Automatic background checking** - Configurable interval (default: 6 hours)
14
- - **Session-agnostic notifications** - Works with any OpenClaw session (Telegram, Discord, etc.)
15
12
 
16
13
  ## Prerequisites
17
14
 
18
15
  - OpenClaw gateway running
19
16
  - Node.js 22+ installed
20
- - SoundCloud API credentials ([get them here](https://soundcloud.com/you/apps))
17
+ - SoundCloud API credentials
21
18
 
22
19
  ## Quick Start
23
20
 
24
21
  ### 1. Install
25
22
 
26
23
  ```bash
27
- # From npm (recommended)
28
24
  openclaw plugins install @akilles/soundcloud-watcher
29
-
30
- # Or from source
31
- git clone https://github.com/wlinds/openclaw-soundcloud-watcher
32
- openclaw plugins install -l ./openclaw-soundcloud-watcher/openclaw-soundcloud-watcher
25
+ openclaw plugins enable soundcloud-watcher
26
+ openclaw gateway restart
33
27
  ```
34
28
 
35
-
36
29
  ### 2. Get SoundCloud Credentials
37
30
 
38
31
  1. Log into SoundCloud
39
32
  2. Go to [soundcloud.com/you/apps](https://soundcloud.com/you/apps)
40
33
  3. Click "Register a new application"
41
- 4. Fill in name and website
42
- 5. Copy your **Client ID** and **Client Secret** for next step
34
+ 4. Fill in name and website (any URL works)
35
+ 5. Copy your **Client ID** and **Client Secret**
43
36
 
44
37
  ### 3. Configure
45
38
 
46
- Run the setup command to see the configuration template:
39
+ Create the credentials file:
47
40
 
48
41
  ```bash
49
- /soundcloud-setup
50
- ```
51
-
52
- Then edit `~/.openclaw/openclaw.json` and paste your credentials:
53
-
54
- ```json
55
- {
56
- "plugins": {
57
- "enabled": true,
58
- "entries": {
59
- "soundcloud-watcher": {
60
- "enabled": true,
61
- "config": {
62
- "clientId": "YOUR_CLIENT_ID",
63
- "clientSecret": "YOUR_CLIENT_SECRET",
64
- "username": "your_soundcloud_username",
65
- "checkIntervalHours": 6,
66
- "myTracksLimit": 10,
67
- "dormantDays": 90,
68
- "sessionKey": "agent:main:main"
69
- }
70
- }
71
- }
72
- }
73
- }
42
+ nano ~/.openclaw/secrets/soundcloud.env
74
43
  ```
75
44
 
76
- ### 4. Restart & Verify
45
+ Add your credentials:
77
46
 
78
- ```bash
79
- openclaw gateway restart
80
- openclaw plugins list # Should show soundcloud-watcher
81
- /soundcloud-status # Should show your account info
47
+ ```
48
+ SOUNDCLOUD_CLIENT_ID=your_client_id
49
+ SOUNDCLOUD_CLIENT_SECRET=your_client_secret
50
+ MY_USERNAME=your_soundcloud_username
82
51
  ```
83
52
 
84
- ### 5. Start Tracking your favorite artist
53
+ ### 4. Restart & Verify
85
54
 
86
55
  ```bash
87
- /soundcloud-add lindstedt
88
- /soundcloud-add noisia
89
- /soundcloud-list
56
+ openclaw gateway restart
90
57
  ```
91
58
 
92
- Done! Updates arrive automatically every 6 hours.
59
+ Then in chat:
60
+ ```
61
+ /soundcloud-setup # Should show "Already configured!"
62
+ /soundcloud-status # Should show your account info
63
+ ```
93
64
 
94
65
  ## Commands
95
66
 
96
67
  | Command | Description |
97
68
  |---------|-------------|
98
- | `/soundcloud-setup` | Interactive setup guide with config status |
69
+ | `/soundcloud-setup` | Show setup instructions and config status |
99
70
  | `/soundcloud-status` | Show tracking status and account info |
100
- | `/soundcloud-check` | Run immediate check (don't wait for interval) |
71
+ | `/soundcloud-check` | Run immediate check (verbose output) |
72
+ | `/soundcloud-cron` | Run check for automation (silent if no updates) |
101
73
  | `/soundcloud-add <username>` | Track artist(s) - space-separated |
102
- | `/soundcloud-remove <username>` | Untrack artist |
74
+ | `/soundcloud-remove <username>` | Stop tracking an artist |
103
75
  | `/soundcloud-list` | List all tracked artists |
104
76
 
105
- ## Configuration Options
106
-
107
- All options in `~/.openclaw/openclaw.json` under `plugins.entries.soundcloud-watcher.config`:
108
-
109
- | Option | Type | Required | Default | Description |
110
- |--------|------|----------|---------|-------------|
111
- | `enabled` | boolean | No | true | Enable/disable watcher |
112
- | `clientId` | string | Yes | - | SoundCloud API Client ID |
113
- | `clientSecret` | string | Yes | - | SoundCloud API Client Secret |
114
- | `username` | string | Yes | - | Your SoundCloud username |
115
- | `checkIntervalHours` | number | No | 6 | Hours between automatic checks |
116
- | `myTracksLimit` | number | No | 10 | Number of your tracks to monitor |
117
- | `dormantDays` | number | No | 90 | Days before artist is considered dormant |
118
- | `sessionKey` | string | No | `agent:main:main` | OpenClaw session for notifications |
77
+ ## Automated Checking
119
78
 
120
- ## Architecture
79
+ The plugin responds to commands but doesn't auto-poll. Set up a cron job for automatic notifications:
121
80
 
122
- The plugin consists of three main components:
81
+ ```bash
82
+ openclaw cron add --name "soundcloud-check" \
83
+ --every 6h \
84
+ --isolated \
85
+ --message "Run /soundcloud-cron and forward any updates to me on Telegram."
86
+ ```
123
87
 
124
- - **Plugin entry** ([openclaw-soundcloud-watcher/index.ts](openclaw-soundcloud-watcher/index.ts)) - Manages lifecycle, spawns watcher process
125
- - **Watcher** ([openclaw-soundcloud-watcher/soundcloud_watcher.ts](openclaw-soundcloud-watcher/soundcloud_watcher.ts)) - Pure TypeScript implementation of monitoring logic
126
- - **Manifest** ([openclaw-soundcloud-watcher/openclaw.plugin.json](openclaw-soundcloud-watcher/openclaw.plugin.json)) - Configuration schema and plugin metadata
88
+ Uses `/soundcloud-cron` which:
89
+ - Returns updates only (silent if nothing new)
90
+ - Logs errors but doesn't spam on config issues
127
91
 
128
- ### File Locations
92
+ **Alternative:** Add to your `HEARTBEAT.md`:
93
+ ```markdown
94
+ - [ ] Run /soundcloud-cron if not checked in last 6 hours
95
+ ```
129
96
 
130
- After installation:
97
+ ## File Locations
131
98
 
132
- - **Plugin code:** `~/.openclaw/extensions/soundcloud-watcher/`
133
- - **Config:** `~/.openclaw/openclaw.json`
134
- - **Credentials:** `~/.openclaw/secrets/soundcloud.env`
135
- - **Account data:** `~/.openclaw/data/soundcloud_tracking.json`
136
- - **Artist data:** `~/.openclaw/data/artists.json`
137
- - **Backoff state:** `~/.openclaw/soundcloud_backoff.json`
99
+ | File | Purpose |
100
+ |------|---------|
101
+ | `~/.openclaw/secrets/soundcloud.env` | Your API credentials |
102
+ | `~/.openclaw/data/artists.json` | Tracked artists data |
103
+ | `~/.openclaw/data/soundcloud_tracking.json` | Your account tracking data |
138
104
 
139
105
  ## Troubleshooting
140
106
 
141
- ### Plugin not loading
142
-
143
- ```bash
144
- openclaw plugins list
145
- openclaw gateway logs
146
- ```
107
+ ### "Not configured" error
147
108
 
148
- Check that:
149
- - Plugin shows as `enabled: true` in list
150
- - Gateway logs don't show errors
109
+ Check your credentials file exists and has correct format:
151
110
 
152
- Verify plugin directory exists:
153
111
  ```bash
154
- ls -la ~/.openclaw/extensions/soundcloud-watcher/
112
+ cat ~/.openclaw/secrets/soundcloud.env
155
113
  ```
156
114
 
157
- ### API rate limits
158
-
159
- If you hit rate limits:
160
- 1. Increase `checkIntervalHours` in config (default: 6)
161
- 2. Increase `dormantDays` to skip inactive artists sooner (default: 90)
162
- 3. Check SoundCloud API status
163
-
164
- ### No notifications
115
+ Should contain:
116
+ ```
117
+ SOUNDCLOUD_CLIENT_ID=...
118
+ SOUNDCLOUD_CLIENT_SECRET=...
119
+ MY_USERNAME=...
120
+ ```
165
121
 
166
- Check gateway session key in the plugin config (default is `agent:main:main`).
122
+ ### Plugin not loading
167
123
 
168
- Verify gateway is running:
169
124
  ```bash
170
- openclaw gateway status
125
+ openclaw plugins list
171
126
  ```
172
127
 
173
- ### Setup help
174
-
175
- Run `/soundcloud-setup` for detailed instructions with current config status.
128
+ Should show `soundcloud-watcher` as `loaded`. If `disabled`:
176
129
 
177
- ## Updating
178
-
179
- If installed via symlink (`-l`):
180
130
  ```bash
181
- cd /path/to/openclaw-soundcloud-watcher
182
- git pull
131
+ openclaw plugins enable soundcloud-watcher
183
132
  openclaw gateway restart
184
133
  ```
185
134
 
186
- If installed from npm:
187
- ```bash
188
- openclaw plugins install @akilles/soundcloud-watcher # Gets latest
189
- openclaw gateway restart
190
- ```
135
+ ### API rate limits
136
+
137
+ The plugin handles rate limits automatically with exponential backoff. If issues persist, wait a few minutes and try again.
191
138
 
192
139
  ## Uninstalling
193
140
 
194
141
  ```bash
195
142
  openclaw plugins disable soundcloud-watcher
196
- openclaw plugins uninstall soundcloud-watcher
143
+ rm -rf ~/.openclaw/extensions/soundcloud-watcher
197
144
  ```
198
145
 
199
- Clean up data (optional):
146
+ Optionally remove data:
200
147
  ```bash
201
- rm -rf ~/.openclaw/data/soundcloud_tracking.json
202
- rm -rf ~/.openclaw/data/artists.json
203
- rm -rf ~/.openclaw/secrets/soundcloud.env
204
- rm -rf ~/.openclaw/soundcloud_backoff.json
148
+ rm ~/.openclaw/secrets/soundcloud.env
149
+ rm ~/.openclaw/data/artists.json
150
+ rm ~/.openclaw/data/soundcloud_tracking.json
205
151
  ```
206
152
 
207
- ## Support
153
+ ## Links
208
154
 
209
155
  - **GitHub:** https://github.com/wlinds/openclaw-soundcloud-watcher
210
- - **Issues:** https://github.com/wlinds/openclaw-soundcloud-watcher/issues
156
+ - **npm:** https://www.npmjs.com/package/@akilles/soundcloud-watcher
211
157
  - **OpenClaw Docs:** https://docs.openclaw.ai/plugin
212
158
 
213
159
  ## License
214
160
 
215
- MIT - See [LICENSE](LICENSE) for details
161
+ MIT
package/index.ts CHANGED
@@ -178,5 +178,29 @@ MY_USERNAME=your_soundcloud_username
178
178
  },
179
179
  });
180
180
 
181
+ api.registerCommand({
182
+ name: 'soundcloud-cron',
183
+ description: 'Run check for cron (only outputs if there are updates)',
184
+ handler: async () => {
185
+ const w = getWatcher();
186
+ if (!w) {
187
+ (logger.warn ?? console.warn).call(logger, 'SoundCloud cron: not configured');
188
+ return { text: '' }; // Silent fail for cron
189
+ }
190
+ try {
191
+ const result = await w.runCron();
192
+ if (result) {
193
+ return { text: result };
194
+ }
195
+ // No updates - return empty (silent success)
196
+ (logger.debug ?? console.log).call(logger, 'SoundCloud cron: no updates');
197
+ return { text: '' };
198
+ } catch (e) {
199
+ (logger.error ?? console.error).call(logger, 'SoundCloud cron error:', e);
200
+ return { text: `SoundCloud check failed: ${e}` };
201
+ }
202
+ },
203
+ });
204
+
181
205
  (logger.info ?? console.log).call(logger, 'SoundCloud Watcher plugin loaded');
182
206
  }
@@ -2,7 +2,7 @@
2
2
  "id": "soundcloud-watcher",
3
3
  "name": "SoundCloud Watcher",
4
4
  "description": "Monitor your SoundCloud account and track artist releases",
5
- "version": "2.0.3",
5
+ "version": "2.0.4",
6
6
  "configSchema": {
7
7
  "type": "object",
8
8
  "additionalProperties": false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akilles/soundcloud-watcher",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "description": "OpenClaw plugin to monitor SoundCloud account and track artist releases",
5
5
  "main": "index.ts",
6
6
  "openclaw": {
@@ -138,6 +138,9 @@ function ensureDir(filepath: string): void {
138
138
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
139
139
  }
140
140
 
141
+ // Note: Security scanners may flag this as "file read + network send" (potential exfiltration).
142
+ // This is a false positive — readJson only loads local state files (tracking data, backoff state).
143
+ // The network calls are to the SoundCloud API, not exfiltrating file contents.
141
144
  function readJson<T>(filepath: string, fallback: T): T {
142
145
  try {
143
146
  if (fs.existsSync(filepath)) {