set-rpe · diff

git:20260514.619e732 to git:20260703.3a656fb

12 added, 21 removed. Audit A to A.

---
name: set-rpe
description: Manually record RPE and subjective notes for a specific Strava activity. Use for backfilling, correcting entries, or rating a non-latest activity that the auto-capture skill skipped.
allowed-tools:
- - Read
- - Edit
- - Write
- - mcp__strava__get-recent-activities
+ - Bash(bun *fitness-lab.ts*)
---
# Set RPE
- Records perceived effort and subjective notes for any Strava activity.
+ Records perceived effort and subjective notes for any Strava activity. Thin wrapper over `scripts/fitness-lab.ts rpe`, which validates the RPE, resolves `latest` if needed, and does the atomic upsert into `state/activity-notes.json`.
## Usage
```
/claude-code-fitness-hermit:set-rpe <activity-id|latest> <rpe> [notes...]
```
## Steps
1. Parse arguments:
- First arg: activity ID (integer) or the literal string `latest`.
- Second arg: RPE (must be an integer 1–10).
- - Remaining args: optional free-text notes. If absent or whitespace-only after join, set `notes` to `null`.
- - If `latest`: call `mcp__strava__get-recent-activities` with `perPage: 1` and use the returned activity's `id`.
- - If any required arg is missing or `rpe` is outside 1–10, respond with usage and stop.
+ - Remaining args: optional free-text notes.
+ - If any required arg is missing, respond with the usage line and stop (the script also rejects an out-of-range RPE with a `fetch` error and exit 1).
- 2. Read `.claude-code-hermit/state/activity-notes.json`, or use `{}` if absent. Record the previous value for this activity_id if one exists.
+ 2. Run the script:
- 3. Write the entry (create or overwrite). The `notes` field is always present: `null` when no notes were provided, never missing.
- ```json
- {
- "<activity_id>": {
- "rpe": <int>,
- "notes": <string|null>,
- "recorded_at": "<ISO 8601 with offset>"
- }
- }
```
+ bun ${CLAUDE_PLUGIN_ROOT}/scripts/fitness-lab.ts rpe <activity-id|latest> <rpe> [notes...]
+ ```
- 4. Confirm:
- - If no prior entry: `"Saved RPE <rpe>/10 for activity <id>."`
- - If overwriting: `"Updated RPE for activity <id>. (was: RPE <old_rpe>/10 — <old_notes>)"`
+ The script writes `{rpe, notes, recorded_at}` keyed by activity ID (`notes` is `null` when none were provided) and emits `{activity_id, written:true, previous:{…}|null}`. On `{"error":"strava_auth",…}` (only reachable via `latest`, which resolves the ID from Strava) relay the message verbatim; on `{"error":"fetch",…}` report it and stop.
+
+ 3. Confirm from the returned JSON:
+ - If `previous` is `null`: `"Saved RPE <rpe>/10 for activity <activity_id>."`
+ - If `previous` is present: `"Updated RPE for activity <activity_id>. (was: RPE <previous.rpe>/10 — <previous.notes>)"`