Skip to content

Commit 5875780

Browse files
committed
Merge branch 'feature/environments' — v1.7.1 Environments, Secrets & Databases
2 parents cf75eb7 + baf683e commit 5875780

26 files changed

Lines changed: 1727 additions & 98 deletions

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ pm run order-service
189189
- 🔄 **CI/CD detection** - Detect GitHub Actions, GitLab CI, Jenkins, Travis CI, CircleCI with `pm ci` and in `pm info`
190190
- 🧹 **Linting & Formatting** - Run linters with `pm lint` and formatters with `pm fmt`, auto-detects ESLint, Clippy, Prettier, gofmt, Ruff, and more
191191
- 📦 **Multi-project Workspaces** - Detect monorepo modules with `pm modules`, multi-language detection, `pm build --all` and `pm test --all`
192+
- 📂 **Env File Detection** - Discover `.env` files with `pm env files`, view masked contents with `pm env show`, switch environments with `pm env switch`
193+
- 🔑 **Secret Scanning** - Detect hardcoded secrets (AWS keys, GitHub tokens, Slack tokens) in `.env` files, integrated in `pm doctor` and `pm secure`
194+
- 🗄️ **Database Migrations** - Detect migration tools (Prisma, Alembic, Diesel, Flyway, Liquibase, SQLx) with `pm migrate`, run and check status
192195
- 🌐 **Multi-platform** - Works on Windows, Linux, and Mac
193196

194197
---
@@ -240,6 +243,9 @@ chmod +x scripts/install.sh && ./scripts/install.sh
240243
| `pm env list <name> [--show]` | List variables (sensitive values masked) |
241244
| `pm env remove <name> KEY` | Remove a variable |
242245
| `pm env clear <name>` | Remove all variables |
246+
| `pm env files <name>` | List `.env` files in project directory |
247+
| `pm env show <name> <file> [--show]` | Show `.env` file contents (masked by default) |
248+
| `pm env switch <name> <env-name>` | Copy `.env.<env-name>` to `.env` |
243249
| `pm hooks <name>` | List hooks for a project |
244250
| `pm hooks <name> add <slot> "<script>"` | Add a pre-/post-command hook |
245251
| `pm hooks <name> remove <slot> "<script>"` | Remove a hook |
@@ -259,6 +265,9 @@ chmod +x scripts/install.sh && ./scripts/install.sh
259265
| `pm lint [name]` | Run linters on project(s) |
260266
| `pm fmt [name]` | Run formatters on project(s) |
261267
| `pm modules [name]` | Show workspace modules |
268+
| `pm migrate` | List detected migration tools per project |
269+
| `pm migrate <name>` | Run database migration (with confirmation) |
270+
| `pm migrate <name> status` | Check migration status |
262271
| `pm build --all` | Build all registered projects |
263272
| `pm test --all` | Test all registered projects |
264273
| `pm export` | Export all projects to a portable JSON file |
@@ -480,9 +489,10 @@ Projects are saved in:
480489
- **CI/CD**`pm ci` detects pipelines (GitHub Actions, GitLab CI, Jenkins, Travis, CircleCI) and shows dashboard URLs
481490
- **Lint & Format**`pm lint` / `pm fmt` auto-detect and run linters/formatters (ESLint, Prettier, Clippy, gofmt, Ruff, Black, Checkstyle, Spotless, and more)
482491
- **Workspaces**`pm modules` detects monorepo structures (Cargo, npm/pnpm/yarn, Gradle, Go), multi-language detection, `pm build --all` / `pm test --all`
483-
- **Reliability** — Atomic writes, backup/recovery, directory validation, download integrity, 697 tests
492+
- **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
484494

485-
> Latest release: **v1.7.0** (Multi-project Workspaces) — Full version history in [ROADMAP.md](ROADMAP.md)
495+
> Latest release: **v1.7.1** (Environments, Secrets & Databases) — Full version history in [ROADMAP.md](ROADMAP.md)
486496
487497
### 💡 Future Ideas
488498
- [ ] Project groups (`pm group create backend api-users product-service`, `pm run-group backend`)

ROADMAP.md

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -320,35 +320,35 @@ Export all or selected projects to a portable JSON file and import them back on
320320

321321
---
322322

323-
## v1.7.1 — Project Templates
323+
## v1.7.1 — Environments, Secrets & Databases ✅
324324

325-
### `pm init` command
326-
- `pm init <type>` — scaffold a new project from templates
327-
- Built-in templates: Java (Maven/Gradle), Node.js, Rust, Go, Python, .NET
328-
- Support custom templates from GitHub repos
329-
330-
---
331-
332-
## v1.8.0 — Environments, Secrets & Databases
333-
334-
### Environment management
335-
- Detect `.env`, `.env.local`, `.env.production` files
336-
- `pm env` — show current environment variables (masked secrets)
337-
- `pm env switch <name>` — switch between environment files
338-
- Warn if `.env` is not in `.gitignore`
325+
### Environment file detection
326+
| Feature | Status |
327+
|---------|--------|
328+
| `pm env files <name>` — list `.env` files in project directory | ✅ Done |
329+
| `pm env show <name> <file>` — show env file contents (masked) | ✅ Done |
330+
| `pm env show <name> <file> --show` — reveal all values | ✅ Done |
331+
| `pm env switch <name> <env-name>` — copy `.env.<name>` to `.env` | ✅ Done |
332+
| Show env files in `pm info` output | ✅ Done |
339333

340-
### Secrets detection
341-
- Scan for common secret patterns (API keys, tokens, passwords)
342-
- Warn on `pm doctor` if secrets are committed
343-
- Optional [Vaultic](https://crates.io/crates/vaultic) detection (not a dependency — PM works fully without it):
344-
- **Not installed** → recommend install options: `cargo install vaultic` (requires [Rust toolchain](https://rustup.rs)) or download binary from [GitHub Releases](https://github.com/SoftDryzz/Vaultic/releases). Always link to [Vaultic repo](https://github.com/SoftDryzz/Vaultic) for docs
345-
- **Installed but not initialized** → suggest `vaultic init` with link to docs so the user understands what it does before running it
346-
- **Installed and configured** → show enhanced secret management hints (e.g., `vaultic encrypt .env`)
334+
### Secret scanning
335+
| Feature | Status |
336+
|---------|--------|
337+
| Detect AWS access keys, GitHub tokens, Slack tokens in `.env` files | ✅ Done |
338+
| Generic secret detection (40+ char random values for sensitive keys) | ✅ Done |
339+
| Health check in `pm doctor` (6th check: no exposed secrets) | ✅ Done |
340+
| Security check in `pm secure` (secret-patterns + vaultic detection) | ✅ Done |
341+
| [Vaultic](https://github.com/SoftDryzz/Vaultic) integration: detect installation and `.vaultic/` dir | ✅ Done |
347342

348343
### Database migration awareness
349-
- Detect migration tools: SQLx, Flyway, Liquibase, Prisma, Diesel, Alembic
350-
- `pm migrate` — run pending migrations
351-
- `pm migrate status` — show migration state
344+
| Feature | Status |
345+
|---------|--------|
346+
| Detect 6 migration tools: Prisma, Alembic, Diesel, Flyway, Liquibase, SQLx | ✅ Done |
347+
| `pm migrate` — list detected tools per project | ✅ Done |
348+
| `pm migrate <name>` — run migration with y/n confirmation | ✅ Done |
349+
| `pm migrate <name> status` — show migration state (read-only) | ✅ Done |
350+
| Show migration tools in `pm info` output | ✅ Done |
351+
| Shell completions for migrate command | ✅ Done |
352352

353353
---
354354

User-Guide.md

Lines changed: 114 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
- [CI/CD Detection](#-cicd-detection)
2323
- [Linting & Formatting](#-linting--formatting)
2424
- [Multi-project Workspaces](#-multi-project-workspaces)
25+
- [Database Migrations](#-database-migrations)
2526
- [Help and Version](#-help-and-version)
2627
- [Environment Variables](#-environment-variables)
2728
- [What Are They?](#what-are-they)
@@ -591,6 +592,53 @@ pm env clear <name>
591592

592593
---
593594

595+
#### List .env files
596+
```bash
597+
pm env files <name>
598+
```
599+
600+
Discovers all `.env*` files (`.env`, `.env.local`, `.env.production`, etc.) in the project directory and shows their entry count and file size.
601+
602+
**Example output:**
603+
```
604+
Env Files — my-api
605+
606+
File Entries Size
607+
────────────────────────────────────
608+
.env 5 128 B
609+
.env.local 3 84 B
610+
.env.production 8 256 B
611+
612+
3 env files found
613+
```
614+
615+
---
616+
617+
#### Show .env file contents
618+
```bash
619+
pm env show <name> <file> # Sensitive values masked
620+
pm env show <name> <file> --show # All values revealed
621+
```
622+
623+
Displays the contents of a specific `.env` file. Sensitive values (PASSWORD, TOKEN, KEY, SECRET, AUTH) are masked by default — shows the first 3 characters followed by `****`.
624+
625+
---
626+
627+
#### Switch environment
628+
```bash
629+
pm env switch <name> <env-name>
630+
```
631+
632+
Copies `.env.<env-name>` to `.env` in the project directory. Asks for confirmation if `.env` already exists.
633+
634+
**Example:**
635+
```bash
636+
pm env switch my-api production
637+
# Copies .env.production → .env (with y/n confirmation)
638+
```
639+
640+
---
641+
594642
### 🔹 Rename & Path Update
595643

596644
#### Rename a project
@@ -679,9 +727,10 @@ Verifies installed runtimes (Java, Node.js, .NET, Python, Gradle, Maven, Rust/Ca
679727
| Tests | Project has a `test` command configured | Configure tests with `pm commands add` |
680728
| CI/CD | GitHub Actions, GitLab CI, or Jenkinsfile detected | Set up CI/CD for automated testing |
681729
| Lockfile | Dependency lockfile exists for project type | Commit your lockfile for reproducible builds |
730+
| Secrets | No hardcoded secrets found in `.env` files | Use environment injection or a vault instead |
682731

683732
Each project receives a **letter grade** based on how many checks pass:
684-
- **A** = 5/5**B** = 4/5**C** = 3/5**D** = 2/5**F** = 0–1/5
733+
- **A** = 6/6**B** = 5/6**C** = 4/6**D** = 3/6**F** = 0–2/6
685734

686735
#### Show only health grades (compact)
687736
```bash
@@ -704,7 +753,7 @@ Shows just the letter grade per project without details:
704753
pm secure
705754
```
706755

707-
Runs 5 filesystem-only security checks on each registered project:
756+
Runs 7 filesystem-only security checks on each registered project:
708757

709758
| Check | Pass condition | Recommendation if failed |
710759
|-------|---------------|--------------------------|
@@ -713,8 +762,10 @@ Runs 5 filesystem-only security checks on each registered project:
713762
| HTTPS only | No `http://` URLs in config files (excluding localhost) | Replace http:// with https:// in config files |
714763
| Sensitive files | `.gitignore` contains `*.pem` and `*.key` patterns | Add *.pem and *.key to .gitignore to protect keys |
715764
| Lockfile | Dependency lockfile exists for project type | Commit your lockfile to prevent supply-chain attacks |
765+
| Secret patterns | No known secret patterns (AWS keys, GitHub tokens, Slack tokens) in `.env` files | Remove hardcoded secrets and use environment injection |
766+
| Vaultic | [Vaultic](https://github.com/SoftDryzz/Vaultic) installed and initialized (when `.env` files exist) | Install Vaultic to encrypt your `.env` files |
716767

717-
Result coloring: **5/5** = green, **3–4/5** = yellow, **0–2/5** = red
768+
Result coloring: **7/7** = green, **5–6/7** = yellow, **0–4/7** = red
718769

719770
#### Auto-fix .gitignore issues
720771
```bash
@@ -1007,6 +1058,57 @@ Tests every registered project. Continues on failure and shows a summary.
10071058

10081059
---
10091060

1061+
### 🔹 Database Migrations
1062+
1063+
Detect and manage database migration tools across your projects.
1064+
1065+
#### List detected migration tools
1066+
```bash
1067+
pm migrate
1068+
```
1069+
1070+
Scans all registered projects and shows which migration tools are detected:
1071+
1072+
| Tool | Detection | Migrate Command | Status Command |
1073+
|------|-----------|----------------|----------------|
1074+
| Prisma | `prisma/schema.prisma` | `npx prisma migrate deploy` | `npx prisma migrate status` |
1075+
| Alembic | `alembic.ini` or `alembic/` dir | `alembic upgrade head` | `alembic current` |
1076+
| Diesel | `diesel.toml` | `diesel migration run` | `diesel migration list` |
1077+
| Flyway | `flyway.conf` or `flyway.toml` | `flyway migrate` | `flyway info` |
1078+
| Liquibase | `liquibase.properties` | `liquibase update` | `liquibase status` |
1079+
| SQLx | `.sqlx/` dir | `sqlx migrate run` | `sqlx migrate info` |
1080+
1081+
#### Run a migration
1082+
```bash
1083+
pm migrate <name>
1084+
```
1085+
1086+
Detects the migration tool for the project, asks for confirmation (y/n), then executes the migration command. If multiple tools are detected, uses the first one found.
1087+
1088+
#### Check migration status
1089+
```bash
1090+
pm migrate <name> status
1091+
```
1092+
1093+
Runs the status command for the detected migration tool. This is read-only and does not require confirmation.
1094+
1095+
**Example output:**
1096+
```
1097+
Migration — my-api
1098+
1099+
Tool: Prisma
1100+
Command: npx prisma migrate status
1101+
1102+
[Prisma output here...]
1103+
```
1104+
1105+
Migration tools are also shown in `pm info`:
1106+
```
1107+
Migration: Prisma, Flyway
1108+
```
1109+
1110+
---
1111+
10101112
### 🔹 Help and Version
10111113

10121114
#### View help
@@ -1927,6 +2029,10 @@ pm env list <name> # List (masked)
19272029
pm env list <name> --show # List (revealed)
19282030
pm env remove <name> KEY # Remove a variable
19292031
pm env clear <name> # Remove all variables
2032+
pm env files <name> # List .env files in project
2033+
pm env show <name> .env # Show .env contents (masked)
2034+
pm env show <name> .env.local --show # Show .env contents (revealed)
2035+
pm env switch <name> production # Copy .env.production → .env
19302036

19312037
# === HOOKS ===
19322038
pm hooks <name> # List hooks
@@ -1983,6 +2089,11 @@ pm modules <name> # Show workspace modules for a pr
19832089
pm build --all # Build all registered projects
19842090
pm test --all # Test all registered projects
19852091

2092+
# === DATABASE MIGRATIONS ===
2093+
pm migrate # List migration tools per project
2094+
pm migrate <name> # Run migration (with confirmation)
2095+
pm migrate <name> status # Check migration status
2096+
19862097
# === UPDATES ===
19872098
pm update # Update to latest version
19882099

docs/es/README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ pm run servicio-pedidos
189189
- 🔄 **Detección CI/CD** - Detecta GitHub Actions, GitLab CI, Jenkins, Travis CI, CircleCI con `pm ci` y en `pm info`
190190
- 🧹 **Linting y Formateo** - Ejecuta linters con `pm lint` y formateadores con `pm fmt`, auto-detecta ESLint, Clippy, Prettier, gofmt, Ruff y más
191191
- 📦 **Espacios de Trabajo Multi-proyecto** - Detecta módulos monorepo con `pm modules`, detección multi-lenguaje, `pm build --all` y `pm test --all`
192+
- 📂 **Detección de archivos .env** - Descubre archivos `.env` con `pm env files`, visualiza contenidos enmascarados con `pm env show`, cambia entornos con `pm env switch`
193+
- 🔑 **Escaneo de secretos** - Detecta secretos hardcodeados (claves AWS, tokens GitHub, tokens Slack) en archivos `.env`, integrado en `pm doctor` y `pm secure`
194+
- 🗄️ **Migraciones de base de datos** - Detecta herramientas de migración (Prisma, Alembic, Diesel, Flyway, Liquibase, SQLx) con `pm migrate`, ejecuta y comprueba estado
192195
- 🌐 **Multi-plataforma** - Funciona en Windows, Linux y Mac
193196

194197
---
@@ -240,6 +243,9 @@ chmod +x scripts/install.sh && ./scripts/install.sh
240243
| `pm env list <nombre> [--show]` | Listar variables (valores sensibles enmascarados) |
241244
| `pm env remove <nombre> KEY` | Eliminar una variable |
242245
| `pm env clear <nombre>` | Eliminar todas las variables |
246+
| `pm env files <nombre>` | Listar archivos `.env` en el directorio del proyecto |
247+
| `pm env show <nombre> <archivo> [--show]` | Mostrar contenido de archivo `.env` (enmascarado por defecto) |
248+
| `pm env switch <nombre> <nombre-env>` | Copiar `.env.<nombre-env>` a `.env` |
243249
| `pm hooks <nombre>` | Listar hooks de un proyecto |
244250
| `pm hooks <nombre> add <slot> "<script>"` | Añadir un hook pre-/post-comando |
245251
| `pm hooks <nombre> remove <slot> "<script>"` | Eliminar un hook |
@@ -259,6 +265,9 @@ chmod +x scripts/install.sh && ./scripts/install.sh
259265
| `pm lint [nombre]` | Ejecutar linters en proyecto(s) |
260266
| `pm fmt [nombre]` | Ejecutar formateadores en proyecto(s) |
261267
| `pm modules [nombre]` | Mostrar módulos del workspace |
268+
| `pm migrate` | Listar herramientas de migración detectadas por proyecto |
269+
| `pm migrate <nombre>` | Ejecutar migración de base de datos (con confirmación) |
270+
| `pm migrate <nombre> status` | Comprobar estado de migración |
262271
| `pm build --all` | Compilar todos los proyectos registrados |
263272
| `pm test --all` | Testear todos los proyectos registrados |
264273
| `pm export` | Exportar todos los proyectos a un archivo JSON portátil |
@@ -480,9 +489,10 @@ Los proyectos se guardan en:
480489
- **CI/CD**`pm ci` detecta GitHub Actions, GitLab CI, Jenkins, Travis CI, CircleCI y muestra URLs de dashboard
481490
- **Lint y Formato**`pm lint` / `pm fmt` auto-detectan y ejecutan linters/formateadores (ESLint, Prettier, Clippy, gofmt, Ruff, Black, Checkstyle, Spotless y más)
482491
- **Workspaces**`pm modules` detecta monorepos (Cargo, npm, Gradle, Go), detección multi-lenguaje, `pm build --all` y `pm test --all`
483-
- **Fiabilidad** — Escritura atómica, backup/recuperación, validación de directorio, integridad de descarga, 697 tests
492+
- **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
484494

485-
> Última release: **v1.7.0** (Espacios de Trabajo Multi-proyecto) — Historial completo en [ROADMAP.md](ROADMAP.md)
495+
> Última release: **v1.7.1** (Entornos, Secretos y Bases de Datos) — Historial completo en [ROADMAP.md](ROADMAP.md)
486496
487497
### 💡 Ideas Futuras
488498
- [ ] Grupos de proyectos (`pm group create backend api-users product-service`, `pm run-group backend`)

0 commit comments

Comments
 (0)