specleap-framework 2.1.6 → 2.1.8

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.
package/CHANGELOG.md CHANGED
@@ -7,6 +7,37 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [2.1.8] - 2026-04-26
11
+
12
+ ### Fixed
13
+
14
+ - **`setup.sh` token validation no longer aborts on the first wrong input.** Both the GitHub and the Asana token prompts now retry up to 3 times before asking the user whether to retry the round again or cancel the installation. Empty input doesn't consume an attempt (it's almost always a paste/typo, not a real failure). Reported by Styng during a manual test where pasting a partial Asana token killed the installer outright with no recovery path.
15
+
16
+ #### Behavioural details
17
+
18
+ - 3 attempts per round, then the installer prints the actual count and asks `[R]eintentar / [C]ancelar` (Spanish) or `[R]etry / [C]ancel` (English) depending on the chosen language.
19
+ - Choosing `R` (default) resets the attempt counter and lets the user try 3 more times — useful when they realise mid-prompt that they grabbed the wrong token.
20
+ - Choosing `C` exits cleanly with code 1 and the message `Instalación cancelada por el usuario` / `Installation cancelled by user`.
21
+ - After every invalid token, a tip is printed reminding the user about required scopes (GitHub: `repo`, `workflow`) or token format (Asana: Personal Access Token).
22
+ - Empty token input prints a localised reminder of the expected format and re-prompts without spending an attempt.
23
+
24
+ No changes to the validation logic itself (still calls `https://api.github.com/user` and `https://app.asana.com/api/1.0/workspaces`), so behaviour with valid tokens is unchanged.
25
+
26
+ ## [2.1.7] - 2026-04-25
27
+
28
+ ### Added
29
+
30
+ - **Bilingual setup questionnaire** (Phase 1 of i18n rollout) — `scripts/lib/questions.json` was split into `questions.es.json` and `questions.en.json`, both with all 58 questions. `generate-contrato.sh` now resolves the file at runtime from `SPECLEAP_LANG` (set by `setup.sh` from the user's choice or by `.specleap/config.json`), falling back to Spanish if the requested locale file is missing. Question IDs, numbers, options, validations and conditional logic (`skip_if`, `auto_suggest`) are preserved verbatim across both files for behavioural parity.
31
+ - **Bilingual openspec CLI `--help` output** (Phase 2 of i18n rollout) — the `usage()` function in all nine subcommands (`apply`, `archive`, `code-review`, `enrich`, `ff`, `new`, `report`, `status`, `verify`) now prints English when `SPECLEAP_LANG=en`. A new `cli_lang()` helper in `openspec/cli/common.sh` resolves the active language from the env var, then `.specleap/config.json`, then falls back to `es`. Spanish output is byte-identical to the previous version, so existing users see no change.
32
+ - **Bilingual FAQ** documenting the eight most common questions (vendor lock-in, SDD vs vibe coding, project size threshold, working without Claude Code, switching AI providers mid-project, Asana requirement, team scaling, relation to TDD/Agile/Scrum). Lives at `docs/faq.es.md` and `docs/faq.en.md`, linked from the README. Same content also rendered as a public section on `specleap.com/#faq` and `specleap.com/en/#faq`.
33
+ - **Branch protection workflow** — new `pre-push` git hook installed alongside `pre-commit` by `scripts/install-git-hooks.sh`. The hook blocks direct pushes to `main` and `stage`, redirecting contributors to the documented `feature → stage → main` flow. Bypassable with `--no-verify` for emergencies. Companion document `CONTRIBUTING.md` describes the workflow, commit conventions and hook setup.
34
+
35
+ ### Notes
36
+
37
+ - The `.specleap/i18n/{es,en}.json` runtime catalog and the `t()` helper in `.specleap/i18n.sh` continue to be used for short labels and runtime messages. The bilingual files added in this release (`questions.<lang>.json`) follow the project's separate-files convention for larger localised content.
38
+ - The repository now has a `stage` branch as a permanent integration target; release tags are cut from `main` after a `stage → main` merge.
39
+ - This release is the first to ship the openspec CLI with English `--help` to npm. Local i18n catalog (`.specleap/i18n/`) was already in the v2.1.5 tarball.
40
+
10
41
  ## [2.1.6] - 2026-04-24
11
42
 
12
43
  ### Changed
package/README.md CHANGED
@@ -20,7 +20,7 @@
20
20
 
21
21
  SpecLeap convierte cualquier IDE con asistente de IA en un entorno de desarrollo spec-first. Combina un contrato de proyecto inmutable, agentes conversacionales especializados, 34 Agent Skills profesionales y un pipeline de validación en tres capas para entregar código consistente y probado sin improvisación.
22
22
 
23
- **Versión actual:** 2.1.6 · **Licencia:** MIT · **Autor:** Styng Arias ([ConceptualCreative](https://conceptualcreative.com))
23
+ **Versión actual:** 2.1.8 · **Licencia:** MIT · **Autor:** Styng Arias ([ConceptualCreative](https://conceptualcreative.com))
24
24
 
25
25
  ---
26
26
 
@@ -37,6 +37,7 @@ SpecLeap convierte cualquier IDE con asistente de IA en un entorno de desarrollo
37
37
  - [IDEs Compatibles](#ides-compatibles)
38
38
  - [Dos Modos de Trabajo](#dos-modos-de-trabajo)
39
39
  - [Documentación](#documentación)
40
+ - [Preguntas Frecuentes (FAQ)](#preguntas-frecuentes-faq)
40
41
  - [Licencia y Contribución](#licencia-y-contribución)
41
42
 
42
43
  ---
@@ -244,6 +245,19 @@ Ambos modos coexisten. Lo habitual es trabajar conversacionalmente en el día a
244
245
 
245
246
  ---
246
247
 
248
+ ## Preguntas Frecuentes (FAQ)
249
+
250
+ Las preguntas habituales están respondidas en archivos dedicados:
251
+
252
+ - **Español:** [docs/faq.es.md](docs/faq.es.md)
253
+ - **English:** [docs/faq.en.md](docs/faq.en.md)
254
+
255
+ Cubren temas como vendor lock-in, cuándo SDD se rentabiliza, compatibilidad con asistentes que no son Claude Code, escalado en equipo, y cómo SDD complementa (no reemplaza) a TDD/Agile/Scrum.
256
+
257
+ Si tu pregunta no está cubierta, abre un issue en GitHub o escribe a `info@specleap.com`.
258
+
259
+ ---
260
+
247
261
  ## Licencia y Contribución
248
262
 
249
263
  Distribuido bajo licencia MIT. Ver [LICENSE](LICENSE).
@@ -8,7 +8,42 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec apply — Implement an approved proposal
14
+
15
+ USAGE:
16
+ openspec apply <CHANGE-ID> [options]
17
+
18
+ OPTIONS:
19
+ --no-branch Do not create a Git branch
20
+ --base <branch> Base branch (default: develop)
21
+ --dry-run Simulate without making changes
22
+ -h, --help Show help
23
+
24
+ DESCRIPTION:
25
+ Implements an approved proposal:
26
+ 1. Creates a Git branch (feat/CHANGE-ID-name)
27
+ 2. Applies delta specs (if any)
28
+ 3. Generates scaffolding from design.md
29
+ 4. Updates status to "in_progress"
30
+
31
+ NOTE: Does not generate code automatically.
32
+ Use an AI assistant (Continue, Copilot) to implement against specs.
33
+
34
+ EXAMPLES:
35
+ openspec apply CHANGE-001
36
+ openspec apply CHANGE-002 --base main
37
+ openspec apply CHANGE-003 --dry-run
38
+
39
+ PREREQUISITES:
40
+ - Proposal completed and reviewed
41
+ - Git repository initialised
42
+ - Base branch already exists
43
+
44
+ EOF
45
+ else
46
+ cat <<EOF
12
47
  openspec apply — Implementar propuesta aprobada
13
48
 
14
49
  USAGE:
@@ -41,6 +76,7 @@ PREREQUISITES:
41
76
  - Base branch existente
42
77
 
43
78
  EOF
79
+ fi
44
80
  }
45
81
 
46
82
  # Parse arguments
@@ -8,7 +8,37 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec archive — Archive a completed proposal
14
+
15
+ USAGE:
16
+ openspec archive <CHANGE-ID> [options]
17
+
18
+ OPTIONS:
19
+ --keep-branch Do not delete the feature branch
20
+ --no-merge Skip merge check (useful if already merged manually)
21
+ -h, --help Show help
22
+
23
+ DESCRIPTION:
24
+ Archives a completed and merged proposal:
25
+ 1. Verifies the PR is merged
26
+ 2. Updates status to "completed"
27
+ 3. Deletes the feature branch (optional)
28
+ 4. Generates a final report
29
+
30
+ EXAMPLES:
31
+ openspec archive CHANGE-001
32
+ openspec archive CHANGE-002 --keep-branch
33
+ openspec archive CHANGE-003 --no-merge
34
+
35
+ PREREQUISITES:
36
+ - PR merged into the base branch
37
+ - Code review approved
38
+
39
+ EOF
40
+ else
41
+ cat <<EOF
12
42
  openspec archive — Archivar propuesta completada
13
43
 
14
44
  USAGE:
@@ -36,6 +66,7 @@ PREREQUISITES:
36
66
  - Code review aprobado
37
67
 
38
68
  EOF
69
+ fi
39
70
  }
40
71
 
41
72
  # Parse arguments
@@ -8,7 +8,40 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec code-review — Request a CodeRabbit review
14
+
15
+ USAGE:
16
+ openspec code-review <CHANGE-ID> [options]
17
+
18
+ OPTIONS:
19
+ --create-pr Create the Pull Request automatically
20
+ --base <branch> Base branch for the PR (default: develop)
21
+ --draft Create the PR as draft
22
+ -h, --help Show help
23
+
24
+ DESCRIPTION:
25
+ Requests a code review for a proposal:
26
+ 1. Verifies tests pass (openspec verify)
27
+ 2. Creates PR on GitHub (if --create-pr)
28
+ 3. CodeRabbit reviews automatically
29
+ 4. Generates a review report
30
+
31
+ EXAMPLES:
32
+ openspec code-review CHANGE-001
33
+ openspec code-review CHANGE-002 --create-pr
34
+ openspec code-review CHANGE-003 --create-pr --draft
35
+
36
+ PREREQUISITES:
37
+ - Feature branch created
38
+ - Tests passing
39
+ - GitHub CLI configured (gh)
40
+ - CodeRabbit active in the repo
41
+
42
+ EOF
43
+ else
44
+ cat <<EOF
12
45
  openspec code-review — Solicitar review de CodeRabbit
13
46
 
14
47
  USAGE:
@@ -39,6 +72,7 @@ PREREQUISITES:
39
72
  - CodeRabbit activo en el repo
40
73
 
41
74
  EOF
75
+ fi
42
76
  }
43
77
 
44
78
  # Parse arguments
@@ -16,6 +16,29 @@ warning() { echo -e "${YELLOW}⚠${NC} $*"; }
16
16
  error() { echo -e "${RED}✗${NC} $*" >&2; }
17
17
  step() { echo -e "${CYAN}→${NC} $*"; }
18
18
 
19
+ # Detectar idioma activo del usuario.
20
+ # Orden de precedencia:
21
+ # 1. Variable de entorno SPECLEAP_LANG (export SPECLEAP_LANG=en)
22
+ # 2. Campo "language" en .specleap/config.json (escrito por setup.sh)
23
+ # 3. Fallback: "es"
24
+ # Devuelve por stdout el código de idioma ("es" o "en"). Pensado para usarse
25
+ # como `if [ "$(cli_lang)" = "en" ]; then ... else ... fi` en heredocs largos.
26
+ cli_lang() {
27
+ if [ -n "${SPECLEAP_LANG:-}" ]; then
28
+ echo "$SPECLEAP_LANG"
29
+ return
30
+ fi
31
+ if [ -f "${PROJECT_ROOT:-.}/.specleap/config.json" ]; then
32
+ local lang
33
+ lang=$(grep -o '"language": "[^"]*"' "${PROJECT_ROOT}/.specleap/config.json" 2>/dev/null | cut -d'"' -f4)
34
+ if [ -n "$lang" ]; then
35
+ echo "$lang"
36
+ return
37
+ fi
38
+ fi
39
+ echo "es"
40
+ }
41
+
19
42
  # Validate project structure
20
43
  validate_project() {
21
44
  if [[ ! -f "$PROJECT_ROOT/openspec/config.yaml" ]]; then
@@ -8,7 +8,42 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec enrich — Refine a user story with AI
14
+
15
+ USAGE:
16
+ openspec enrich <user-story> [options]
17
+ openspec enrich --file <path>
18
+
19
+ OPTIONS:
20
+ --file <path> Read user story from file
21
+ --output <path> Save the result (default: STDOUT)
22
+ --model <model> AI model to use (default: auto)
23
+ -h, --help Show help
24
+
25
+ DESCRIPTION:
26
+ Takes a plain user story and enriches it with:
27
+ - Technical context
28
+ - Detailed acceptance criteria
29
+ - Identified edge cases
30
+ - Complexity estimate
31
+
32
+ EXAMPLE:
33
+ openspec enrich "As a user I want to log in"
34
+ openspec enrich --file stories/US-123.md --output stories/US-123-refined.md
35
+
36
+ OUTPUT:
37
+ Refined user story in markdown with:
38
+ - Title and description
39
+ - Business context
40
+ - Acceptance criteria (GIVEN/WHEN/THEN)
41
+ - Additional use cases
42
+ - Initial estimate
43
+
44
+ EOF
45
+ else
46
+ cat <<EOF
12
47
  openspec enrich — Refinar user story con AI
13
48
 
14
49
  USAGE:
@@ -41,6 +76,7 @@ OUTPUT:
41
76
  - Estimación inicial
42
77
 
43
78
  EOF
79
+ fi
44
80
  }
45
81
 
46
82
  # Parse arguments
@@ -8,7 +8,40 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec ff — Fast-forward: generate the complete proposal with AI
14
+
15
+ USAGE:
16
+ openspec ff <CHANGE-ID> [options]
17
+
18
+ OPTIONS:
19
+ --model <model> AI model to use (default: auto)
20
+ --skip-proposal Skip proposal.md generation
21
+ --skip-design Skip design.md generation
22
+ --skip-tasks Skip tasks.md generation
23
+ -h, --help Show help
24
+
25
+ DESCRIPTION:
26
+ Automatically generates with AI:
27
+ - Full proposal.md (if a base user story is available)
28
+ - Technical design.md (architecture, API, data)
29
+ - Broken-down tasks.md (tasks + estimates)
30
+
31
+ IMPORTANT: Review and adjust the AI output before applying.
32
+
33
+ EXAMPLES:
34
+ openspec ff CHANGE-001
35
+ openspec ff CHANGE-002 --model anthropic/claude-sonnet-4
36
+ openspec ff CHANGE-003 --skip-tasks
37
+
38
+ PREREQUISITES:
39
+ - Proposal created via: openspec new
40
+ - At least a proposal.md with basic context
41
+
42
+ EOF
43
+ else
44
+ cat <<EOF
12
45
  openspec ff — Fast-forward: generar propuesta completa con AI
13
46
 
14
47
  USAGE:
@@ -39,6 +72,7 @@ PREREQUISITES:
39
72
  - Al menos proposal.md con contexto básico
40
73
 
41
74
  EOF
75
+ fi
42
76
  }
43
77
 
44
78
  # Parse arguments
@@ -8,7 +8,44 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec new — Create a new change proposal
14
+
15
+ USAGE:
16
+ openspec new [CHANGE-ID] <title> [options]
17
+ openspec new --auto <title>
18
+
19
+ OPTIONS:
20
+ --auto Generate ID automatically
21
+ --from <file> Create from a refined user story
22
+ --ticket <id> Associate with a ticket ID (e.g. app-tienda-23)
23
+ --priority <level> Priority (critical/high/medium/low)
24
+ --author <name> Author (default: git user)
25
+ -h, --help Show help
26
+
27
+ DESCRIPTION:
28
+ Creates a new change proposal with the full structure:
29
+ - proposal.md (WHAT and WHY)
30
+ - design.md (HOW — technical)
31
+ - tasks.md (Tasks and Testing Report)
32
+ - specs/ (Delta specs if applicable)
33
+
34
+ EXAMPLES:
35
+ openspec new CHANGE-001 "Implement JWT authentication"
36
+ openspec new --auto "Notification system" --ticket app-tienda-23
37
+ openspec new CHANGE-002 --from stories/auth-refined.md
38
+
39
+ OUTPUT:
40
+ openspec/changes/CHANGE-XXX-name/
41
+ ├── proposal.md
42
+ ├── design.md
43
+ ├── tasks.md
44
+ └── specs/ (if applicable)
45
+
46
+ EOF
47
+ else
48
+ cat <<EOF
12
49
  openspec new — Crear nueva propuesta de cambio
13
50
 
14
51
  USAGE:
@@ -43,6 +80,7 @@ OUTPUT:
43
80
  └── specs/ (si aplica)
44
81
 
45
82
  EOF
83
+ fi
46
84
  }
47
85
 
48
86
  # Parse arguments
@@ -8,7 +8,40 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec report — Generate testing report
14
+
15
+ USAGE:
16
+ openspec report [CHANGE-ID] [options]
17
+
18
+ OPTIONS:
19
+ --format <fmt> Output format (markdown|json|text)
20
+ --output <file> Output file (default: STDOUT)
21
+ -h, --help Show help
22
+
23
+ DESCRIPTION:
24
+ Generates a Testing Report automatically from test results:
25
+ - Runs the test suite
26
+ - Parses results (PHPUnit, Jest, etc.)
27
+ - Generates the report in the specified format
28
+ - Updates tasks.md if a CHANGE-ID is provided
29
+
30
+ EXAMPLES:
31
+ openspec report
32
+ openspec report CHANGE-001
33
+ openspec report --format json --output report.json
34
+ openspec report CHANGE-002 --format markdown
35
+
36
+ OUTPUT (markdown):
37
+ ## Testing Report
38
+ | Suite | Tests | Passed | Failed | Coverage |
39
+ |-------|-------|--------|--------|----------|
40
+ | Unit | X | X | 0 | XX% |
41
+
42
+ EOF
43
+ else
44
+ cat <<EOF
12
45
  openspec report — Generar testing report
13
46
 
14
47
  USAGE:
@@ -39,6 +72,7 @@ OUTPUT (markdown):
39
72
  | Unit | X | X | 0 | XX% |
40
73
 
41
74
  EOF
75
+ fi
42
76
  }
43
77
 
44
78
  # Parse arguments
@@ -8,7 +8,34 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec status — View proposal status
14
+
15
+ USAGE:
16
+ openspec status [options]
17
+
18
+ OPTIONS:
19
+ --all Show all (including completed)
20
+ --state <state> Filter by state
21
+ --format <fmt> Format (table|json|list)
22
+ -h, --help Show help
23
+
24
+ DESCRIPTION:
25
+ Shows the current status of all active proposals.
26
+
27
+ EXAMPLES:
28
+ openspec status
29
+ openspec status --all
30
+ openspec status --state in_progress
31
+ openspec status --format json
32
+
33
+ STATES:
34
+ draft, review, approved, in_progress, testing, completed, archived, rejected
35
+
36
+ EOF
37
+ else
38
+ cat <<EOF
12
39
  openspec status — Ver estado de propuestas
13
40
 
14
41
  USAGE:
@@ -33,6 +60,7 @@ STATES:
33
60
  draft, review, approved, in_progress, testing, completed, archived, rejected
34
61
 
35
62
  EOF
63
+ fi
36
64
  }
37
65
 
38
66
  # Parse arguments
@@ -8,7 +8,39 @@ PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
8
8
  source "$SCRIPT_DIR/common.sh"
9
9
 
10
10
  usage() {
11
- cat <<EOF
11
+ if [ "$(cli_lang)" = "en" ]; then
12
+ cat <<EOF
13
+ openspec verify — Verify tests and specs
14
+
15
+ USAGE:
16
+ openspec verify <CHANGE-ID> [options]
17
+
18
+ OPTIONS:
19
+ --skip-tests Skip test execution
20
+ --skip-specs Skip spec validation
21
+ --coverage <min> Minimum required coverage (default: 80)
22
+ -h, --help Show help
23
+
24
+ DESCRIPTION:
25
+ Verifies a proposal meets requirements before PR:
26
+ 1. Runs the test suite (unit + integration)
27
+ 2. Validates minimum coverage
28
+ 3. Checks that specs are up to date
29
+ 4. Generates Testing Report
30
+
31
+ EXAMPLES:
32
+ openspec verify CHANGE-001
33
+ openspec verify CHANGE-002 --skip-specs
34
+ openspec verify CHANGE-003 --coverage 90
35
+
36
+ OUTPUT:
37
+ - Testing Report updated in tasks.md
38
+ - Verification summary on STDOUT
39
+ - Exit code 0 if all OK, 1 if failures
40
+
41
+ EOF
42
+ else
43
+ cat <<EOF
12
44
  openspec verify — Verificar tests y specs
13
45
 
14
46
  USAGE:
@@ -38,6 +70,7 @@ OUTPUT:
38
70
  - Exit code 0 si todo OK, 1 si hay fallos
39
71
 
40
72
  EOF
73
+ fi
41
74
  }
42
75
 
43
76
  # Parse arguments
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "specleap-framework",
3
- "version": "2.1.6",
3
+ "version": "2.1.8",
4
4
  "description": "Spec-Driven Development Framework — Transform VSCode, Cursor, JetBrains into spec-first development machines",
5
5
  "keywords": [
6
6
  "spec-driven-development",
@@ -10,16 +10,21 @@ set -euo pipefail
10
10
  # ============================================================================
11
11
 
12
12
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
13
- QUESTIONS_FILE="$SCRIPT_DIR/lib/questions.json"
14
13
  SESSIONS_DIR="$SCRIPT_DIR/.sessions"
15
14
  TEMPLATE_FILE="$SCRIPT_DIR/../proyectos/_template/CONTRATO.md"
16
15
  TEMPLATE_LEGACY_FILE="$SCRIPT_DIR/../proyectos/_template/CONTRATO-LEGACY.md"
17
16
  VALIDATE_LIB="$SCRIPT_DIR/lib/validate.sh"
18
17
  ANALYZE_SCRIPT="$SCRIPT_DIR/analyze-project.sh"
19
18
 
20
- # Cargar sistema i18n
19
+ # Cargar sistema i18n (define SPECLEAP_LANG y la función t())
21
20
  source "$SCRIPT_DIR/../.specleap/i18n.sh"
22
21
 
22
+ # Cuestionario localizado: questions.<lang>.json (es por defecto, fallback si EN no existe)
23
+ QUESTIONS_FILE="$SCRIPT_DIR/lib/questions.${SPECLEAP_LANG}.json"
24
+ if [ ! -f "$QUESTIONS_FILE" ]; then
25
+ QUESTIONS_FILE="$SCRIPT_DIR/lib/questions.es.json"
26
+ fi
27
+
23
28
  # Cargar funciones de validación
24
29
  source "$VALIDATE_LIB"
25
30
 
@@ -132,10 +132,74 @@ EOF
132
132
 
133
133
  chmod +x "$HOOKS_DIR/pre-commit"
134
134
 
135
+ # Crear pre-push hook (bloquea push directo a main/stage)
136
+ cat > "$HOOKS_DIR/pre-push" << 'EOF'
137
+ #!/bin/bash
138
+ # SpecLeap Pre-Push Hook
139
+ # Bloquea pushes directos a las ramas protegidas (main, stage).
140
+ # Defensa local — equivalente a un Branch Protection Rule, mientras
141
+ # el repo sea privado en plan free (los Rulesets de GitHub solo están
142
+ # disponibles con Pro o repo público).
143
+
144
+ RED='\033[0;31m'
145
+ YELLOW='\033[1;33m'
146
+ GREEN='\033[0;32m'
147
+ NC='\033[0m'
148
+
149
+ PROTECTED_BRANCHES=("main" "stage")
150
+
151
+ # git pre-push hooks reciben argumentos: <remote> <url>
152
+ # y por stdin líneas: <local_ref> <local_sha> <remote_ref> <remote_sha>
153
+ remote="$1"
154
+ url="$2"
155
+
156
+ while read -r local_ref local_sha remote_ref remote_sha; do
157
+ # remote_ref es del estilo refs/heads/main, refs/heads/stage, refs/heads/feature/...
158
+ branch_name="${remote_ref#refs/heads/}"
159
+
160
+ for protected in "${PROTECTED_BRANCHES[@]}"; do
161
+ if [ "$branch_name" = "$protected" ]; then
162
+ echo ""
163
+ echo -e "${RED}╔═════════════════════════════════════════════════════════╗${NC}"
164
+ echo -e "${RED}║ SpecLeap: push directo a rama protegida BLOQUEADO ║${NC}"
165
+ echo -e "${RED}╚═════════════════════════════════════════════════════════╝${NC}"
166
+ echo ""
167
+ echo -e " Rama destino: ${YELLOW}$branch_name${NC}"
168
+ echo -e " Remote: ${YELLOW}$remote${NC} ($url)"
169
+ echo ""
170
+ echo " El flujo SpecLeap requiere pull requests para integrar cambios:"
171
+ echo " feature/<proyecto>-<ticket>-<desc> → stage → main"
172
+ echo ""
173
+ echo " Pasos:"
174
+ echo " 1. Crea una feature branch:"
175
+ echo -e " ${GREEN}git checkout -b feature/[proyecto]-[ticket]-[desc]${NC}"
176
+ echo ""
177
+ echo " 2. Haz tus commits ahí y pushea esa branch:"
178
+ echo -e " ${GREEN}git push -u origin feature/[proyecto]-[ticket]-[desc]${NC}"
179
+ echo ""
180
+ echo " 3. Abre PR contra ${YELLOW}stage${NC} en GitHub."
181
+ echo ""
182
+ echo " Si necesitas saltarte esto (emergencia, NO recomendado):"
183
+ echo " git push --no-verify"
184
+ echo ""
185
+ echo " Más info: CONTRIBUTING.md"
186
+ echo ""
187
+ exit 1
188
+ fi
189
+ done
190
+ done
191
+
192
+ exit 0
193
+ EOF
194
+
195
+ chmod +x "$HOOKS_DIR/pre-push"
196
+
135
197
  echo "✅ Git hooks instalados exitosamente"
136
198
  echo ""
137
- echo "📝 Hook instalado: pre-commit"
138
- echo " Valida linters, formatters y specs antes de cada commit"
199
+ echo "📝 Hooks instalados:"
200
+ echo " pre-commit — valida linters, formatters y specs antes de cada commit"
201
+ echo " • pre-push — bloquea pushes directos a main y stage (flujo feature → stage → main)"
139
202
  echo ""
140
- echo "💡 Para saltarte la validación (NO recomendado):"
141
- echo " git commit --no-verify -m \"mensaje\""
203
+ echo "💡 Para saltarte una validación (NO recomendado):"
204
+ echo " git commit --no-verify -m \"mensaje\" # bypassea pre-commit"
205
+ echo " git push --no-verify # bypassea pre-push"