Skip to content

Commit 2047747

Browse files
committed
merge: v1.8.0 — Telemetry (PostHog)
2 parents ec4ba80 + 5480aab commit 2047747

18 files changed

Lines changed: 825 additions & 22 deletions

README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ chmod +x scripts/install.sh && ./scripts/install.sh
273273
| `pm export` | Export all projects to a portable JSON file |
274274
| `pm export <names...> [--file <path>]` | Export selected projects to a custom file |
275275
| `pm import <file>` | Import projects from an exported JSON file |
276+
| `pm config telemetry [on\|off]` | Enable or disable anonymous telemetry |
276277
| `pm help` | Show help |
277278
| `pm version` | Show version |
278279

@@ -476,6 +477,32 @@ Projects are saved in:
476477

477478
---
478479

480+
## 📊 Telemetry
481+
482+
ProjectManager collects **anonymous** usage statistics to improve the tool. Telemetry is **opt-in** — disabled by default.
483+
484+
### What is collected
485+
- PM version, OS name/version, Java version
486+
- Command name (e.g., `build`, `test`) — **no arguments**
487+
- Number of registered projects — **no project names or paths**
488+
489+
### What is NOT collected
490+
- Project names, file paths, source code
491+
- Environment variables, secrets, credentials
492+
- Personal information, IP addresses, usernames
493+
494+
### Control
495+
```bash
496+
pm config telemetry on # Enable
497+
pm config telemetry off # Disable
498+
pm config telemetry # Check status
499+
```
500+
501+
On first run, PM asks: `Enable telemetry? (y/n)` — default is **no**.
502+
Delete `~/.projectmanager/config.json` to reset all preferences.
503+
504+
---
505+
479506
## 🚧 Roadmap
480507

481508
### ✅ Completed
@@ -490,9 +517,10 @@ Projects are saved in:
490517
- **Lint & Format**`pm lint` / `pm fmt` auto-detect and run linters/formatters (ESLint, Prettier, Clippy, gofmt, Ruff, Black, Checkstyle, Spotless, and more)
491518
- **Workspaces**`pm modules` detects monorepo structures (Cargo, npm/pnpm/yarn, Gradle, Go), multi-language detection, `pm build --all` / `pm test --all`
492519
- **Environments**`pm env files/show/switch` for .env file discovery, secret scanning (AWS, GitHub, Slack tokens), `pm migrate` for database migration tools (Prisma, Alembic, Diesel, Flyway, Liquibase, SQLx)
493-
- **Reliability** — Atomic writes, backup/recovery, directory validation, download integrity, 748 tests
520+
- **Telemetry** — Opt-in anonymous usage analytics via PostHog, `pm config telemetry on/off`, privacy-first design
521+
- **Reliability** — Atomic writes, backup/recovery, directory validation, download integrity, 763 tests
494522

495-
> Latest release: **v1.7.1** (Environments, Secrets & Databases) — Full version history in [ROADMAP.md](ROADMAP.md)
523+
> Latest release: **v1.8.0** (Telemetry) — Full version history in [ROADMAP.md](ROADMAP.md)
496524
497525
### 💡 Future Ideas
498526
- [ ] Project groups (`pm group create backend api-users product-service`, `pm run-group backend`)

ROADMAP.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,16 @@ Export all or selected projects to a portable JSON file and import them back on
355355
## v1.8.0 — Telemetry
356356

357357
### Anonymous usage analytics (opt-in)
358-
- First-run prompt: "Allow anonymous usage statistics? (y/n)"
359-
- Tracks: version, OS, command frequency, project count
360-
- `pm config telemetry on/off` to toggle at any time
361-
- Privacy-first: no personal data, no project names, no paths
362-
- Transparent: documented in README and `pm help`
363-
- Backend: PostHog Cloud (free tier)
358+
359+
| Feature | Status |
360+
|---------|--------|
361+
| First-run consent prompt (opt-in, default disabled) | ✅ Done |
362+
| Track: version, OS, command name, project count | ✅ Done |
363+
| `pm config telemetry on/off` to toggle at any time | ✅ Done |
364+
| Privacy-first: no personal data, no project names, no paths | ✅ Done |
365+
| Transparent: documented in README, User-Guide, and `pm help` | ✅ Done |
366+
| Backend: PostHog Cloud (free tier) | ✅ Done |
367+
| Shell completions for config command | ✅ Done |
364368

365369
---
366370

User-Guide.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,27 @@ Migration tools are also shown in `pm info`:
11091109

11101110
---
11111111

1112+
### 🔹 Configuration
1113+
1114+
#### Check telemetry status
1115+
```bash
1116+
pm config telemetry
1117+
```
1118+
1119+
#### Enable telemetry
1120+
```bash
1121+
pm config telemetry on
1122+
```
1123+
1124+
#### Disable telemetry
1125+
```bash
1126+
pm config telemetry off
1127+
```
1128+
1129+
> **Privacy**: Telemetry is opt-in (disabled by default). Only anonymous data is collected: PM version, OS, command name, and project count. No project names, file paths, secrets, or personal information is ever sent.
1130+
1131+
---
1132+
11121133
### 🔹 Help and Version
11131134

11141135
#### View help
@@ -2094,6 +2115,11 @@ pm migrate # List migration tools per projec
20942115
pm migrate <name> # Run migration (with confirmation)
20952116
pm migrate <name> status # Check migration status
20962117

2118+
# === CONFIGURATION ===
2119+
pm config telemetry # Check telemetry status
2120+
pm config telemetry on # Enable anonymous telemetry
2121+
pm config telemetry off # Disable telemetry
2122+
20972123
# === UPDATES ===
20982124
pm update # Update to latest version
20992125

docs/es/README.md

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,7 @@ chmod +x scripts/install.sh && ./scripts/install.sh
273273
| `pm export` | Exportar todos los proyectos a un archivo JSON portátil |
274274
| `pm export <nombres...> [--file <ruta>]` | Exportar proyectos seleccionados a un archivo personalizado |
275275
| `pm import <archivo>` | Importar proyectos desde un archivo JSON exportado |
276+
| `pm config telemetry [on\|off]` | Habilitar o deshabilitar telemetría anónima |
276277
| `pm help` | Mostrar ayuda |
277278
| `pm version` | Mostrar versión |
278279

@@ -476,6 +477,32 @@ Los proyectos se guardan en:
476477

477478
---
478479

480+
## 📊 Telemetría
481+
482+
ProjectManager recopila estadísticas de uso **anónimas** para mejorar la herramienta. La telemetría es **opt-in** — desactivada por defecto.
483+
484+
### Qué se recopila
485+
- Versión de PM, nombre/versión del SO, versión de Java
486+
- Nombre del comando (ej: `build`, `test`) — **sin argumentos**
487+
- Número de proyectos registrados — **sin nombres ni rutas**
488+
489+
### Qué NO se recopila
490+
- Nombres de proyectos, rutas de archivos, código fuente
491+
- Variables de entorno, secretos, credenciales
492+
- Información personal, direcciones IP, nombres de usuario
493+
494+
### Control
495+
```bash
496+
pm config telemetry on # Activar
497+
pm config telemetry off # Desactivar
498+
pm config telemetry # Comprobar estado
499+
```
500+
501+
En la primera ejecución, PM pregunta: `Enable telemetry? (y/n)` — por defecto es **no**.
502+
Elimina `~/.projectmanager/config.json` para resetear todas las preferencias.
503+
504+
---
505+
479506
## 🚧 Roadmap
480507

481508
### ✅ Completado
@@ -490,9 +517,10 @@ Los proyectos se guardan en:
490517
- **Lint y Formato**`pm lint` / `pm fmt` auto-detectan y ejecutan linters/formateadores (ESLint, Prettier, Clippy, gofmt, Ruff, Black, Checkstyle, Spotless y más)
491518
- **Workspaces**`pm modules` detecta monorepos (Cargo, npm, Gradle, Go), detección multi-lenguaje, `pm build --all` y `pm test --all`
492519
- **Entornos**`pm env files/show/switch` para descubrir archivos .env, escaneo de secretos (tokens AWS, GitHub, Slack), `pm migrate` para herramientas de migración (Prisma, Alembic, Diesel, Flyway, Liquibase, SQLx)
493-
- **Fiabilidad** — Escritura atómica, backup/recuperación, validación de directorio, integridad de descarga, 748 tests
520+
- **Telemetría** — Analíticas de uso anónimas opt-in vía PostHog, `pm config telemetry on/off`, diseño privacy-first
521+
- **Fiabilidad** — Escritura atómica, backup/recuperación, validación de directorio, integridad de descarga, 763 tests
494522

495-
> Última release: **v1.7.1** (Entornos, Secretos y Bases de Datos) — Historial completo en [ROADMAP.md](ROADMAP.md)
523+
> Última release: **v1.8.0** (Telemetría) — Historial completo en [ROADMAP.md](ROADMAP.md)
496524
497525
### 💡 Ideas Futuras
498526
- [ ] Grupos de proyectos (`pm group create backend api-users product-service`, `pm run-group backend`)

docs/es/ROADMAP.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,12 +355,16 @@ Exporta todos o proyectos seleccionados a un archivo JSON portable e impórtalos
355355
## v1.8.0 — Telemetría
356356

357357
### Analíticas de uso anónimas (opt-in)
358-
- Pregunta en primera ejecución: "¿Permitir estadísticas anónimas? (y/n)"
359-
- Rastrea: versión, SO, frecuencia de comandos, número de proyectos
360-
- `pm config telemetry on/off` para activar/desactivar en cualquier momento
361-
- Privacidad primero: sin datos personales, sin nombres de proyecto, sin rutas
362-
- Transparente: documentado en README y `pm help`
363-
- Backend: PostHog Cloud (tier gratuito)
358+
359+
| Funcionalidad | Estado |
360+
|---------------|--------|
361+
| Prompt de consentimiento en primera ejecución (opt-in, desactivado por defecto) | ✅ Hecho |
362+
| Rastrea: versión, SO, nombre del comando, número de proyectos | ✅ Hecho |
363+
| `pm config telemetry on/off` para activar/desactivar en cualquier momento | ✅ Hecho |
364+
| Privacidad primero: sin datos personales, sin nombres de proyecto, sin rutas | ✅ Hecho |
365+
| Transparente: documentado en README, User-Guide y `pm help` | ✅ Hecho |
366+
| Backend: PostHog Cloud (tier gratuito) | ✅ Hecho |
367+
| Autocompletado en shell para comando config | ✅ Hecho |
364368

365369
---
366370

docs/es/User-Guide.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1109,6 +1109,27 @@ Las herramientas de migración también se muestran en `pm info`:
11091109

11101110
---
11111111

1112+
### 🔹 Configuración
1113+
1114+
#### Comprobar estado de telemetría
1115+
```bash
1116+
pm config telemetry
1117+
```
1118+
1119+
#### Activar telemetría
1120+
```bash
1121+
pm config telemetry on
1122+
```
1123+
1124+
#### Desactivar telemetría
1125+
```bash
1126+
pm config telemetry off
1127+
```
1128+
1129+
> **Privacidad**: La telemetría es opt-in (desactivada por defecto). Solo se recopilan datos anónimos: versión de PM, SO, nombre del comando y número de proyectos. Nunca se envían nombres de proyectos, rutas, secretos ni información personal.
1130+
1131+
---
1132+
11121133
### 🔹 Ayuda y Versión
11131134

11141135
#### Ver ayuda
@@ -2094,6 +2115,11 @@ pm migrate # Listar herramientas de migr
20942115
pm migrate <nombre> # Ejecutar migración (con confirmación)
20952116
pm migrate <nombre> status # Comprobar estado de migración
20962117

2118+
# === CONFIGURACIÓN ===
2119+
pm config telemetry # Comprobar estado de telemetría
2120+
pm config telemetry on # Activar telemetría anónima
2121+
pm config telemetry off # Desactivar telemetría
2122+
20972123
# === ACTUALIZACIONES ===
20982124
pm update # Actualizar a última versión
20992125

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<!-- Identificación del proyecto -->
99
<groupId>pm</groupId>
1010
<artifactId>projectmanager</artifactId>
11-
<version>1.7.1</version>
11+
<version>1.8.0</version>
1212
<packaging>jar</packaging>
1313

1414
<name>ProjectManager</name>

scripts/install.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# ProjectManager - Installation Script for Windows
22
# Works both from source (mvn clean package) and from GitHub Release download
33

4-
$jarName = "projectmanager-1.7.1.jar"
4+
$jarName = "projectmanager-1.8.0.jar"
55

66
Write-Host "=== ProjectManager Installer ===" -ForegroundColor Cyan
77
Write-Host ""

scripts/install.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# ProjectManager - Installation Script for Linux/Mac
33
# Works both from source (mvn clean package) and from GitHub Release download
44

5-
JAR_NAME="projectmanager-1.7.1.jar"
5+
JAR_NAME="projectmanager-1.8.0.jar"
66

77
echo "=== ProjectManager Installer ==="
88
echo ""

src/main/java/pm/ProjectManager.java

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import pm.util.Constants;
3535
import pm.util.GitIntegration;
3636
import pm.util.RuntimeChecker;
37+
import pm.telemetry.Telemetry;
3738
import pm.util.UpdateChecker;
3839

3940
import java.io.IOException;
@@ -103,6 +104,9 @@ public static void main(String[] args) {
103104
// Check for updates in the background (non-blocking, 2s timeout)
104105
UpdateChecker.checkForUpdates();
105106

107+
// Initialize telemetry (first-run consent prompt if needed)
108+
Telemetry.init();
109+
106110
if (args.length == 0) {
107111
printHelp();
108112
return;
@@ -137,10 +141,12 @@ public static void main(String[] args) {
137141
case "migrate" -> handleMigrate(args);
138142
case "export" -> handleExport(args);
139143
case "import" -> handleImport(args);
144+
case "config" -> handleConfig(args);
140145
case "help", "-h", "--help" -> printHelp();
141146
case "version", "-v", "--version" -> printVersion();
142147
default -> handleGenericCommand(command, args);
143148
}
149+
Telemetry.trackCommand(command);
144150
} catch (Exception e) {
145151
handleFatalError(e);
146152
}
@@ -3220,6 +3226,55 @@ private static void printBanner() {
32203226
""".formatted(Constants.VERSION));
32213227
}
32223228

3229+
// ============================================================
3230+
// COMMAND: CONFIG (User preferences)
3231+
// ============================================================
3232+
3233+
private static void handleConfig(String[] args) {
3234+
if (args.length < 2) {
3235+
printConfigHelp();
3236+
return;
3237+
}
3238+
3239+
String key = args[1].toLowerCase();
3240+
switch (key) {
3241+
case "telemetry" -> {
3242+
if (args.length < 3) {
3243+
System.out.println(" Telemetry: " + (Telemetry.isEnabled() ? "on" : "off"));
3244+
return;
3245+
}
3246+
String value = args[2].toLowerCase();
3247+
switch (value) {
3248+
case "on" -> {
3249+
Telemetry.setEnabled(true);
3250+
OutputFormatter.success("Telemetry enabled.");
3251+
}
3252+
case "off" -> {
3253+
Telemetry.setEnabled(false);
3254+
OutputFormatter.success("Telemetry disabled.");
3255+
}
3256+
default -> {
3257+
OutputFormatter.error("Invalid value: " + args[2]);
3258+
System.out.println("Usage: pm config telemetry [on|off]");
3259+
}
3260+
}
3261+
}
3262+
default -> {
3263+
OutputFormatter.error("Unknown config key: " + key);
3264+
printConfigHelp();
3265+
}
3266+
}
3267+
}
3268+
3269+
private static void printConfigHelp() {
3270+
System.out.println("""
3271+
Usage: pm config <key> [value]
3272+
3273+
Keys:
3274+
telemetry [on|off] Enable/disable anonymous usage statistics
3275+
""");
3276+
}
3277+
32233278
private static void printHelp() {
32243279
System.out.println("""
32253280
Usage: pm <command> [options]
@@ -3260,6 +3315,7 @@ migrate <name> Run database migration (with confirm
32603315
migrate <name> status Check migration status
32613316
export [names...] [--file <path>] Export projects to JSON file
32623317
import <file> Import projects from JSON file
3318+
config telemetry [on|off] Manage telemetry settings
32633319
help Show this help
32643320
version Show version
32653321

0 commit comments

Comments
 (0)