@cat-indev/catops-cli 0.0.1-alpha.10 → 0.0.1-alpha.12

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/README.md CHANGED
@@ -5,7 +5,7 @@ Framework para pipelines DevOps, escrito en **TypeScript** (100% usable desde Ja
5
5
  Trae:
6
6
 
7
7
  - Un **ExecutionContext** compartido (`flags`, `params`, `env`, `vars`, `results`, `logger`, `services`, `notifier`) para que ninguna task tenga que recibir parámetros manualmente.
8
- - **15 servicios** listos (`shell`, `docker`, `git`, `kubectl`, `helm`, `npm`, `archive`, `terraform`, `ansible`, `argocd`, `tekton`, `oc`, `az`, `azdo`, `http`) + un **cliente REST API** para Azure DevOps (`AzureDevOpsApi`) + un **motor de pipelines** declarativo con dependencias (`Pipeline`).
8
+ - **16 servicios** listos (`shell`, `docker`, `git`, `kubectl`, `helm`, `npm`, `archive`, `terraform`, `ansible`, `argocd`, `tekton`, `oc`, `az`, `azdo`, `http`, `yaml`) + un **cliente REST API** para Azure DevOps (`AzureDevOpsApi`) + un **motor de pipelines** declarativo con dependencias (`Pipeline`).
9
9
  - **Servicio HTTP** con interceptores de request/response, registry de agentes nombrados, configuración global, query params, dry-run y timeout.
10
10
  - **Menús interactivos** con navegación anidada y **selección automática por flag** (para correr pipelines sin prompts, ideal para CI).
11
11
  - **retry / timeout / dryRun** en cada comando de shell.
@@ -52,10 +52,10 @@ Cualquiera de las 4 deja disponibles dos cosas en el proyecto consumidor:
52
52
 
53
53
  1. La librería, tanto desde TS como desde JS puro:
54
54
  ```typescript
55
- import { Context, Menu, services, type MenuDefinition } from "catops-cli";
55
+ import { Context, Menu, services, YamlService, type MenuDefinition } from "catops-cli";
56
56
  ```
57
57
  ```javascript
58
- const { Context, Menu, services } = require("catops-cli");
58
+ const { Context, Menu, services, YamlService } = require("catops-cli");
59
59
  ```
60
60
  2. El binario: `npx catops-cli` (o `catops-cli` si lo instalaste global con `-g`).
61
61
 
@@ -89,7 +89,8 @@ src/
89
89
  http.ts -> cliente HTTP con interceptores de request/response, múltiples instancias
90
90
  http-types.ts -> tipos del servicio HTTP (HttpRequest, HttpResponse, interceptors, ...)
91
91
  docker.ts, git.ts, kubectl.ts, helm.ts, npm.ts, archive.ts
92
- terraform.ts, ansible.ts, argocd.ts, tekton.ts, oc.ts, az.ts, azdo.ts, azdo-api.ts, pipeline.ts
92
+ terraform.ts, ansible.ts, argocd.ts, tekton.ts, oc.ts, az.ts, azdo.ts, azdo-api.ts, pipeline.ts
93
+ yaml.ts -> YamlService: manipulación de archivos YAML con prepare(), multidocument, comentarios
93
94
  index.ts -> registra todos los servicios anteriores (ServicesRegistry)
94
95
  index.ts -> entry point público: Context, Menu, Notifier, senders, classifiers, messages, services, http, tipos
95
96
  bin/
@@ -100,8 +101,8 @@ test/
100
101
  context.test.js, shell.test.js, services.test.js, menu-selector.test.js,
101
102
  notifier.test.js, senders.test.js, hooks-integration.test.js,
102
103
  http.test.js, kubectl.test.js, oc.test.js, deployment-group.test.js,
103
- exec-options-passthrough.test.js, azdo-api.test.js, pipeline.test.js,
104
- service-notify.test.js
104
+ exec-options-passthrough.test.js, azdo-api.test.js, pipeline.test.js,
105
+ service-notify.test.js, yaml.test.js
105
106
  ```
106
107
 
107
108
  ## Uso rápido: menú con `devops.pipeline.js` + el bin
@@ -1223,6 +1224,170 @@ const docker = ctx.wrap(ctx.services.docker, "docker");
1223
1224
  docker.version; // pasa directo, sin proxy
1224
1225
  ```
1225
1226
 
1227
+ ## Servicio YAML: manipulación de archivos de configuración (`ctx.services.yaml`)
1228
+
1229
+ Un servicio para leer, modificar y serializar archivos YAML con soporte para operaciones declarativas, comentarios, y documentos múltiples.
1230
+
1231
+ ### Uso básico
1232
+
1233
+ ```typescript
1234
+ // Parsear YAML desde string
1235
+ ctx.services.yaml.fromYaml(`
1236
+ apiVersion: v1
1237
+ kind: ConfigMap
1238
+ metadata:
1239
+ name: app-config
1240
+ data:
1241
+ ENV: production
1242
+ `);
1243
+
1244
+ // Obtener valores
1245
+ ctx.services.yaml.yamlGet("metadata.name"); // "app-config"
1246
+ ctx.services.yaml.yamlGet("data.ENV", "default"); // "production"
1247
+
1248
+ // Asignar valores (crea paths nuevos si no existen)
1249
+ ctx.services.yaml.yamlSet(["data", "DEBUG"], "false");
1250
+
1251
+ // Serializar a YAML
1252
+ const yamlString = ctx.services.yaml.yamlify();
1253
+
1254
+ // Serializar a JSON
1255
+ const jsonString = ctx.services.yaml.stringify();
1256
+ ```
1257
+
1258
+ ### Trabajar con JSON
1259
+
1260
+ ```typescript
1261
+ // Convertir JSON a YAML interno
1262
+ ctx.services.yaml.fromJson({
1263
+ apiVersion: "v1",
1264
+ kind: "Service",
1265
+ metadata: { name: "api-service" }
1266
+ });
1267
+
1268
+ // Obtener como objeto JSON
1269
+ const obj = ctx.services.yaml.jsonify();
1270
+ ```
1271
+
1272
+ ### Arrays y omisión de keys
1273
+
1274
+ ```typescript
1275
+ // Agregar elementos a un array
1276
+ ctx.services.yaml.yamlPush(["data", "ALLOWED_HOSTS"], ["host1.example.com", "host2.example.com"]);
1277
+
1278
+ // Concatenar al inicio de un string
1279
+ ctx.services.yaml.yamlConcatInitAndSet(["data", "PREFIX"], "prod-"); // "prod-valor-anterior"
1280
+
1281
+ // Eliminar paths del documento
1282
+ ctx.services.yaml.yamlOmit(["data", "DEBUG", "data", "TEMP"]);
1283
+ ```
1284
+
1285
+ ### Comentarios
1286
+
1287
+ ```typescript
1288
+ // Agregar commentBefore a un nodo específico
1289
+ ctx.services.yaml.comment("Configuración del backend", ["data", "BACKEND_URL"]);
1290
+ ```
1291
+
1292
+ ### Declaraciones batch con `prepare()`
1293
+
1294
+ `prepare()` permite aplicar múltiples mutaciones en una sola llamada — ideal para transformaciones complejas:
1295
+
1296
+ ```typescript
1297
+ ctx.services.yaml.prepare({
1298
+ // Asignar valores por path
1299
+ $set: [
1300
+ { path: "apiVersion", value: "v1" },
1301
+ { path: "metadata.labels.env", value: "production" }
1302
+ ],
1303
+
1304
+ // Agregar a arrays
1305
+ $push: [
1306
+ { path: "spec.containers", value: { name: "sidecar", image: "proxy:v1" } }
1307
+ ],
1308
+
1309
+ // Fusionar objetos existentes
1310
+ $spread: [
1311
+ { path: "metadata.labels", value: { version: "v2", team: "platform" } }
1312
+ ],
1313
+
1314
+ // Asignar el mismo valor a múltiples paths
1315
+ $superSet: {
1316
+ value: "true",
1317
+ $set: ["data.ENABLE_FEATURE_A", "data.ENABLE_FEATURE_B"],
1318
+ $init: ["data.PREFIX"] // concatena al inicio en vez de reemplazar
1319
+ },
1320
+
1321
+ // Asignar valores por path (shorthand)
1322
+ $merge: {
1323
+ "data.RETRY_COUNT": "3",
1324
+ "data.TIMEOUT": "30000"
1325
+ },
1326
+
1327
+ // Eliminar keys
1328
+ $delete: ["data.DEBUG", "data.TEMP"]
1329
+ });
1330
+ ```
1331
+
1332
+ ### Documentos múltiples
1333
+
1334
+ Para archivos YAML con múltiples documentos separados por `---`:
1335
+
1336
+ ```typescript
1337
+ // Crear documentos múltiples
1338
+ ctx.services.yaml.multidocument(
1339
+ { yaml: "kind: Deployment\nmetadata:\n name: api", name: "deployment" },
1340
+ { replicas: 3 } // apply extra values sobre el nuevo doc
1341
+ );
1342
+
1343
+ ctx.services.yaml.multidocument(
1344
+ { yaml: "kind: Service\nmetadata:\n name: api-svc", name: "service" }
1345
+ );
1346
+
1347
+ // Cambiar entre documentos
1348
+ ctx.services.yaml.use("deployment");
1349
+ console.log(ctx.services.yaml.yamlify()); // imprime el doc "deployment"
1350
+
1351
+ ctx.services.yaml.use("service");
1352
+ console.log(ctx.services.yaml.yamlify()); // imprime el doc "service"
1353
+
1354
+ // Verificar si un documento existe
1355
+ ctx.services.yaml.existDocument("deployment"); // true
1356
+ ```
1357
+
1358
+ ### Clonar
1359
+
1360
+ ```typescript
1361
+ const clone = ctx.services.yaml.clone();
1362
+ // clone es independiente — modificar uno no afecta al otro
1363
+ ```
1364
+
1365
+ ### Parsear YAML vacío
1366
+
1367
+ ```typescript
1368
+ ctx.services.yaml.fromYaml(""); // crea documento vacío, no lanza error
1369
+ ```
1370
+
1371
+ ### Ejemplo completo: modificar un Deployment de Kubernetes
1372
+
1373
+ ```typescript
1374
+ ctx.services.yaml.fromYaml(readFileSync("deployment.yaml", "utf8"));
1375
+
1376
+ ctx.services.yaml.prepare({
1377
+ $set: [
1378
+ { path: "spec.template.metadata.labels.version", value: "v2.1.0" },
1379
+ { path: "spec.template.spec.containers.0.image", value: "registry/app:v2.1.0" }
1380
+ ],
1381
+ $spread: [
1382
+ { path: "spec.template.metadata.annotations", value: { "deployed-at": new Date().toISOString() } }
1383
+ ],
1384
+ $delete: ["spec.template.spec.initContainers"]
1385
+ });
1386
+
1387
+ const updatedYaml = ctx.services.yaml.yamlify();
1388
+ writeFileSync("deployment.yaml", updatedYaml);
1389
+ ```
1390
+
1226
1391
  ## Tests
1227
1392
 
1228
1393
  ```bash
@@ -1245,6 +1410,7 @@ npm test
1245
1410
  - `azdo-api.test.js` — AzureDevOpsApi contra mock server: proyectos, repos, branches, commits, PRs, builds, pipelines, work items, overrides
1246
1411
  - `pipeline.test.js` — Pipeline motor: stages/jobs/tasks, dependencias cross-level con paths dotted, resultados jerárquicos (stage.job.task), fluent API, registry, reset, ctx access, detección de tipo por propiedad, PipelineResultsAccessor
1247
1412
  - `service-notify.test.js` — ServiceError, ctx.wrap(), Notifier con service/method/args, classifiers.byService/messages.byService, unwrap de ServiceError en byCommand/byPattern/byRule, integración completa, backward compat
1413
+ - `yaml.test.js` — YamlService: fromYaml/fromJson, yamlGet/yamlSet/yamlPush/yamlOmit, comment(), prepare() con $set/$push/$spread/$superSet/$merge/$delete, multidocument/use/clone
1248
1414
 
1249
1415
  ## Siguientes pasos posibles
1250
1416
 
@@ -1252,3 +1418,4 @@ npm test
1252
1418
  - Agregar más plugins (`ansible-lint`, `trivy`, `sonar-scanner`) con el mismo patrón que `terraform.ts`/`docker.ts`.
1253
1419
  - CI propio (GitHub Actions/Azure Pipelines) que corra `npm test` en cada PR antes de `npm publish`.
1254
1420
  - `--catch=throw` (o similar) para que un item de menú fallido mate el proceso completo en vez de solo loguear y seguir — útil corriendo vía `--menu-selector` dentro de un step de Azure Pipelines.
1421
+ - Exportar tipos YAML (`YamlPrepareActions`) y crear helpers para templates comunes (Kubernetes manifests, Helm values, etc.).
package/dist/index.d.ts CHANGED
@@ -8,10 +8,12 @@ export { services } from "./services";
8
8
  export type { ServicesRegistry } from "./services";
9
9
  export { PipelineRegistry, Pipeline, PipelineStage, PipelineJob, PipelineTask, PipelineResultsAccessor } from "./services/pipeline";
10
10
  export type { PipelineConfig, PipelineStageConfig, PipelineJobConfig, PipelineTaskConfig, PipelineTaskBase, CallbackTaskConfig, PipelineRunResult, PipelineEntityStatus } from "./services/pipeline";
11
+ export { YamlService } from "./services/yaml";
12
+ export type { YamlPrepareActions } from "./services/yaml";
11
13
  export { http, HttpService, HttpRegistry } from "./services/http";
12
14
  export type { HttpMethod, HttpRequest, HttpResponse, HttpServiceConfig, RequestInterceptor, ResponseInterceptor, RequestContext, ResponseContext } from "./services/http-types";
13
15
  export { AzureDevOpsApi } from "./services/azdo-api";
14
- export type { AzureDevOpsApiConfig, AzdoRequestOptions, AzdoProject, AzdoGitRepository, AzdoGitBranch, AzdoGitCommitRef, AzdoGitAuthor, AzdoGitPullRequest, AzdoBuildDefinition, AzdoBuild, AzdoPipeline, AzdoWorkItem, AzdoListResponse } from "./services/azdo-api";
16
+ export type { AzureDevOpsApiConfig, AzdoRequestOptions, AzdoProject, AzdoGitRepository, AzdoGitBranch, AzdoGitCommitRef, AzdoGitAuthor, AzdoGitPullRequest, AzdoBuildDefinition, AzdoBuild, AzdoPipeline, AzdoWorkItem, AzdoListResponse, AzdoWebHookSubscription, AzdoEnvironment, AzdoIdentityGroup, AzdoPolicyConfiguration, AzdoAgentPool, AzdoAgentQueue, AzdoVariableGroup, AzdoBuildFolder, AzdoServiceEndpoint, AzdoGitRef, AzdoGitTag, AzdoGitItem } from "./services/azdo-api";
15
17
  export { Notifier } from "./core/Notifier";
16
18
  export * as senders from "./core/senders";
17
19
  export * as classifiers from "./core/classifiers";
package/dist/index.js CHANGED
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.ServiceError = exports.messages = exports.classifiers = exports.senders = exports.Notifier = exports.AzureDevOpsApi = exports.HttpRegistry = exports.HttpService = exports.http = exports.PipelineResultsAccessor = exports.PipelineTask = exports.PipelineJob = exports.PipelineStage = exports.Pipeline = exports.PipelineRegistry = exports.services = exports.prompt = exports.logger = exports.Menu = exports.Context = void 0;
36
+ exports.ServiceError = exports.messages = exports.classifiers = exports.senders = exports.Notifier = exports.AzureDevOpsApi = exports.HttpRegistry = exports.HttpService = exports.http = exports.YamlService = exports.PipelineResultsAccessor = exports.PipelineTask = exports.PipelineJob = exports.PipelineStage = exports.Pipeline = exports.PipelineRegistry = exports.services = exports.prompt = exports.logger = exports.Menu = exports.Context = void 0;
37
37
  var Context_1 = require("./core/Context");
38
38
  Object.defineProperty(exports, "Context", { enumerable: true, get: function () { return Context_1.Context; } });
39
39
  var Menu_1 = require("./core/Menu");
@@ -50,6 +50,8 @@ Object.defineProperty(exports, "PipelineStage", { enumerable: true, get: functio
50
50
  Object.defineProperty(exports, "PipelineJob", { enumerable: true, get: function () { return pipeline_1.PipelineJob; } });
51
51
  Object.defineProperty(exports, "PipelineTask", { enumerable: true, get: function () { return pipeline_1.PipelineTask; } });
52
52
  Object.defineProperty(exports, "PipelineResultsAccessor", { enumerable: true, get: function () { return pipeline_1.PipelineResultsAccessor; } });
53
+ var yaml_1 = require("./services/yaml");
54
+ Object.defineProperty(exports, "YamlService", { enumerable: true, get: function () { return yaml_1.YamlService; } });
53
55
  var http_1 = require("./services/http");
54
56
  Object.defineProperty(exports, "http", { enumerable: true, get: function () { return http_1.http; } });
55
57
  Object.defineProperty(exports, "HttpService", { enumerable: true, get: function () { return http_1.HttpService; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAGhB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAEb,wCAAuC;AAA9B,gGAAA,MAAM,OAAA;AAGf,wDAAwC;AAExC,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAGjB,gDAAoI;AAA3H,4GAAA,gBAAgB,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mHAAA,uBAAuB,OAAA;AAYtG,wCAAkE;AAAzD,4FAAA,IAAI,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,oGAAA,YAAY,OAAA;AAYxC,gDAAqD;AAA5C,0GAAA,cAAc,OAAA;AAiBvB,4CAA2C;AAAlC,oGAAA,QAAQ,OAAA;AACjB,0DAA0C;AAC1C,kEAAkD;AAClD,4DAA4C;AAmB5C,sCAA4C;AAAnC,qGAAA,YAAY,OAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAAyC;AAAhC,kGAAA,OAAO,OAAA;AAGhB,oCAAmC;AAA1B,4FAAA,IAAI,OAAA;AAEb,wCAAuC;AAA9B,gGAAA,MAAM,OAAA;AAGf,wDAAwC;AAExC,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAGjB,gDAAoI;AAA3H,4GAAA,gBAAgB,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,wGAAA,YAAY,OAAA;AAAE,mHAAA,uBAAuB,OAAA;AAYtG,wCAA8C;AAArC,mGAAA,WAAW,OAAA;AAGpB,wCAAkE;AAAzD,4FAAA,IAAI,OAAA;AAAE,mGAAA,WAAW,OAAA;AAAE,oGAAA,YAAY,OAAA;AAYxC,gDAAqD;AAA5C,0GAAA,cAAc,OAAA;AA6BvB,4CAA2C;AAAlC,oGAAA,QAAQ,OAAA;AACjB,0DAA0C;AAC1C,kEAAkD;AAClD,4DAA4C;AAmB5C,sCAA4C;AAAnC,qGAAA,YAAY,OAAA"}
@@ -120,6 +120,97 @@ export interface AzdoListResponse<T> {
120
120
  count: number;
121
121
  value: T[];
122
122
  }
123
+ export interface AzdoWebHookSubscription {
124
+ id: number;
125
+ publisherId: string;
126
+ publisherInputs: Record<string, string>;
127
+ consumerInputs: Record<string, string>;
128
+ eventType: string;
129
+ resourceVersion: string;
130
+ scope: number;
131
+ }
132
+ export interface AzdoEnvironment {
133
+ id: number;
134
+ name: string;
135
+ description: string;
136
+ project: AzdoProject;
137
+ }
138
+ export interface AzdoIdentityGroup {
139
+ displayName: string;
140
+ samAccountName: string;
141
+ localId: string;
142
+ subjectDescriptor: string;
143
+ imageUrl?: string;
144
+ uniqueName?: string;
145
+ metaType?: string;
146
+ sid?: string;
147
+ mailAddress?: string;
148
+ }
149
+ export interface AzdoPolicyConfiguration {
150
+ id: number;
151
+ url: string;
152
+ type: {
153
+ id: string;
154
+ displayName: string;
155
+ };
156
+ isEnabled: boolean;
157
+ isBlocking: boolean;
158
+ settings: Record<string, unknown>;
159
+ }
160
+ export interface AzdoAgentPool {
161
+ id: number;
162
+ name: string;
163
+ url: string;
164
+ size: number;
165
+ isHosted: boolean;
166
+ }
167
+ export interface AzdoAgentQueue {
168
+ id: number;
169
+ name: string;
170
+ pool: AzdoAgentPool;
171
+ url: string;
172
+ }
173
+ export interface AzdoVariableGroup {
174
+ id: number;
175
+ name: string;
176
+ variables: Record<string, {
177
+ value?: string;
178
+ isSecret?: boolean;
179
+ }>;
180
+ type: string;
181
+ }
182
+ export interface AzdoBuildFolder {
183
+ path: string;
184
+ project: AzdoProject;
185
+ }
186
+ export interface AzdoServiceEndpoint {
187
+ id: string;
188
+ name: string;
189
+ type: string;
190
+ url: string;
191
+ projectReferences: Array<{
192
+ id: string;
193
+ name: string;
194
+ }>;
195
+ }
196
+ export interface AzdoGitRef {
197
+ name: string;
198
+ objectId: string;
199
+ peeledObjectId?: string;
200
+ creator?: AzdoGitAuthor;
201
+ }
202
+ export interface AzdoGitTag {
203
+ name: string;
204
+ ref: string;
205
+ objectId: string;
206
+ creator?: AzdoGitAuthor;
207
+ peeledObjectId?: string;
208
+ }
209
+ export interface AzdoGitItem {
210
+ path: string;
211
+ content?: string;
212
+ contentType?: string;
213
+ }
123
214
  export declare class AzureDevOpsApi {
124
215
  private baseUrl;
125
216
  private pat;
@@ -209,5 +300,126 @@ export declare class AzureDevOpsApi {
209
300
  url: string;
210
301
  }>;
211
302
  }>>;
303
+ /** Verifica si un repositorio existe. Devuelve el repo o `undefined`. */
304
+ repoExists(project: string | undefined, repoName: string, opts?: AzdoRequestOptions): Promise<AzdoGitRepository | undefined>;
305
+ /** Crea un repositorio en un proyecto. */
306
+ createRepository(projectName: string, projectId: string, repoName: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitRepository>>;
307
+ /** Crea una branch nueva a partir de un commit ID. */
308
+ createBranch(project: string | undefined, repoName: string, branchName: string, fromObjectId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoGitRef[]>>;
309
+ /** Obtiene el último commit de un repo. Devuelve `null` si no hay commits. */
310
+ getLatestCommit(project: string | undefined, repoNameOrId: string, opts?: AzdoRequestOptions): Promise<{
311
+ commitId: string;
312
+ message: string;
313
+ date: string;
314
+ author: {
315
+ name: string;
316
+ date: string;
317
+ };
318
+ } | null>;
319
+ /** Verifica si un archivo existe en una branch. Devuelve el item o `undefined`. */
320
+ fileExists(project: string | undefined, repoName: string, branchName: string, filePath: string, opts?: AzdoRequestOptions): Promise<AzdoGitItem | undefined>;
321
+ /** Crea o actualiza un archivo en una branch (push de un solo archivo). */
322
+ createOrUpdateFile(options: {
323
+ project: string | undefined;
324
+ repo: string;
325
+ branch: string;
326
+ filePath: string;
327
+ fileContent: string | Buffer;
328
+ comment?: string;
329
+ }, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
330
+ /**
331
+ * Crea un archivo en un repo. Si el contenido es una de las plantillas
332
+ * conocidas (ej. `$README:TEMPLATE`), genera un README.md con el contenido
333
+ * por defecto.
334
+ */
335
+ createFileInRepo(project: string | undefined, repo: string, branch: string, fileName: string, filePath: string, fileContent: string, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
336
+ /** Crea un repositorio y lo inicializa con un README. */
337
+ createAndInitRepository(projectName: string, projectId: string, repository: string, opts?: AzdoRequestOptions): Promise<AzdoGitRepository>;
338
+ /** Hace un push con múltiples cambios (add/edit/delete) en un solo commit. */
339
+ pushChanges(options: {
340
+ project: string | undefined;
341
+ repository: string;
342
+ branch: string;
343
+ changes: Array<{
344
+ changeType: string;
345
+ item: {
346
+ path: string;
347
+ };
348
+ newContent?: {
349
+ content: string;
350
+ contentType: string;
351
+ };
352
+ }>;
353
+ comment: string;
354
+ }, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
355
+ /** Descarga un repositorio completo como buffer ZIP. */
356
+ downloadRepositoryZip(options: {
357
+ project: string;
358
+ repository: string;
359
+ branch: string;
360
+ scopePath?: string;
361
+ }, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
362
+ /** Verifica si existe un webhook de push para un repo/branch/URL dados. */
363
+ webhookExists(projectId: string, repositoryId: string, branchName: string, webhookUrl: string, opts?: AzdoRequestOptions): Promise<AzdoWebHookSubscription | undefined>;
364
+ /** Crea un webhook de push para un repositorio. */
365
+ createWebhook(projectId: string, repoId: string, sourceBranch: string, webhookUrl: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoWebHookSubscription>>;
366
+ /** Crea un environment en un proyecto. */
367
+ createEnvironment(project: string | undefined, name: string, description?: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoEnvironment>>;
368
+ /** Busca un grupo de identidades por nombre (SAM account name). */
369
+ findIdentityGroup(groupName: string, opts?: AzdoRequestOptions): Promise<AzdoIdentityGroup>;
370
+ /** Crea una approval check para un environment. */
371
+ createEnvironmentApproval(project: string | undefined, environmentId: number, environmentName: string, approver: AzdoIdentityGroup, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
372
+ /**
373
+ * Crea un environment con approvals.
374
+ * Si `approverGroup` es `"none"`, no agrega approvals.
375
+ */
376
+ createEnvironmentWithApprovals(options: {
377
+ project: string | undefined;
378
+ environmentName: string;
379
+ description?: string;
380
+ approverGroup: string;
381
+ }, opts?: AzdoRequestOptions): Promise<AzdoEnvironment>;
382
+ /** Crea una política de validación de email del committer. */
383
+ applyCommitterRegexPermissions(projectId: string, opts?: AzdoRequestOptions): Promise<HttpResponse<number>>;
384
+ /** Actualiza una política de validación de email del committer. */
385
+ updateCommitterRegexPermissions(projectId: string, policyId: number, allowedEmailPatterns: string[], opts?: AzdoRequestOptions): Promise<HttpResponse<number>>;
386
+ /** Obtiene los grupos con permisos de contribuidor del proyecto. */
387
+ getContributorGroups(projectId: string, projectName: string, opts?: AzdoRequestOptions): Promise<AzdoIdentityGroup[]>;
388
+ /** Deniega permisos a una entidad por SID. */
389
+ denyPermission(projectId: string, entityId: string, permissionCode: number, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
390
+ /** Deniega permisos a un usuario por email. */
391
+ denyPermissionByEmail(projectId: string, userEmail: string, permissionCode: number, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
392
+ /**
393
+ * Aplica permisos a todos los proyectos: crea la política de regex,
394
+ * obtiene los grupos, y deniega los permisos de Force Push y Create Branch.
395
+ */
396
+ applyPermissions(opts?: AzdoRequestOptions): Promise<Array<{
397
+ project: string;
398
+ groupsProcessed: number;
399
+ }>>;
400
+ /** Asocia un agent pool existente a un proyecto (crea una queue). */
401
+ addAgentPoolToProject(project: string | undefined, agentPoolName: string, opts?: AzdoRequestOptions): Promise<HttpResponse<AzdoAgentQueue>>;
402
+ /** Autoriza todos los pipelines para usar una queue. */
403
+ authorizeAgentPool(project: string | undefined, queueId: number, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
404
+ /** Crea un variable group. Si ya existe con el mismo nombre, lo devuelve sin crear. */
405
+ createVariableGroup(project: string | undefined, name: string, variables?: Record<string, {
406
+ value?: string;
407
+ isSecret?: boolean;
408
+ }>, opts?: AzdoRequestOptions): Promise<AzdoVariableGroup>;
409
+ /** Crea una carpeta de build. Si ya existe, la devuelve. */
410
+ createBuildFolder(project: string | undefined, folderPath: string, opts?: AzdoRequestOptions): Promise<AzdoBuildFolder>;
411
+ /** Crea un pipeline YAML asociado a un repositorio. */
412
+ createPipeline(options: {
413
+ project: string | undefined;
414
+ name: string;
415
+ folder?: string;
416
+ repository: string;
417
+ yamlPath: string;
418
+ defaultBranch?: string;
419
+ }, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
420
+ /** Comparte un service endpoint con un proyecto. */
421
+ shareServiceConnection(project: string, resourceId: string, resourceName: string, opts?: AzdoRequestOptions): Promise<HttpResponse<unknown>>;
422
+ /** Lista todas las tags de un repositorio. */
423
+ getTags(project: string | undefined, repository: string, opts?: AzdoRequestOptions): Promise<AzdoGitTag[]>;
212
424
  }
213
425
  export {};