gitlab-skill 1.0.0

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.
@@ -0,0 +1,125 @@
1
+ # Security and Vulnerabilities
2
+
3
+ ## Objetivo
4
+
5
+ Habilitar un flujo autónomo para "listar vulnerabilidades del proyecto X" combinando:
6
+ - endpoints REST de seguridad disponibles en OpenAPI v2 local,
7
+ - GraphQL (fuente recomendada para objetos de vulnerabilidad),
8
+ - evidencia CI/CD y artefactos.
9
+
10
+ ## REST de seguridad en OpenAPI v2 (disponible en este repo)
11
+
12
+ ### NPM advisory/audit (proyecto)
13
+
14
+ - `POST /api/v4/projects/{id}/packages/npm/-/npm/v1/security/advisories/bulk`
15
+ - `POST /api/v4/projects/{id}/packages/npm/-/npm/v1/security/audits/quick`
16
+
17
+ ```bash
18
+ curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
19
+ --header "Content-Type: application/json" \
20
+ --data '{"name":"mobilcash-web","version":"1.0.0","requires":{},"dependencies":{}}' \
21
+ "$GITLAB_HOST/api/v4/projects/$PROJECT_ENC/packages/npm/-/npm/v1/security/advisories/bulk"
22
+
23
+ curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
24
+ --header "Content-Type: application/json" \
25
+ --data '{"name":"mobilcash-web","version":"1.0.0","requires":{},"dependencies":{}}' \
26
+ "$GITLAB_HOST/api/v4/projects/$PROJECT_ENC/packages/npm/-/npm/v1/security/audits/quick"
27
+ ```
28
+
29
+ ### NPM advisory/audit (grupo)
30
+
31
+ - `POST /api/v4/groups/{id}/-/packages/npm/-/npm/v1/security/advisories/bulk`
32
+ - `POST /api/v4/groups/{id}/-/packages/npm/-/npm/v1/security/audits/quick`
33
+
34
+ ```bash
35
+ curl --request POST --header "PRIVATE-TOKEN: $GITLAB_TOKEN" \
36
+ --header "Content-Type: application/json" \
37
+ --data '{"name":"mobilcash-web","version":"1.0.0","requires":{},"dependencies":{}}' \
38
+ "$GITLAB_HOST/api/v4/groups/$GROUP_ENC/-/packages/npm/-/npm/v1/security/audits/quick"
39
+ ```
40
+
41
+ ## GraphQL recomendado para vulnerabilidades
42
+
43
+ El esquema GraphQL es versionless; para robustez, siempre hacer introspección antes de consultas críticas.
44
+
45
+ ### Paso 1: introspección rápida
46
+
47
+ ```bash
48
+ curl --request POST \
49
+ --url "$GITLAB_HOST/api/graphql" \
50
+ --header "Authorization: Bearer $GITLAB_TOKEN" \
51
+ --header "Content-Type: application/json" \
52
+ --data '{"query":"query { __type(name:\"Project\") { fields { name } } }"}'
53
+ ```
54
+
55
+ ### Paso 2: query base de vulnerabilidades (ajustar según schema)
56
+
57
+ ```graphql
58
+ query($fullPath: ID!, $first: Int!, $after: String) {
59
+ project(fullPath: $fullPath) {
60
+ vulnerabilities(first: $first, after: $after) {
61
+ nodes {
62
+ id
63
+ title
64
+ description
65
+ severity
66
+ state
67
+ reportType
68
+ confidence
69
+ }
70
+ pageInfo {
71
+ endCursor
72
+ hasNextPage
73
+ }
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Paso 3: paginación
80
+
81
+ - Inicial: `after=null`, `first=100`.
82
+ - Repetir mientras `hasNextPage=true`.
83
+ - Acumular todos los `nodes`.
84
+
85
+ ## Pipeline de "listar vulnerabilidades de Mobilcash Web"
86
+
87
+ 1. Resolver proyecto (`PROJECT_ENC` y `fullPath`).
88
+ 2. Pull de vulnerabilidades por GraphQL paginado.
89
+ 3. Pull de evidencia CI:
90
+ - pipelines recientes (`/pipelines`)
91
+ - jobs de seguridad (`/pipelines/{id}/jobs`)
92
+ - traces de jobs fallidos (`/jobs/{job_id}/trace`)
93
+ 4. Si aplica NPM, ejecutar audit/advisory REST.
94
+ 5. Consolidar:
95
+ - resumen por severidad (`critical/high/medium/low`)
96
+ - resumen por estado (`detected/confirmed/resolved/...`)
97
+ - tabla de hallazgos con evidencia (`pipeline_id`, `job_id`, `web_url`)
98
+ 6. Entregar acciones sugeridas:
99
+ - parche de dependencia
100
+ - MR recomendado
101
+ - variable/policy de CI a ajustar
102
+
103
+ ## Formato de salida sugerido para agentes
104
+
105
+ ```json
106
+ {
107
+ "project": "group/mobilcash-web",
108
+ "generated_at": "2026-02-18T00:00:00Z",
109
+ "summary": {
110
+ "total": 0,
111
+ "by_severity": {"critical": 0, "high": 0, "medium": 0, "low": 0},
112
+ "by_state": {"detected": 0, "confirmed": 0, "resolved": 0}
113
+ },
114
+ "findings": [],
115
+ "evidence": {
116
+ "pipelines_checked": [],
117
+ "jobs_checked": [],
118
+ "audit_sources": ["graphql", "npm_audit_quick"]
119
+ }
120
+ }
121
+ ```
122
+
123
+ ## Nota de precisión
124
+
125
+ En este snapshot `openapi_v2.yaml`, la cobertura directa de recursos de vulnerabilidades es parcial en REST. Para cobertura completa, preferir GraphQL + introspección activa.
@@ -0,0 +1,68 @@
1
+ # GraphQL and glab Playbook
2
+
3
+ ## Objetivo
4
+
5
+ Estandarizar operación avanzada por GraphQL y por `glab api` para agentes autónomos.
6
+
7
+ ## GraphQL: patrones
8
+
9
+ ### Query con variables
10
+
11
+ ```bash
12
+ curl --request POST \
13
+ --url "$GITLAB_HOST/api/graphql" \
14
+ --header "Authorization: Bearer $GITLAB_TOKEN" \
15
+ --header "Content-Type: application/json" \
16
+ --data '{"query":"query($fullPath: ID!){ project(fullPath:$fullPath){ id fullPath } }","variables":{"fullPath":"'"$TARGET_PROJECT_PATH"'"}}'
17
+ ```
18
+
19
+ ### Introspección de tipo
20
+
21
+ ```bash
22
+ curl --request POST \
23
+ --url "$GITLAB_HOST/api/graphql" \
24
+ --header "Authorization: Bearer $GITLAB_TOKEN" \
25
+ --header "Content-Type: application/json" \
26
+ --data '{"query":"query { __type(name:\"Query\") { fields { name } } }"}'
27
+ ```
28
+
29
+ ### Reglas de calidad GraphQL
30
+
31
+ - Usar `variables` para no exceder 10k chars.
32
+ - Mantener complejidad bajo límite (auth: 250).
33
+ - Tratar Global IDs como opacos (`gid://gitlab/...`).
34
+ - Implementar paginación por `pageInfo`.
35
+
36
+ ## glab: comandos útiles
37
+
38
+ ```bash
39
+ # Estado
40
+ glab auth status
41
+ glab api "/user"
42
+
43
+ # REST por API
44
+ glab api "/projects/$PROJECT_ENC"
45
+ glab api "/projects/$PROJECT_ENC/issues?state=opened&per_page=100" --paginate
46
+ glab api "/projects/$PROJECT_ENC/merge_requests?scope=all&state=opened&per_page=100" --paginate
47
+ glab api "/projects/$PROJECT_ENC/pipelines?per_page=100" --paginate
48
+
49
+ # GraphQL por CLI
50
+ glab api graphql -f query='query { currentUser { id username name } }'
51
+ glab api graphql -f query='query { __type(name:"Project") { fields { name } } }'
52
+ ```
53
+
54
+ ## Plantilla de ejecución autónoma
55
+
56
+ 1. Validar auth (`glab auth status` o ping API).
57
+ 2. Resolver proyecto/grupo.
58
+ 3. Ejecutar feature workflow (archivo correspondiente).
59
+ 4. Guardar resultados JSON intermedios.
60
+ 5. Generar resumen final + acciones.
61
+
62
+ ## Convención de salida
63
+
64
+ - `status`: `ok|partial|error`
65
+ - `scope`: `project|group|instance`
66
+ - `operations`: lista de llamadas ejecutadas
67
+ - `errors`: lista normalizada `{http_code, endpoint, message}`
68
+ - `artifacts`: archivos JSON/CSV/reportes generados