siesa-agents 2.1.92 → 2.1.93

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siesa-agents",
3
- "version": "2.1.92",
3
+ "version": "2.1.93",
4
4
  "description": "Paquete para instalar y configurar agentes SIESA en tu proyecto",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -34,16 +34,56 @@ Identificar el folder actual para usarlo en la generacion del worktree de la sig
34
34
  ---
35
35
 
36
36
  ## 3. Estándar de Mensajes de Commit
37
- Se adopta el formato de **Conventional Commits** para mejorar la legibilidad y automatización.
37
+ Se adopta **Conventional Commits** enriquecido con trazabilidad obligatoria a **feature** y **épica**. Todo commit generado por un agente debe seguir EXACTAMENTE esta plantilla. Ningún campo se inventa: todos se derivan del `story_key` (ver Sección 6).
38
38
 
39
- | Tipo | Formato del Mensaje | Uso |
40
- | :--- | :--- | :--- |
41
- | **Feature** | `feat: descripción clara del cambio` | Nuevas funcionalidades. |
42
- | **Fix** | `fix: descripción del error corregido` | Corrección de errores (bugs). |
39
+ ### 3.1. Plantilla obligatoria
40
+
41
+ ```
42
+ <tipo>(<feature_scope>): <descripción>
43
+
44
+ Epic: <NNN>-<E> — <título de la épica>
45
+ Story: <NNN>-<E>.<HH> — <título de la historia>
46
+ ```
47
+
48
+ | Parte | Valor |
49
+ | :--- | :--- |
50
+ | `<tipo>` | `feat` (nueva funcionalidad) o `fix` (corrección de bug). Ante la duda → `feat`. |
51
+ | `<feature_scope>` | **Feature** de origen. **Prioridad:** el código de sincronización con Jira `FEATURE_CODE_JIRA` (issue key real, ej: `PROY-123`) **si ya fue sincronizado**; si no, el fallback `feat-<NNN3>`. Ver Sección 6. |
52
+ | `Epic:` | **Épica** (trailer obligatorio): `<NNN>-<E>` + título literal de la épica. |
53
+ | `Story:` | Historia (trailer obligatorio): `<NNN>-<E>.<HH>` + título literal de la historia. |
54
+
55
+ - La **descripción** va en minúsculas, en imperativo y ≤ 72 caracteres.
56
+ - Los trailers `Epic:` y `Story:` son máquina-parseables (`git log --format=%(trailers)`); NO se omiten ni se reordenan.
57
+ - El `—` es un guión largo (em dash). Si no se conoce el título literal de la épica, usar solo `Epic: <NNN>-<E>` sin `— título` (NUNCA inventar un título).
58
+
59
+ ### 3.2. Ejemplo — feature YA sincronizado con Jira (`FEATURE_CODE_JIRA=PROY-123`)
60
+
61
+ story_key `16-1.01`, épica `16-1: Company Retrieval Feature`. El scope usa el issue key de Jira:
62
+
63
+ ```
64
+ feat(PROY-123): establecer dominio y esquema de company
65
+
66
+ Epic: 16-1 — Company Retrieval Feature
67
+ Story: 16-1.01 — Establish Company Domain & Schema
68
+ ```
69
+
70
+ Comando:
71
+ ```bash
72
+ git commit -m "feat(PROY-123): establecer dominio y esquema de company" \
73
+ -m "Epic: 16-1 — Company Retrieval Feature" \
74
+ -m "Story: 16-1.01 — Establish Company Domain & Schema"
75
+ ```
76
+
77
+ ### 3.3. Ejemplo — feature NO sincronizado (`FEATURE_CODE_JIRA=PENDING:...` o ausente → fallback)
78
+
79
+ story_key `83-3.05`. Al no haber issue key de Jira, el scope cae al fallback `feat-<NNN3>`:
43
80
 
44
- **Ejemplos:**
45
- * `git commit -m "feat: implementar validación de identidad mediante SSO"`.
46
- * `git commit -m "fix: corregir cálculo de nómina en rama legacy"`.
81
+ ```
82
+ fix(feat-083): corregir cálculo de nómina en rama legacy
83
+
84
+ Epic: 83-3 — Payroll Corrections
85
+ Story: 83-3.05 — Fix Overtime Rounding
86
+ ```
47
87
 
48
88
  ---
49
89
  ## 4. Cambio de ramas
@@ -67,4 +107,50 @@ cambio de rama:
67
107
  * **Protección de Ramas:** `main` y `develop` están protegidas; el push directo está prohibido.
68
108
  * **Cuando realizar commit** Los commits deberan hacerce por historia en el code review, especificamente cuando este en status done la historia.
69
109
  * **Generacion de ramas** Las ramas se deben generar por epicas o por features nunca por historia.
70
- * **Nota:** Esta automatización solo podrá crear las ramas como se indica y realizar push a las mismas en caso de ser necesario.
110
+ * **Nota:** Esta automatización solo podrá crear las ramas como se indica y realizar push a las mismas en caso de ser necesario.
111
+
112
+ ---
113
+ ## 6. Derivación Determinista del Mensaje de Commit (Anti-Alucinación)
114
+
115
+ > El agente **NO inventa** feature ni épica: los **parsea** del `story_key`, que sigue la convención `@_siesa-agents/resources/conventions/epic-story-naming-convention.md` (`{NNN}-{E}.{HH}`).
116
+
117
+ **Regla de parseo del `story_key`** (ej: `16-1.01`):
118
+ - `NNN` = texto antes del **primer** `-` → `16` (el feature)
119
+ - `E` = texto entre el `-` y el `.` → `1` (la épica)
120
+ - `HH` = texto después del `.` → `01` (la historia)
121
+
122
+ ### 6.1. Resolución de `<feature_scope>` (código Jira primero, doc como fallback)
123
+
124
+ El agente **DEBE** verificar primero si el feature ya fue sincronizado con Jira. Orden de prioridad:
125
+
126
+ 1. **Buscar `FEATURE_CODE_JIRA`** con este orden de búsqueda (igual que el sync de épicas):
127
+ 1. En el **shard de la épica** (`planning-artifacts/epics/epic-feat-<NNN>-*.md`): primera línea `<!-- FEATURE_CODE_JIRA=... -->` o frontmatter YAML `FEATURE_CODE_JIRA:` / `FEATURE_ID:`.
128
+ 2. Si no está ahí → en el **shard del PRD** correspondiente (`prd/f<N>-*.md`).
129
+ 2. **Evaluar el valor encontrado:**
130
+ - Si existe y **NO** empieza con `PENDING:` (es un issue key real, ej: `PROY-123`) → **`<feature_scope>` = ese issue key.** (Feature YA sincronizado.)
131
+ - Si vale `PENDING:...`, o no se encontró ningún `FEATURE_CODE_JIRA` → **`<feature_scope>` = `feat-<NNN3>`** (fallback documental).
132
+
133
+ > ⚠️ NUNCA usar el literal `PENDING:...` como scope. `PENDING` ⇒ fallback `feat-<NNN3>`.
134
+
135
+ **Tabla de fuentes** — cada campo tiene UNA fuente; si la fuente no existe, aplica la regla de "si falta":
136
+
137
+ | Campo | Fuente única | Si falta |
138
+ | :--- | :--- | :--- |
139
+ | `<tipo>` | `## Change Log` / naturaleza de la historia | usar `feat` |
140
+ | `<feature_scope>` | `FEATURE_CODE_JIRA` sincronizado (§6.1) → issue key real | fallback `feat-<NNN3>` |
141
+ | `NNN` | `story_key`, segmento antes del 1er `-` | ABORTAR: `story_key` inválido |
142
+ | `NNN3` | `NNN` con padding a 3 dígitos (`16`→`016`, `3`→`003`, `123`→`123`) | — |
143
+ | `E` | `story_key`, entre `-` y `.` | ABORTAR: `story_key` inválido |
144
+ | `HH` | `story_key`, después del `.` | ABORTAR: `story_key` inválido |
145
+ | título épica | H2/H3 del epic file (`### Epic <NNN>-<E>: <título>`) | omitir `— título`, dejar solo `Epic: <NNN>-<E>` |
146
+ | título historia | H1 del story file (`# Story <NNN>-<E>.<HH>: <título>`) | omitir `— título`, dejar solo `Story: <NNN>-<E>.<HH>` |
147
+ | descripción | resumen de la historia | derivar del título de la historia, minúsculas, imperativo, ≤72 chars |
148
+
149
+ **Checklist de validación antes de ejecutar `git commit`** (todos deben ser ✅):
150
+ 1. El asunto casa con `^(feat|fix)\(.+\): .{1,72}$` y el scope es **o** un issue key de Jira sincronizado **o** `feat-<NNN3>` — **nunca** `PENDING:...`.
151
+ 2. Si el feature estaba sincronizado, el scope es exactamente el `FEATURE_CODE_JIRA` (no el fallback).
152
+ 3. Existe una línea `Epic: <NNN>-<E>` y su `<NNN>-<E>` coincide con el prefijo del `story_key`.
153
+ 4. Existe una línea `Story: <NNN>-<E>.<HH>` idéntica al `story_key`.
154
+ 5. Ningún título fue inventado: si no había fuente, el `— título` se omitió.
155
+
156
+ Si algún punto falla → NO commitear, reportar el campo faltante.
@@ -98,18 +98,30 @@ To securely persist the verified and approved code changes to the repository fol
98
98
 
99
99
  2. **Construct Commit Message**:
100
100
  <action>
101
- Per Section 3 of `{gitFlowGuide}`, use Conventional Commits format:
102
- - For features: `feat: {description}`
103
- - For fixes: `fix: {description}`
104
-
105
- Derive type from story context and construct message.
101
+ Build the message STRICTLY from Section 3 (template) and Section 6 (deterministic
102
+ derivation) of `{gitFlowGuide}`. Do NOT redefine or invent the format here — the
103
+ guide is the single source of truth.
104
+
105
+ 1. Parse `{{story_key}}` into `NNN`, `E`, `HH` per Section 6.
106
+ 2. Resolve `<feature_scope>` per Section 6.1: FIRST look up `FEATURE_CODE_JIRA` in the
107
+ epic shard (then the PRD shard). If it is a real synced Jira issue key (NOT
108
+ `PENDING:...`) → use it as the scope. Otherwise fall back to `feat-<NNN3>`.
109
+ 3. Fill the template:
110
+ `<tipo>(<feature_scope>): <descripción>` + `Epic:` and `Story:` trailers.
111
+ 4. Take epic/story titles literally from the epic/story files; if absent, omit the
112
+ `— título` (never invent one).
113
+ 5. Run the Section 6 validation checklist. If any item fails, STOP and report the
114
+ missing field instead of committing.
115
+
116
+ Store the result as `{{commit_message}}` (subject + trailers).
106
117
  </action>
107
118
 
108
119
  3. **User Confirmation**:
109
120
  <output>
110
121
  READY TO COMMIT:
111
122
  - Branch: {{current_branch}}
112
- - Message: "feat: implementation for story {{story_key}}"
123
+ - Message:
124
+ {{commit_message}}
113
125
 
114
126
  Do you want to proceed with the commit and push?
115
127
  </output>
@@ -129,7 +141,7 @@ To securely persist the verified and approved code changes to the repository fol
129
141
  </logic>
130
142
 
131
143
  4. **Commit Changes**:
132
- <action>Run command `git commit -m "feat: implementation for story {{story_key}}"`</action>
144
+ <action>Commit using `{{commit_message}}` (one `-m` for the subject and one `-m` per trailer line, per the example in Section 3.2 of `{gitFlowGuide}`).</action>
133
145
  <check if="Commit failed (no changes?)">
134
146
  <output>ℹ️ No changes to commit.</output>
135
147
  </check>