@saulwade/swl-ses 1.6.1 → 1.6.5
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/CLAUDE.md +3 -3
- package/README.md +4 -4
- package/agentes/_intent-spec.md +73 -0
- package/agentes/auto-evolucion-swl.md +24 -0
- package/agentes/cloud-infra-swl.md +25 -0
- package/agentes/datos-swl.md +23 -0
- package/agentes/devops-ci-swl.md +24 -0
- package/agentes/gh-fix-ci-swl.md +275 -0
- package/agentes/migrador-swl.md +22 -0
- package/agentes/nemesis-auditor-swl.md +90 -1
- package/agentes/pagos-swl.md +25 -0
- package/agentes/release-manager-swl.md +24 -0
- package/agentes/sre-swl.md +24 -0
- package/comandos/swl/exportar-vault.md +106 -14
- package/comandos/swl/nemesis.md +70 -3
- package/comandos/swl/planear-fase.md +16 -0
- package/comandos/swl/release.md +62 -2
- package/comandos/swl/salud.md +32 -0
- package/comandos/swl/verificar.md +116 -2
- package/habilidades/agent-browser/SKILL.md +111 -4
- package/habilidades/agent-deep-links/SKILL.md +148 -0
- package/habilidades/aprender-de-git-diff/SKILL.md +288 -0
- package/habilidades/backend-async-postgres-testing/SKILL.md +215 -0
- package/habilidades/backend-error-design/SKILL.md +221 -0
- package/habilidades/browser-interaction-patterns/SKILL.md +514 -0
- package/habilidades/browser-research-domains/SKILL.md +635 -0
- package/habilidades/changelog-generator/SKILL.md +172 -0
- package/habilidades/changelog-generator/scripts/parse-commits.js +354 -0
- package/habilidades/devsecops-pipeline-security/SKILL.md +3 -0
- package/habilidades/diseno-herramientas-agente/SKILL.md +17 -1
- package/habilidades/fastapi-experto/SKILL.md +49 -4
- package/habilidades/harness-claude-code/SKILL.md +4 -1
- package/habilidades/meta-skills-estandar/SKILL.md +6 -0
- package/habilidades/meta-skills-estandar/recursos/skill-judge-rubrica.md +281 -0
- package/habilidades/postgresql-experto/SKILL.md +80 -4
- package/habilidades/proceso-autoverificacion-evidencias/SKILL.md +258 -0
- package/habilidades/proceso-confianza-pre-implementacion/SKILL.md +246 -0
- package/habilidades/proceso-ddia-fundamentos/SKILL.md +255 -0
- package/habilidades/proceso-ddia-streaming/SKILL.md +231 -0
- package/habilidades/proceso-discovery-machote/SKILL.md +157 -0
- package/habilidades/proceso-intent-engineering/SKILL.md +269 -0
- package/habilidades/proceso-modular-split/SKILL.md +256 -0
- package/habilidades/reducir-entropia/SKILL.md +219 -0
- package/habilidades/tdd-workflow/SKILL.md +12 -5
- package/hooks/extraccion-aprendizajes.js +8 -0
- package/hooks/lib/deep-links.js +185 -0
- package/hooks/lib/evolution-tracker.js +115 -18
- package/hooks/lib/gateway-notify.js +70 -7
- package/hooks/lib/task-budget.js +218 -0
- package/hooks/validar-intent-spec.js +222 -0
- package/manifiestos/hooks-config.json +9 -0
- package/manifiestos/modulos.json +22 -3
- package/manifiestos/skills-lock.json +1247 -1142
- package/package.json +3 -3
- package/plugin.json +18 -2
- package/reglas/arquitectura.md +38 -0
- package/reglas/arreglar-al-detectar.md +93 -0
- package/reglas/auditorias-documentales-estructurales.md +38 -0
- package/reglas/fragmentos-compartidos.md +26 -0
- package/reglas/intent-engineering.md +214 -0
- package/reglas/registro-componentes-nuevos.md +52 -0
- package/reglas/tests-cleanup.md +220 -0
- package/schemas/agent-frontmatter.schema.json +294 -167
- package/schemas/agent-message.schema.json +73 -53
- package/schemas/agent-output-implementacion.schema.json +114 -85
- package/schemas/agent-output-planificacion.schema.json +150 -113
- package/schemas/agent-output-review.schema.json +98 -78
- package/schemas/diary-entry.schema.json +42 -10
- package/schemas/hook-profiles.schema.json +54 -39
- package/schemas/hooks-config.schema.json +89 -74
- package/schemas/instinct.schema.json +152 -115
- package/schemas/modulos.schema.json +38 -29
- package/schemas/perfiles.schema.json +36 -28
- package/schemas/plugin.schema.json +77 -64
- package/schemas/skill-evals.schema.json +119 -95
- package/schemas/skill-frontmatter.schema.json +245 -170
- package/scripts/generar-inventario.js +3 -1
- package/scripts/lib/mcp_config.py +29 -14
- package/scripts/lib/schema-version.js +164 -0
- package/scripts/mcp-orchestrator.py +153 -131
- package/scripts/mcp-pool-manager.py +132 -107
- package/scripts/mcp-telemetry.py +139 -120
- package/scripts/validar-manifest.js +1 -1
- package/scripts/validar.js +3 -2
- package/scripts/verificar-release.js +199 -1
|
@@ -1,170 +1,245 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://swl-ses.dev/schemas/skill-frontmatter.json",
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
"name"
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
},
|
|
25
|
-
"
|
|
26
|
-
"type": "
|
|
27
|
-
"
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
"
|
|
34
|
-
"type": "string",
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
},
|
|
42
|
-
"
|
|
43
|
-
"type": "string"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"
|
|
52
|
-
"type": "string"
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
"
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
"description": "
|
|
116
|
-
},
|
|
117
|
-
"
|
|
118
|
-
"type": "string",
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
},
|
|
141
|
-
"description": "Campo
|
|
142
|
-
},
|
|
143
|
-
"
|
|
144
|
-
"type": "array",
|
|
145
|
-
"items": {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
"
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
"
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://swl-ses.dev/schemas/skill-frontmatter.json",
|
|
4
|
+
"$schemaVersion": "1.0.0",
|
|
5
|
+
"title": "SWL Skill Frontmatter",
|
|
6
|
+
"description": "Schema de validacion para el frontmatter YAML de skills del sistema SWL",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"required": [
|
|
9
|
+
"name",
|
|
10
|
+
"description"
|
|
11
|
+
],
|
|
12
|
+
"properties": {
|
|
13
|
+
"name": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"pattern": "^[a-z][a-z0-9-]+$",
|
|
16
|
+
"maxLength": 64,
|
|
17
|
+
"description": "Nombre en kebab-case que coincide con el directorio"
|
|
18
|
+
},
|
|
19
|
+
"description": {
|
|
20
|
+
"type": "string",
|
|
21
|
+
"minLength": 20,
|
|
22
|
+
"maxLength": 1024,
|
|
23
|
+
"description": "Descripcion que incluye QUE hace y CUANDO cargarla"
|
|
24
|
+
},
|
|
25
|
+
"version": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"pattern": "^\\d+\\.\\d+\\.\\d+$"
|
|
28
|
+
},
|
|
29
|
+
"provenance": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"description": "Campo legacy. Equivalente espanol: 'procedencia'. Si ambos presentes deben coincidir (W010).",
|
|
32
|
+
"properties": {
|
|
33
|
+
"origin": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"enum": [
|
|
36
|
+
"manual",
|
|
37
|
+
"auto-evolution",
|
|
38
|
+
"imported",
|
|
39
|
+
"community"
|
|
40
|
+
]
|
|
41
|
+
},
|
|
42
|
+
"created_at": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"format": "date"
|
|
45
|
+
},
|
|
46
|
+
"confidence": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"minimum": 0,
|
|
49
|
+
"maximum": 1
|
|
50
|
+
},
|
|
51
|
+
"author": {
|
|
52
|
+
"type": "string"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
"procedencia": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"description": "Alias en espanol de 'provenance'. Campo propio de swl-ses. Si ambos presentes, deben coincidir (W010).",
|
|
59
|
+
"properties": {
|
|
60
|
+
"origin": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"enum": [
|
|
63
|
+
"manual",
|
|
64
|
+
"auto-evolution",
|
|
65
|
+
"imported",
|
|
66
|
+
"community"
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
"created_at": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"format": "date"
|
|
72
|
+
},
|
|
73
|
+
"confidence": {
|
|
74
|
+
"type": "number",
|
|
75
|
+
"minimum": 0,
|
|
76
|
+
"maximum": 1
|
|
77
|
+
},
|
|
78
|
+
"author": {
|
|
79
|
+
"type": "string"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
},
|
|
83
|
+
"targets": {
|
|
84
|
+
"type": "array",
|
|
85
|
+
"items": {
|
|
86
|
+
"type": "string",
|
|
87
|
+
"enum": [
|
|
88
|
+
"claude",
|
|
89
|
+
"openclaude",
|
|
90
|
+
"copilot",
|
|
91
|
+
"opencode",
|
|
92
|
+
"codex",
|
|
93
|
+
"gemini"
|
|
94
|
+
]
|
|
95
|
+
},
|
|
96
|
+
"description": "Campo legacy. Equivalente espanol: 'destinos'. Runtimes a los que se sincroniza este skill. Patron adoptado de skillshare (targets.yaml). Si ambos presentes deben coincidir (W010)."
|
|
97
|
+
},
|
|
98
|
+
"destinos": {
|
|
99
|
+
"type": "array",
|
|
100
|
+
"items": {
|
|
101
|
+
"type": "string",
|
|
102
|
+
"enum": [
|
|
103
|
+
"claude",
|
|
104
|
+
"openclaude",
|
|
105
|
+
"copilot",
|
|
106
|
+
"opencode",
|
|
107
|
+
"codex",
|
|
108
|
+
"gemini"
|
|
109
|
+
]
|
|
110
|
+
},
|
|
111
|
+
"description": "Alias en espanol de 'targets'. Campo propio de swl-ses. Runtimes a los que se sincroniza este skill."
|
|
112
|
+
},
|
|
113
|
+
"user-invocable": {
|
|
114
|
+
"type": "boolean",
|
|
115
|
+
"description": "Si el usuario puede invocar este skill directamente con Skill(nombre)"
|
|
116
|
+
},
|
|
117
|
+
"license": {
|
|
118
|
+
"type": "string",
|
|
119
|
+
"description": "Licencia del skill si es externo o adaptado"
|
|
120
|
+
},
|
|
121
|
+
"evolvable": {
|
|
122
|
+
"type": "boolean",
|
|
123
|
+
"description": "Campo legacy. Equivalente espanol: 'evolucionable'. Marca AGP learnability. Si false, el loop de auto-evolucion NO debe proponer cambios a este skill. Recomendado: false para skills criticos. Si ambos presentes deben coincidir (W010)."
|
|
124
|
+
},
|
|
125
|
+
"evolucionable": {
|
|
126
|
+
"type": "boolean",
|
|
127
|
+
"description": "Alias en espanol de 'evolvable'. Campo propio de swl-ses. Marca AGP learnability. Si false, el loop de auto-evolucion NO propone cambios a este skill."
|
|
128
|
+
},
|
|
129
|
+
"evolvable_scope": {
|
|
130
|
+
"type": "array",
|
|
131
|
+
"items": {
|
|
132
|
+
"type": "string",
|
|
133
|
+
"enum": [
|
|
134
|
+
"description",
|
|
135
|
+
"content",
|
|
136
|
+
"examples",
|
|
137
|
+
"references",
|
|
138
|
+
"anti-patterns"
|
|
139
|
+
]
|
|
140
|
+
},
|
|
141
|
+
"description": "Campo legacy. Equivalente espanol: 'evolucionable_alcance'. Si evolvable=true, limita las secciones del SKILL.md que pueden modificarse. Ausente implica 'content' y 'examples' unicamente. Si ambos presentes deben coincidir (W010)."
|
|
142
|
+
},
|
|
143
|
+
"evolucionable_alcance": {
|
|
144
|
+
"type": "array",
|
|
145
|
+
"items": {
|
|
146
|
+
"type": "string",
|
|
147
|
+
"enum": [
|
|
148
|
+
"description",
|
|
149
|
+
"content",
|
|
150
|
+
"examples",
|
|
151
|
+
"references",
|
|
152
|
+
"anti-patterns"
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"description": "Alias en espanol de 'evolvable_scope'. Campo propio de swl-ses. Si evolucionable=true, limita las secciones modificables."
|
|
156
|
+
},
|
|
157
|
+
"when_to_use": {
|
|
158
|
+
"type": "string",
|
|
159
|
+
"maxLength": 512,
|
|
160
|
+
"description": "Campo del protocolo Anthropic. Contexto adicional sobre cuando activar la skill, leido por Claude Code como bloque combinado con description (total max 1536 chars). Usar cuando description ocupa mas de 900 chars y aun hay triggers que no caben."
|
|
161
|
+
},
|
|
162
|
+
"exclusiones": {
|
|
163
|
+
"type": "array",
|
|
164
|
+
"items": {
|
|
165
|
+
"type": "string"
|
|
166
|
+
},
|
|
167
|
+
"description": "Situaciones donde esta skill NO debe activarse aunque parezca relevante superficialmente. Campo propio de swl-ses; previene skill hijacking por similitud de terminos. Equivalente estructural de la seccion 'Cuando NO cargar' en el cuerpo de SKILL.md, legible por herramientas de analisis sin parsear markdown."
|
|
168
|
+
},
|
|
169
|
+
"allowed-tools": {
|
|
170
|
+
"type": "array",
|
|
171
|
+
"items": {
|
|
172
|
+
"type": "string",
|
|
173
|
+
"enum": [
|
|
174
|
+
"Read",
|
|
175
|
+
"Write",
|
|
176
|
+
"Edit",
|
|
177
|
+
"Bash",
|
|
178
|
+
"Glob",
|
|
179
|
+
"Grep",
|
|
180
|
+
"WebSearch",
|
|
181
|
+
"WebFetch"
|
|
182
|
+
]
|
|
183
|
+
},
|
|
184
|
+
"description": "Campo del protocolo Anthropic. Pre-aprobacion de UX leida por Claude Code. NO es restriccion de seguridad real. Las restricciones reales provienen de permission rules en .claude/settings.json o del matcher en hooks."
|
|
185
|
+
},
|
|
186
|
+
"herramientasPermitidas": {
|
|
187
|
+
"type": "array",
|
|
188
|
+
"items": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"enum": [
|
|
191
|
+
"Read",
|
|
192
|
+
"Write",
|
|
193
|
+
"Edit",
|
|
194
|
+
"Bash",
|
|
195
|
+
"Glob",
|
|
196
|
+
"Grep",
|
|
197
|
+
"WebSearch",
|
|
198
|
+
"WebFetch"
|
|
199
|
+
]
|
|
200
|
+
},
|
|
201
|
+
"description": "Campo propio de swl-ses. Alias semantico de allowed-tools, usado por las herramientas internas (evaluar-skill, validadores). Debe coincidir con allowed-tools cuando ambos estan presentes. Si divergen, el validador emite W011. Para skills nuevos en swl-ses, declarar solo este campo; una herramienta de sincronizacion propagara el valor a allowed-tools al construir artefactos para Claude Code."
|
|
202
|
+
},
|
|
203
|
+
"nist_csf": {
|
|
204
|
+
"type": "array",
|
|
205
|
+
"items": {
|
|
206
|
+
"type": "string",
|
|
207
|
+
"pattern": "^(GV|ID|PR|DE|RS|RC)\\.[A-Z]{2}(-[0-9]{2})?$"
|
|
208
|
+
},
|
|
209
|
+
"description": "Campo propio de swl-ses. Mapeo a NIST Cybersecurity Framework 2.0. Cada entrada es un ID de subcategoria tipo 'GV.SC-07', 'PR.PS-01', 'DE.CM-01'. Opcional. Usado para reportes de cobertura en /swl:salud y /swl:dashboard. Referencia: https://www.nist.gov/cyberframework"
|
|
210
|
+
},
|
|
211
|
+
"nist_ai_rmf": {
|
|
212
|
+
"type": "array",
|
|
213
|
+
"items": {
|
|
214
|
+
"type": "string",
|
|
215
|
+
"pattern": "^(GOVERN|MAP|MEASURE|MANAGE)(-[0-9]+(\\.[0-9]+)?)?$"
|
|
216
|
+
},
|
|
217
|
+
"description": "Campo propio de swl-ses. Mapeo a NIST AI Risk Management Framework 1.0. Cada entrada es un ID de subcategoria tipo 'GOVERN-1.1', 'MAP-5.1', 'MEASURE-2.7'. Opcional. Particularmente relevante para skills de seguridad de sistemas agenticos. Referencia: https://airc.nist.gov/AI_RMF"
|
|
218
|
+
},
|
|
219
|
+
"atlas_techniques": {
|
|
220
|
+
"type": "array",
|
|
221
|
+
"items": {
|
|
222
|
+
"type": "string",
|
|
223
|
+
"pattern": "^AML\\.T[0-9]{4}(\\.[0-9]{3})?$"
|
|
224
|
+
},
|
|
225
|
+
"description": "Campo propio de swl-ses. Mapeo a MITRE ATLAS v5.4 (Adversarial Threat Landscape for AI Systems). Cada entrada es una tecnica tipo 'AML.T0051' (LLM Prompt Injection), 'AML.T0080' (AI Agent Context Poisoning). Opcional. Critico para skills que protegen el sistema agentico mismo. Referencia: https://atlas.mitre.org"
|
|
226
|
+
},
|
|
227
|
+
"attack_techniques": {
|
|
228
|
+
"type": "array",
|
|
229
|
+
"items": {
|
|
230
|
+
"type": "string",
|
|
231
|
+
"pattern": "^T[0-9]{4}(\\.[0-9]{3})?$"
|
|
232
|
+
},
|
|
233
|
+
"description": "Campo propio de swl-ses. Mapeo a MITRE ATT&CK v18. Cada entrada es una tecnica tipo 'T1071' (Application Layer Protocol), 'T1190' (Exploit Public-Facing Application). Opcional. Mas aplicable a skills de defensa de infraestructura o deteccion de amenazas en el sistema desplegado. Referencia: https://attack.mitre.org"
|
|
234
|
+
},
|
|
235
|
+
"d3fend_techniques": {
|
|
236
|
+
"type": "array",
|
|
237
|
+
"items": {
|
|
238
|
+
"type": "string",
|
|
239
|
+
"pattern": "^D3-[A-Z]+$"
|
|
240
|
+
},
|
|
241
|
+
"description": "Campo propio de swl-ses. Mapeo a MITRE D3FEND v1.3 (Defensive countermeasures). Cada entrada es una tecnica tipo 'D3-NTA' (Network Traffic Analysis), 'D3-PSA' (Process Spawn Analysis). Opcional. Referencia: https://d3fend.mitre.org"
|
|
242
|
+
}
|
|
243
|
+
},
|
|
244
|
+
"additionalProperties": true
|
|
245
|
+
}
|
|
@@ -82,7 +82,9 @@ function contarSkills(dir) {
|
|
|
82
82
|
|
|
83
83
|
function recolectarAgentes() {
|
|
84
84
|
const dir = path.join(RAIZ, 'agentes');
|
|
85
|
-
|
|
85
|
+
// Excluir fragmentos compartidos (`_*.md`) — no son agentes routables.
|
|
86
|
+
// Ver reglas/fragmentos-compartidos.md.
|
|
87
|
+
const archivos = fs.readdirSync(dir).filter(f => f.endsWith('.md') && !f.startsWith('_'));
|
|
86
88
|
return archivos.map(f => {
|
|
87
89
|
const fm = leerFrontmatter(path.join(dir, f));
|
|
88
90
|
return {
|
|
@@ -23,6 +23,7 @@ seccion "Code style": settings.local.json sobrescribe por key, no reemplaza.
|
|
|
23
23
|
from __future__ import annotations
|
|
24
24
|
|
|
25
25
|
import json
|
|
26
|
+
import os
|
|
26
27
|
import sys
|
|
27
28
|
from pathlib import Path
|
|
28
29
|
from typing import Any
|
|
@@ -30,9 +31,9 @@ from typing import Any
|
|
|
30
31
|
# Orden de capas: base -> override. La ultima capa gana por clave al hacer
|
|
31
32
|
# merge, igual que el deep merge interno de Claude Code.
|
|
32
33
|
CAPAS_DEFAULT = (
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
"mcp-servers.json",
|
|
35
|
+
".claude/settings.json",
|
|
36
|
+
".claude/settings.local.json",
|
|
36
37
|
)
|
|
37
38
|
|
|
38
39
|
|
|
@@ -45,10 +46,10 @@ def _leer_servers(ruta: Path) -> dict:
|
|
|
45
46
|
if not ruta.exists():
|
|
46
47
|
return {}
|
|
47
48
|
try:
|
|
48
|
-
data = json.loads(ruta.read_text(encoding=
|
|
49
|
+
data = json.loads(ruta.read_text(encoding="utf-8"))
|
|
49
50
|
except (OSError, json.JSONDecodeError):
|
|
50
51
|
return {}
|
|
51
|
-
servers = data.get(
|
|
52
|
+
servers = data.get("mcpServers")
|
|
52
53
|
if not isinstance(servers, dict):
|
|
53
54
|
return {}
|
|
54
55
|
return servers
|
|
@@ -71,12 +72,14 @@ def _fusionar_servidor(base: dict, override: dict) -> dict:
|
|
|
71
72
|
resultado: dict[str, Any] = dict(base)
|
|
72
73
|
|
|
73
74
|
for clave, valor in override.items():
|
|
74
|
-
if clave ==
|
|
75
|
-
env_base =
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
if clave == "env" and isinstance(valor, dict):
|
|
76
|
+
env_base = (
|
|
77
|
+
resultado.get("env") if isinstance(resultado.get("env"), dict) else {}
|
|
78
|
+
)
|
|
79
|
+
resultado["env"] = {**env_base, **valor}
|
|
80
|
+
elif clave == "args":
|
|
78
81
|
# args reemplaza, no mergea: una lista parcial seria peligrosa.
|
|
79
|
-
resultado[
|
|
82
|
+
resultado["args"] = valor
|
|
80
83
|
elif isinstance(valor, dict) and isinstance(resultado.get(clave), dict):
|
|
81
84
|
resultado[clave] = {**resultado[clave], **valor}
|
|
82
85
|
else:
|
|
@@ -111,17 +114,29 @@ def cargar_config_mcp(cwd: Path, config_path: str | None = None) -> dict:
|
|
|
111
114
|
return fusionado
|
|
112
115
|
|
|
113
116
|
|
|
117
|
+
def build_stdio_env(cfg: dict) -> dict:
|
|
118
|
+
"""Entorno para StdioServerParameters: siempre hereda os.environ.
|
|
119
|
+
|
|
120
|
+
Con env: {} en settings.json, devolver None hacia el SDK MCP dejaba al
|
|
121
|
+
subproceso sin variables del padre (p. ej. OBSIDIAN_API_KEY vía setx).
|
|
122
|
+
"""
|
|
123
|
+
extra = cfg.get("env") if isinstance(cfg.get("env"), dict) else {}
|
|
124
|
+
merged = dict(os.environ)
|
|
125
|
+
merged.update(extra)
|
|
126
|
+
return merged
|
|
127
|
+
|
|
128
|
+
|
|
114
129
|
def _main(argv: list[str]) -> int:
|
|
115
130
|
"""Entry point CLI: imprime el JSON fusionado para uso en tests."""
|
|
116
|
-
cwd = Path(argv[0]) if argv else Path(
|
|
131
|
+
cwd = Path(argv[0]) if argv else Path(".")
|
|
117
132
|
if not cwd.is_dir():
|
|
118
|
-
sys.stderr.write(f
|
|
133
|
+
sys.stderr.write(f"[mcp_config] CWD no es directorio: {cwd}\n")
|
|
119
134
|
return 1
|
|
120
135
|
resultado = cargar_config_mcp(cwd)
|
|
121
136
|
sys.stdout.write(json.dumps(resultado, indent=2, ensure_ascii=False))
|
|
122
|
-
sys.stdout.write(
|
|
137
|
+
sys.stdout.write("\n")
|
|
123
138
|
return 0
|
|
124
139
|
|
|
125
140
|
|
|
126
|
-
if __name__ ==
|
|
141
|
+
if __name__ == "__main__":
|
|
127
142
|
sys.exit(_main(sys.argv[1:]))
|