Rename smartrun to geniusrun throughout the codebase
Updates the Go module path, cmd/smartrund -> cmd/geniusrund, the smartrun-dev skill, .gitignore, and every reference in docs/CLAUDE.md to match.
This commit is contained in:
@@ -774,7 +774,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"smartrun/backend/internal/store"
|
||||
"geniusrun/backend/internal/store"
|
||||
)
|
||||
|
||||
func validateProfile(p store.Profile) error {
|
||||
@@ -1007,8 +1007,8 @@ import (
|
||||
|
||||
"github.com/go-chi/chi/v5"
|
||||
|
||||
"smartrun/backend/internal/classify"
|
||||
"smartrun/backend/internal/store"
|
||||
"geniusrun/backend/internal/classify"
|
||||
"geniusrun/backend/internal/store"
|
||||
)
|
||||
|
||||
// workoutKindResponse combines a workout kind's rule/metadata with its pace
|
||||
@@ -1376,7 +1376,7 @@ Expected: all PASS. `TestBuildMetricContext_DerivesExpectedMetrics` is untouched
|
||||
- [ ] **Step 5: Run the full backend test suite**
|
||||
|
||||
Run: `cd backend && go build ./... && go vet ./... && go test ./...`
|
||||
Expected: all PASS. If `cmd/smartrund/main.go` fails to build because it still references `MaxHR: cfg.MaxHR` in its `appsync.Config{...}` literal, that's expected — Task 8 fixes `cmd/smartrund` and `internal/config` together; this step is allowed to show that build failure so you can confirm it's exactly (and only) that one line before moving to Task 8.
|
||||
Expected: all PASS. If `cmd/geniusrund/main.go` fails to build because it still references `MaxHR: cfg.MaxHR` in its `appsync.Config{...}` literal, that's expected — Task 8 fixes `cmd/geniusrund` and `internal/config` together; this step is allowed to show that build failure so you can confirm it's exactly (and only) that one line before moving to Task 8.
|
||||
|
||||
- [ ] **Step 6: Commit**
|
||||
|
||||
@@ -1387,22 +1387,22 @@ git commit -m "feat: classification reads max HR from the profile instead of sta
|
||||
|
||||
---
|
||||
|
||||
### Task 8: `internal/config` and `cmd/smartrund` — credentials come from the profile
|
||||
### Task 8: `internal/config` and `cmd/geniusrund` — credentials come from the profile
|
||||
|
||||
**Files:**
|
||||
- Modify: `backend/internal/config/config.go` (full rewrite — small file, shown complete below)
|
||||
- Modify: `backend/cmd/smartrund/main.go` (lines 21-46)
|
||||
- Modify: `backend/cmd/geniusrund/main.go` (lines 21-46)
|
||||
|
||||
**Interfaces:**
|
||||
- Consumes: `db.GetProfile` (Task 1).
|
||||
- Removes: `config.Config.GarminEmail`, `config.Config.GarminPassword`, `config.Config.MaxHR` and the `GARMIN_EMAIL`/`GARMIN_PASSWORD`/`SMARTRUN_MAX_HR` env vars — `MCP_GARMIN_PYTHON`/`MCP_GARMIN_SERVER` remain required env vars (infra paths, not secrets).
|
||||
- Removes: `config.Config.GarminEmail`, `config.Config.GarminPassword`, `config.Config.MaxHR` and the `GARMIN_EMAIL`/`GARMIN_PASSWORD`/`GENIUSRUN_MAX_HR` env vars — `MCP_GARMIN_PYTHON`/`MCP_GARMIN_SERVER` remain required env vars (infra paths, not secrets).
|
||||
|
||||
- [ ] **Step 1: Rewrite `internal/config/config.go`**
|
||||
|
||||
Replace the full contents of `backend/internal/config/config.go` with:
|
||||
|
||||
```go
|
||||
// Package config loads smartrund's runtime infrastructure configuration
|
||||
// Package config loads geniusrund's runtime infrastructure configuration
|
||||
// from environment variables (paths and process settings that don't belong
|
||||
// in the user-editable profile). Garmin credentials and every tunable
|
||||
// analysis-engine parameter live in the profile (internal/store.Profile)
|
||||
@@ -1416,7 +1416,7 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// Config holds smartrund's process-level configuration.
|
||||
// Config holds geniusrund's process-level configuration.
|
||||
type Config struct {
|
||||
// Addr is the HTTP listen address, e.g. ":8080".
|
||||
Addr string
|
||||
@@ -1440,14 +1440,14 @@ type Config struct {
|
||||
// for anything optional. Returns an error if a required variable is unset.
|
||||
func Load() (Config, error) {
|
||||
cfg := Config{
|
||||
Addr: getEnvDefault("SMARTRUN_ADDR", ":8080"),
|
||||
DBPath: getEnvDefault("SMARTRUN_DB_PATH", "smartrun.db"),
|
||||
Addr: getEnvDefault("GENIUSRUN_ADDR", ":8080"),
|
||||
DBPath: getEnvDefault("GENIUSRUN_DB_PATH", "geniusrun.db"),
|
||||
GarminPythonPath: os.Getenv("MCP_GARMIN_PYTHON"),
|
||||
GarminServerPath: os.Getenv("MCP_GARMIN_SERVER"),
|
||||
GarminTokenStore: os.Getenv("GARMIN_TOKENSTORE"),
|
||||
MinConfidence: getEnvFloat("SMARTRUN_MIN_CONFIDENCE", 0.6),
|
||||
BackfillHorizonDays: getEnvInt("SMARTRUN_BACKFILL_HORIZON_DAYS", 3*365),
|
||||
IncrementalSyncEvery: getEnvDuration("SMARTRUN_INCREMENTAL_SYNC_EVERY", 6*time.Hour),
|
||||
MinConfidence: getEnvFloat("GENIUSRUN_MIN_CONFIDENCE", 0.6),
|
||||
BackfillHorizonDays: getEnvInt("GENIUSRUN_BACKFILL_HORIZON_DAYS", 3*365),
|
||||
IncrementalSyncEvery: getEnvDuration("GENIUSRUN_INCREMENTAL_SYNC_EVERY", 6*time.Hour),
|
||||
}
|
||||
|
||||
if cfg.GarminPythonPath == "" {
|
||||
@@ -1494,9 +1494,9 @@ func getEnvDuration(key string, def time.Duration) time.Duration {
|
||||
}
|
||||
```
|
||||
|
||||
- [ ] **Step 2: Update `cmd/smartrund/main.go` to load credentials from the profile**
|
||||
- [ ] **Step 2: Update `cmd/geniusrund/main.go` to load credentials from the profile**
|
||||
|
||||
`backend/cmd/smartrund/main.go` currently reads (lines 21-46):
|
||||
`backend/cmd/geniusrund/main.go` currently reads (lines 21-46):
|
||||
|
||||
```go
|
||||
func main() {
|
||||
@@ -1566,19 +1566,19 @@ func main() {
|
||||
|
||||
- [ ] **Step 3: Build and run the full backend test suite**
|
||||
|
||||
Run: `cd backend && gofmt -w internal/config/config.go cmd/smartrund/main.go && go build ./... && go vet ./... && go test ./...`
|
||||
Run: `cd backend && gofmt -w internal/config/config.go cmd/geniusrund/main.go && go build ./... && go vet ./... && go test ./...`
|
||||
Expected: everything builds and all tests PASS.
|
||||
|
||||
- [ ] **Step 4: Manual smoke test — start the server without Garmin env vars**
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
rm -f /tmp/smartrun_task8.db
|
||||
rm -f /tmp/geniusrun_task8.db
|
||||
MCP_GARMIN_PYTHON=/Users/kriss/Dev/scm/scm.vilanet.fr/kriss/mcp-garmin/.venv/bin/python \
|
||||
MCP_GARMIN_SERVER=/Users/kriss/Dev/scm/scm.vilanet.fr/kriss/mcp-garmin/server.py \
|
||||
SMARTRUN_DB_PATH=/tmp/smartrun_task8.db \
|
||||
SMARTRUN_ADDR=:8085 \
|
||||
go run ./cmd/smartrund &
|
||||
GENIUSRUN_DB_PATH=/tmp/geniusrun_task8.db \
|
||||
GENIUSRUN_ADDR=:8085 \
|
||||
go run ./cmd/geniusrund &
|
||||
sleep 2
|
||||
curl -s localhost:8085/api/profile
|
||||
curl -s localhost:8085/api/workout-kinds/ | head -c 300
|
||||
@@ -1590,7 +1590,7 @@ Expected: the server starts (no "GARMIN_EMAIL required" error), `/api/profile` r
|
||||
- [ ] **Step 5: Commit**
|
||||
|
||||
```bash
|
||||
cd backend && git add internal/config/config.go cmd/smartrund/main.go
|
||||
cd backend && git add internal/config/config.go cmd/geniusrund/main.go
|
||||
git commit -m "feat: source Garmin credentials from the profile instead of env vars"
|
||||
```
|
||||
|
||||
@@ -2307,11 +2307,11 @@ Change to:
|
||||
cd backend
|
||||
gofmt -w cmd/seedsample/main.go
|
||||
go build ./... && go vet ./...
|
||||
rm -f /tmp/smartrun_verify.db
|
||||
go run ./cmd/seedsample -db /tmp/smartrun_verify.db
|
||||
rm -f /tmp/geniusrun_verify.db
|
||||
go run ./cmd/seedsample -db /tmp/geniusrun_verify.db
|
||||
```
|
||||
|
||||
Expected: builds clean, prints `Seeded 10 activities (kinds: Easy=<id>, Tempo=<id>) into /tmp/smartrun_verify.db` with no errors (no unique-constraint failure).
|
||||
Expected: builds clean, prints `Seeded 10 activities (kinds: Easy=<id>, Tempo=<id>) into /tmp/geniusrun_verify.db` with no errors (no unique-constraint failure).
|
||||
|
||||
- [ ] **Step 5: Run the full backend test suite one more time**
|
||||
|
||||
@@ -2322,12 +2322,12 @@ Expected: `gofmt -l .` prints nothing; everything else PASSes.
|
||||
|
||||
```bash
|
||||
cd backend
|
||||
go build -o /tmp/smartrund ./cmd/smartrund
|
||||
go build -o /tmp/geniusrund ./cmd/geniusrund
|
||||
MCP_GARMIN_PYTHON=/Users/kriss/Dev/scm/scm.vilanet.fr/kriss/mcp-garmin/.venv/bin/python \
|
||||
MCP_GARMIN_SERVER=/Users/kriss/Dev/scm/scm.vilanet.fr/kriss/mcp-garmin/server.py \
|
||||
SMARTRUN_DB_PATH=/tmp/smartrun_verify.db \
|
||||
SMARTRUN_ADDR=:8080 \
|
||||
/tmp/smartrund &
|
||||
GENIUSRUN_DB_PATH=/tmp/geniusrun_verify.db \
|
||||
GENIUSRUN_ADDR=:8080 \
|
||||
/tmp/geniusrund &
|
||||
sleep 1
|
||||
curl -s localhost:8080/api/workout-kinds/ | python3 -m json.tool | head -30
|
||||
curl -s localhost:8080/api/profile | python3 -m json.tool
|
||||
@@ -2352,7 +2352,7 @@ Open the printed URL and check:
|
||||
|
||||
```bash
|
||||
kill %1 2>/dev/null
|
||||
rm -f /tmp/smartrund /tmp/smartrun_verify.db
|
||||
rm -f /tmp/geniusrund /tmp/geniusrun_verify.db
|
||||
```
|
||||
|
||||
- [ ] **Step 9: Commit**
|
||||
|
||||
Reference in New Issue
Block a user