rbin-task-flow 1.25.0 → 1.25.1

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.
@@ -13,9 +13,10 @@ paths: ["src/**", "app/**"]
13
13
 
14
14
  1. Apply the **checklist** in `.cursor/rules/coding_standards.mdc` (default for all implementation). Do **not** read the entire `.mdc` or full markdown into context if the checklist already covers the task.
15
15
  2. Implement using checklist rules: `app/` thin, `features/`, `shared/`, service+use-case, RHF+zod+`Controller`, `cn()`, no `any`, no raw base UI.
16
- 3. **Only if ambiguous** (Nest gateways, DataHandler, route groups, naming edge case): open **one or two sections** of `.task-flow/guides/coding-standards-full.md` — never paste or load the whole file.
17
- 4. If `graphify-out/graph.json` exists, `graphify query` before choosing file paths for new code.
18
- 5. No explanatory code comments; use `dev-logs/` for non-obvious design notes.
16
+ 3. **Vercel projects:** env files per **Vercel environment variables** in `coding-standards-full.md` (§0–§8).
17
+ 4. **Only if ambiguous** (Nest gateways, DataHandler, route groups, naming edge case): open **one or two sections** of `.task-flow/guides/coding-standards-full.md` never paste or load the whole file.
18
+ 5. If `graphify-out/graph.json` exists, `graphify query` before choosing file paths for new code.
19
+ 6. No explanatory code comments; use `dev-logs/` for non-obvious design notes.
19
20
 
20
21
  ## Token discipline
21
22
 
@@ -6,6 +6,7 @@
6
6
  |-----|------|------|
7
7
  | **Checklist** (default) | `.cursor/rules/coding_standards.mdc` | Every implementation; glob on `src/**`, `app/**` in Cursor |
8
8
  | **Full reference** (sections only) | `.task-flow/guides/coding-standards-full.md` | Nest/Prisma detail, long examples, ESLint table, DataHandler, providers |
9
+ | **Vercel `.env`** | `coding-standards-full.md` § Vercel | Projects on Vercel — 3 mirrored env files + sync scripts |
9
10
 
10
11
  ## Checklist essentials
11
12
 
@@ -40,3 +41,4 @@
40
41
  | Context / Auth Hook | Auth provider pattern |
41
42
  | Testing | E2E placement |
42
43
  | Critical Rules | Final verification |
44
+ | Vercel — environment variables | `.env` setup on Vercel deploys → open this section in full doc |
@@ -84,6 +84,18 @@ src/
84
84
 
85
85
  ---
86
86
 
87
+ ## Vercel — `.env` (when project deploys on Vercel)
88
+
89
+ Follow **Vercel — environment variables** in [coding-standards-full.md](mdc:.task-flow/guides/coding-standards-full.md) (§0–§8):
90
+
91
+ - **3 mirrored files:** `.env.example` (committed, empty values), `.env.local` (dev), `.env.production` (synced to Vercel).
92
+ - Same keys, **alphabetical order**, one var per line — no section comments breaking alignment.
93
+ - `.gitignore`: `.env`, `.env.*`, `!.env.example`.
94
+ - Scripts: `scripts/env-files-check.sh`, `scripts/vercel-env-sync.sh` (full content in full doc §5–§6).
95
+ - Audit orphan vars before aligning; classify `NEXT_PUBLIC_*`/flags as plaintext, rest as secret on Vercel.
96
+
97
+ ---
98
+
87
99
  ## Audit / sync
88
100
 
89
101
  - **`task-flow: audit`:** score against this checklist; open [coding-standards-full.md](mdc:.task-flow/guides/coding-standards-full.md) only for deep dives or user-requested depth.
@@ -97,4 +109,5 @@ src/
97
109
  |------|-----|
98
110
  | Implementing code | `@rbin-coding-standards` |
99
111
  | Full examples / Nest / gateways | Sections of `coding-standards-full.md` |
112
+ | Vercel `.env` setup | `coding-standards-full.md` § Vercel |
100
113
  | Audit all categories | `@task-flow-audit` |
@@ -14,7 +14,7 @@
14
14
  ├── AI-PLATFORMS.md
15
15
  ├── GRAPHIFY.md
16
16
  ├── CODEX.md · CURSOR.md
17
- ├── coding-standards-full.md
17
+ ├── coding-standards-full.md ← inclui padrão .env Vercel (§ Vercel)
18
18
  ├── platforms/ ← Claude, Cursor, Codex
19
19
  └── reports/ ← task-X-implementation.md
20
20
  ```
@@ -31,7 +31,7 @@
31
31
  | Codex workflows | [guides/CODEX.md](guides/CODEX.md) |
32
32
  | Cursor quick ref | [guides/CURSOR.md](guides/CURSOR.md) |
33
33
  | Otimização (tokens) | [guides/OPTIMIZATION-PLAN.md](guides/OPTIMIZATION-PLAN.md) |
34
- | Coding standards (full) | [guides/coding-standards-full.md](guides/coding-standards-full.md) |
34
+ | Coding standards (full) | [guides/coding-standards-full.md](guides/coding-standards-full.md) (Vercel `.env` no topo) |
35
35
 
36
36
  ## 🚀 Quick Commands
37
37
 
@@ -8,6 +8,151 @@ These rules define how code MUST be written when implementing tasks. Always foll
8
8
 
9
9
  ---
10
10
 
11
+ ## Vercel — environment variables
12
+
13
+ **When the project deploys on Vercel** (Next.js, etc.), follow this section for `.env` files.
14
+
15
+ ### Instruções para a IA (executar nesta ordem)
16
+
17
+ 1. **Antes de tudo — auditar variáveis sem uso** [§0]: para cada variável dos `.env*`, verifique se ela é realmente referenciada no código/configuração. **Liste as órfãs e confirme com o usuário antes de remover** — não apague sozinha (algumas são usadas só em runtime/CI/infra). Só depois de limpar é que se alinham os 3 arquivos.
18
+ 2. Crie `scripts/env-files-check.sh` e `scripts/vercel-env-sync.sh` com **exatamente** o conteúdo das seções [§5] e [§6]. Marque ambos como executáveis (`chmod +x`).
19
+ 3. Garanta os **3 arquivos de ambiente** seguindo a convenção [§1]: mesma sequência de chaves nos 3, **ordem alfabética**, uma variável por linha, sem comentários de seção no meio. Crie `.env.example` (commitado, valores vazios). **Nunca** coloque valores reais no `.env.example`.
20
+ 4. Ajuste o `.gitignore` conforme [§2].
21
+ 5. Ajuste a `PLAINTEXT_REGEX` do `vercel-env-sync.sh` ao stack do projeto [§3].
22
+ 6. Rode `./scripts/env-files-check.sh` e mostre a saída. Não rode o sync da Vercel sem credenciais do usuário — explique os comandos de [§4].
23
+ 7. Confirme os **critérios de aceite** [§7].
24
+
25
+ ### §0 — Auditoria (variáveis sem uso)
26
+
27
+ Para cada chave dos `.env*`, procure referências: `process.env.NOME`, `import.meta.env.NOME`, `env("NOME")`, configs/CI (`vercel.json`, `*.yml`, `Dockerfile`).
28
+
29
+ ```bash
30
+ for k in $(grep -hE '^[A-Za-z_][A-Za-z0-9_]*=' .env.example .env.local .env.production 2>/dev/null \
31
+ | sed -E 's/=.*//' | sort -u); do
32
+ n=$(grep -rIn --exclude-dir=node_modules --exclude-dir=.git --exclude='.env*' \
33
+ -e "$k" . 2>/dev/null | wc -l | tr -d ' ')
34
+ printf '%-32s %s ref(s)\n' "$k" "$n"
35
+ done
36
+ ```
37
+
38
+ **Trate `0 ref` como candidata, não certeza.** Confirme com o usuário antes de remover.
39
+
40
+ ### §1 — Convenção dos 3 arquivos
41
+
42
+ | Arquivo | Commitado? | Papel | Valores |
43
+ |---|---|---|---|
44
+ | `.env.example` | ✅ sim | Lista canônica (doc) | vazios/placeholder |
45
+ | `.env.local` | ❌ não | Desenvolvimento local | reais de dev |
46
+ | `.env.production` | ❌ não | **Sincronizado com a Vercel** | reais de produção |
47
+
48
+ Mesma sequência de chaves, **ordem alfabética**. Sem comentários de seção no meio.
49
+
50
+ ### §2 — `.gitignore`
51
+
52
+ ```gitignore
53
+ .env
54
+ .env.*
55
+ !.env.example
56
+ ```
57
+
58
+ ### §3 — Classificação secret × plaintext (Vercel)
59
+
60
+ | Classe | Exemplos | Tipo |
61
+ |---|---|---|
62
+ | `NEXT_PUBLIC_*` | `NEXT_PUBLIC_API_URL` | **plaintext** |
63
+ | Flags / URLs públicas | `*_ENABLED`, `*_PUBLIC_URL`, `NODE_ENV` | **plaintext** |
64
+ | Todo o resto | `*_API_KEY`, `*_SECRET`, `*_TOKEN` | **secret** (`--sensitive`) |
65
+
66
+ ### §4 — Comandos
67
+
68
+ ```bash
69
+ npm i -g vercel && vercel login && vercel link
70
+ ./scripts/env-files-check.sh
71
+ DRY_RUN=1 ./scripts/vercel-env-sync.sh
72
+ ./scripts/vercel-env-sync.sh
73
+ vercel env pull .env.vercel.check --environment=production
74
+ ```
75
+
76
+ ### §5 — `scripts/env-files-check.sh`
77
+
78
+ ```bash
79
+ #!/usr/bin/env bash
80
+ set -euo pipefail
81
+ if [ "$#" -gt 0 ]; then FILES=("$@"); else FILES=(".env.example" ".env.local" ".env.production"); fi
82
+ keys_of() { grep -E '^[A-Za-z_][A-Za-z0-9_]*=' "$1" | sed -E 's/=.*//'; }
83
+ fail=0; ref=""; ref_file=""
84
+ for f in "${FILES[@]}"; do
85
+ if [ ! -f "$f" ]; then echo "❌ faltando: $f"; fail=1; continue; fi
86
+ keys="$(keys_of "$f")"
87
+ sorted="$(printf '%s\n' "$keys" | LC_ALL=C sort)"
88
+ if [ "$keys" != "$sorted" ]; then
89
+ echo "❌ $f não está em ordem alfabética."
90
+ diff <(printf '%s\n' "$keys") <(printf '%s\n' "$sorted") | head -6
91
+ fail=1
92
+ fi
93
+ count="$(printf '%s\n' "$keys" | grep -c . || true)"
94
+ echo "• $f — $count variáveis"
95
+ if [ -z "$ref" ]; then ref="$sorted"; ref_file="$f"
96
+ elif [ "$sorted" != "$ref" ]; then
97
+ echo "❌ $f difere de $ref_file:"
98
+ diff <(printf '%s\n' "$ref") <(printf '%s\n' "$sorted") || true
99
+ fail=1
100
+ fi
101
+ done
102
+ if [ "$fail" -eq 0 ]; then echo "✅ Arquivos alinhados, mesma sequência e em ordem alfabética."
103
+ else echo "→ Corrija as divergências acima."; fi
104
+ exit "$fail"
105
+ ```
106
+
107
+ ### §6 — `scripts/vercel-env-sync.sh`
108
+
109
+ ```bash
110
+ #!/usr/bin/env bash
111
+ set -euo pipefail
112
+ ENV_FILE="${1:-.env.production}"
113
+ TARGET="${2:-production}"
114
+ DRY_RUN="${DRY_RUN:-0}"
115
+ PLAINTEXT_REGEX="${PLAINTEXT_REGEX:-^(NEXT_PUBLIC_|NODE_ENV$|.*_ENABLED$|.*_URL_STRATEGY$|.*_PUBLIC_URL$|.*_REGION$)}"
116
+ command -v vercel >/dev/null 2>&1 || { echo "❌ vercel CLI não encontrado. Instale: npm i -g vercel"; exit 1; }
117
+ [ -f "$ENV_FILE" ] || { echo "❌ arquivo não encontrado: $ENV_FILE"; exit 1; }
118
+ [ -d ".vercel" ] || echo "⚠️ projeto não vinculado — rode 'vercel link' antes (continuando…)"
119
+ secret_count=0; plain_count=0
120
+ while IFS= read -r line <&3 || [ -n "$line" ]; do
121
+ case "$line" in ''|\#*) continue ;; esac
122
+ case "$line" in *=*) ;; *) continue ;; esac
123
+ key="${line%%=*}"; val="${line#*=}"
124
+ key="$(printf '%s' "$key" | tr -d '[:space:]')"
125
+ val="${val%\"}"; val="${val#\"}"; val="${val%\'}"; val="${val#\'}"
126
+ [ -z "$key" ] && continue
127
+ if [ -z "$val" ]; then echo "⏭️ $key (valor vazio — pulado)"; continue; fi
128
+ if printf '%s' "$key" | grep -Eq "$PLAINTEXT_REGEX"; then
129
+ flag=""; kind="plaintext"; plain_count=$((plain_count+1))
130
+ else
131
+ flag="--sensitive"; kind="secret "; secret_count=$((secret_count+1))
132
+ fi
133
+ echo "→ [$kind] $key ($TARGET)"
134
+ [ "$DRY_RUN" = "1" ] && continue
135
+ vercel env rm "$key" "$TARGET" -y </dev/null >/dev/null 2>&1 || true
136
+ printf '%s' "$val" | vercel env add "$key" "$TARGET" $flag >/dev/null
137
+ done 3< "$ENV_FILE"
138
+ echo "✅ $secret_count secret(s), $plain_count plaintext em '$TARGET'."
139
+ [ "$DRY_RUN" = "1" ] && echo "(DRY_RUN — nada foi enviado)"
140
+ ```
141
+
142
+ ### §7 — Critérios de aceite
143
+
144
+ - Auditoria [§0] feita; órfãs removidas após confirmação do usuário.
145
+ - Scripts executáveis; 3 arquivos com mesma sequência alfabética.
146
+ - `./scripts/env-files-check.sh` retorna exit 0.
147
+ - `.gitignore` ignora `.env*` exceto `.env.example`.
148
+ - Nenhum valor real no `.env.example` nem no git.
149
+
150
+ ### §8 — Limitações
151
+
152
+ Valores multilinha (PEM/JSON) → base64 numa linha ou cadastro manual na Vercel. `NEXT_PUBLIC_*` no target do **build**.
153
+
154
+ ---
155
+
11
156
  ## Project Structure
12
157
 
13
158
  All projects use TypeScript and follow this structure:
package/README.md CHANGED
@@ -33,7 +33,7 @@
33
33
  <a id="português"></a>
34
34
  # 🇧🇷 Português
35
35
 
36
- > **v1.25.0** — `.task-flow/` enxuto: tasks na raiz, docs em `guides/`. De **1.24.x**: `npm install -g rbin-task-flow@1.25` e `rbin-task-flow update`. [CHANGELOG](CHANGELOG.md) · [Publicação](RELEASE-1.25.0.md).
36
+ > **v1.25.1** — Padrão `.env` Vercel nos coding standards. De **1.25.0**: `npm install -g rbin-task-flow@1.25.1` e `rbin-task-flow update`. [CHANGELOG](CHANGELOG.md) · [Publicação](RELEASE-1.25.1.md).
37
37
 
38
38
  ## O Que É Este Projeto?
39
39
 
@@ -419,7 +419,7 @@ Para problemas ou perguntas:
419
419
  <a id="english"></a>
420
420
  # 🇬🇧 English
421
421
 
422
- > **v1.25.0** — Slim `.task-flow/`: tasks at root, docs in `guides/`. From **1.24.x**: `npm install -g rbin-task-flow@1.25` then `rbin-task-flow update`. [CHANGELOG](CHANGELOG.md) · [Release guide](RELEASE-1.25.0.md).
422
+ > **v1.25.1** — Vercel `.env` pattern in coding standards. From **1.25.0**: `npm install -g rbin-task-flow@1.25.1` then `rbin-task-flow update`. [CHANGELOG](CHANGELOG.md) · [Release guide](RELEASE-1.25.1.md).
423
423
 
424
424
  ## What Is This Project?
425
425
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rbin-task-flow",
3
- "version": "1.25.0",
3
+ "version": "1.25.1",
4
4
  "description": "AI-powered task management for Claude and Cursor",
5
5
  "main": "index.js",
6
6
  "bin": {