@copado/agentia-cli 0.42.0-alpha.0 → 0.43.0-alpha.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.
Files changed (33) hide show
  1. package/README.md +333 -94
  2. package/dist/commands/cicd/repository/create.d.ts +25 -0
  3. package/dist/commands/cicd/repository/create.js +45 -0
  4. package/dist/commands/cicd/repository/create.js.map +1 -0
  5. package/dist/commands/cicd/repository/delete.d.ts +11 -0
  6. package/dist/commands/cicd/repository/delete.js +29 -0
  7. package/dist/commands/cicd/repository/delete.js.map +1 -0
  8. package/dist/commands/cicd/repository/get.d.ts +10 -0
  9. package/dist/commands/cicd/repository/get.js +30 -0
  10. package/dist/commands/cicd/repository/get.js.map +1 -0
  11. package/dist/commands/cicd/repository/list.d.ts +8 -0
  12. package/dist/commands/cicd/repository/list.js +26 -0
  13. package/dist/commands/cicd/repository/list.js.map +1 -0
  14. package/dist/commands/cicd/repository/reset.d.ts +12 -0
  15. package/dist/commands/cicd/repository/reset.js +29 -0
  16. package/dist/commands/cicd/repository/reset.js.map +1 -0
  17. package/dist/commands/cicd/repository/update.d.ts +34 -0
  18. package/dist/commands/cicd/repository/update.js +64 -0
  19. package/dist/commands/cicd/repository/update.js.map +1 -0
  20. package/dist/commands/cicd/repository/validate.d.ts +10 -0
  21. package/dist/commands/cicd/repository/validate.js +33 -0
  22. package/dist/commands/cicd/repository/validate.js.map +1 -0
  23. package/dist/lib/mcp/tools.d.ts +61 -0
  24. package/dist/lib/mcp/tools.js +166 -0
  25. package/dist/lib/mcp/tools.js.map +1 -1
  26. package/dist/lib/repository-flags.d.ts +117 -0
  27. package/dist/lib/repository-flags.js +208 -0
  28. package/dist/lib/repository-flags.js.map +1 -0
  29. package/dist/lib/repository-types.d.ts +94 -0
  30. package/dist/lib/repository-types.js +110 -0
  31. package/dist/lib/repository-types.js.map +1 -0
  32. package/oclif.manifest.json +623 -85
  33. package/package.json +4 -1
@@ -0,0 +1,25 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type GitRepository } from '../../../lib/repository-types.js';
3
+ export default class RepositoryCreate extends AgentiaCommand {
4
+ static args: {
5
+ name: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ readonly provider: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ readonly 'source-format': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ readonly 'auth-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ readonly 'branch-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ readonly 'commit-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ readonly 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ readonly password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ readonly 'pull-request-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ readonly 'tag-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ readonly uri: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ readonly username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ readonly 'allow-functions-git-cache': import("@oclif/core/interfaces").BooleanFlag<boolean>;
22
+ readonly 'copado-tunnel-enabled': import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
+ };
24
+ run(): Promise<GitRepository>;
25
+ }
@@ -0,0 +1,45 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { buildRepositoryCreatePayload, REPOSITORY_STRING_VALIDATION_KEYS, repositoryCreateFlags, validateNonEmptyStringFields, validateRepositoryMutationFlags, } from '../../../lib/repository-flags.js';
5
+ import { normalizeRepository, repositoriesEndpoint, } from '../../../lib/repository-types.js';
6
+ export default class RepositoryCreate extends AgentiaCommand {
7
+ static args = {
8
+ name: Args.string({
9
+ description: 'Name of the Copado Git repository to create',
10
+ required: true,
11
+ }),
12
+ };
13
+ static description = 'Create a Copado Git repository';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %> my-repo --source-format DX --provider Github --uri https://github.com/org/repo.git',
16
+ '<%= config.bin %> <%= command.id %> my-repo --source-format DX --provider Gitlab --json',
17
+ ];
18
+ static flags = repositoryCreateFlags;
19
+ async run() {
20
+ const { args, flags } = await this.parse(RepositoryCreate);
21
+ const flagError = validateRepositoryMutationFlags(flags);
22
+ if (flagError !== undefined) {
23
+ this.error(flagError, { exit: 2 });
24
+ }
25
+ const payload = buildRepositoryCreatePayload(args.name, flags);
26
+ const validationError = validateNonEmptyStringFields(payload, REPOSITORY_STRING_VALIDATION_KEYS);
27
+ if (validationError !== undefined) {
28
+ this.error(validationError, { exit: 2 });
29
+ }
30
+ const response = await this.withSpinner('Creating repository', () => CicdGateway.call({
31
+ body: payload,
32
+ endpoint: repositoriesEndpoint(),
33
+ headers: {
34
+ 'Content-Type': 'application/json',
35
+ },
36
+ method: 'POST',
37
+ }));
38
+ const repository = normalizeRepository(response);
39
+ this.display(() => {
40
+ this.log(`Created repository ${repository.name ?? args.name} (ID: ${repository.id ?? 'unknown id'}).`);
41
+ });
42
+ return repository;
43
+ }
44
+ }
45
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/create.ts"],"names":[],"mappings":"AAAA,OAAO,E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AE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QACxC,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAClE,WAAW,CAAC,IAAI,CAAqC;YACnD,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,oBAAoB,EAAE;YAChC,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;aACnC;YACD,MAAM,EAAE,MAAM;SACf,CAAC,CACH,CAAA;QACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAEhD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,sBAAsB,UAAU,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,SAAS,UAAU,CAAC,EAAE,IAAI,YAAY,IAAI,CAAC,CAAA;QACxG,CAAC,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACnB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ export default class RepositoryDelete extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ id: string;
10
+ }>;
11
+ }
@@ -0,0 +1,29 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { repositoryEndpoint } from '../../../lib/repository-types.js';
5
+ export default class RepositoryDelete extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Copado Git repository ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Delete a Copado Git repository by ID';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> repo-001',
15
+ '<%= config.bin %> <%= command.id %> repo-001 --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(RepositoryDelete);
19
+ await this.withSpinner('Deleting repository', () => CicdGateway.call({
20
+ endpoint: repositoryEndpoint(args.id),
21
+ method: 'DELETE',
22
+ }));
23
+ this.display(() => {
24
+ this.log(`Deleted repository (ID: ${args.id}).`);
25
+ });
26
+ return { id: args.id };
27
+ }
28
+ }
29
+ //# sourceMappingURL=delete.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delete.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/delete.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,kBAAkB,EAAC,MAAM,kCAAkC,CAAA;AAEnE,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,cAAc;IAC1D,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,sCAAsC,CAAA;IACpE,MAAM,CAAU,QAAQ,GAAG;QACzB,8CAA8C;QAC9C,qDAAqD;KACtD,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAA;QAEjD,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,GAAG,EAAE,CACjD,WAAW,CAAC,IAAI,CAAO;YACrB,QAAQ,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,EAAE,QAAQ;SACjB,CAAC,CACH,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,2BAA2B,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAC,CAAA;IACtB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type GitRepository } from '../../../lib/repository-types.js';
3
+ export default class RepositoryGet extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<GitRepository>;
10
+ }
@@ -0,0 +1,30 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { formatRepositoryDetail, normalizeRepository, repositoryEndpoint, } from '../../../lib/repository-types.js';
5
+ export default class RepositoryGet extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Copado Git repository ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Get a Copado Git repository by ID';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> repo-001',
15
+ '<%= config.bin %> <%= command.id %> repo-001 --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(RepositoryGet);
19
+ const response = await this.withSpinner('Fetching repository', () => CicdGateway.call({
20
+ endpoint: repositoryEndpoint(args.id),
21
+ method: 'GET',
22
+ }));
23
+ const repository = normalizeRepository(response);
24
+ this.display(() => {
25
+ this.log(formatRepositoryDetail(repository));
26
+ });
27
+ return repository;
28
+ }
29
+ }
30
+ //# sourceMappingURL=get.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/get.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,sBAAsB,EAEtB,mBAAmB,EACnB,kBAAkB,GAEnB,MAAM,kCAAkC,CAAA;AAEzC,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,cAAc;IACvD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,mCAAmC,CAAA;IACjE,MAAM,CAAU,QAAQ,GAAG;QACzB,8CAA8C;QAC9C,qDAAqD;KACtD,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;QAE9C,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,qBAAqB,EAAE,GAAG,EAAE,CAClE,WAAW,CAAC,IAAI,CAAqC;YACnD,QAAQ,EAAE,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC;YACrC,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CAAA;QACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAEhD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,sBAAsB,CAAC,UAAU,CAAC,CAAC,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACnB,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type PaginatedListResult } from '../../../lib/list-pagination.js';
3
+ import { type GitRepository } from '../../../lib/repository-types.js';
4
+ export default class RepositoryList extends AgentiaCommand {
5
+ static description: string;
6
+ static examples: string[];
7
+ run(): Promise<PaginatedListResult<GitRepository>>;
8
+ }
@@ -0,0 +1,26 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
3
+ import { displayListPagination } from '../../../lib/list-pagination.js';
4
+ import { formatRepositoryTable, normalizeRepositoriesListPage, repositoriesEndpoint, } from '../../../lib/repository-types.js';
5
+ export default class RepositoryList extends AgentiaCommand {
6
+ static description = 'List Copado Git repositories';
7
+ static examples = ['<%= config.bin %> <%= command.id %>', '<%= config.bin %> <%= command.id %> --json'];
8
+ async run() {
9
+ await this.parse(RepositoryList);
10
+ const response = await this.withSpinner('Fetching repositories', () => CicdGateway.call({
11
+ endpoint: repositoriesEndpoint(),
12
+ method: 'GET',
13
+ }));
14
+ const page = normalizeRepositoriesListPage(response);
15
+ this.display(() => {
16
+ if (page.data.length === 0) {
17
+ this.log('No repositories found.');
18
+ return;
19
+ }
20
+ this.log(formatRepositoryTable(page.data));
21
+ displayListPagination(this.log.bind(this), page);
22
+ });
23
+ return page;
24
+ }
25
+ }
26
+ //# sourceMappingURL=list.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"list.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/list.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,qBAAqB,EAA2B,MAAM,iCAAiC,CAAA;AAC/F,OAAO,EACL,qBAAqB,EAErB,6BAA6B,EAC7B,oBAAoB,GAErB,MAAM,kCAAkC,CAAA;AAEzC,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,cAAc;IACxD,MAAM,CAAU,WAAW,GAAG,8BAA8B,CAAA;IAC5D,MAAM,CAAU,QAAQ,GAAG,CAAC,qCAAqC,EAAE,4CAA4C,CAAC,CAAA;IAEzG,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QAEhC,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,GAAG,EAAE,CACpE,WAAW,CAAC,IAAI,CAA2B;YACzC,QAAQ,EAAE,oBAAoB,EAAE;YAChC,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CAAA;QACD,MAAM,IAAI,GAAG,6BAA6B,CAAC,QAAQ,CAAC,CAAA;QAEpD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3B,IAAI,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;gBAClC,OAAM;YACR,CAAC;YAED,IAAI,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;YAC1C,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QAClD,CAAC,CAAC,CAAA;QAEF,OAAO,IAAI,CAAA;IACb,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ export default class RepositoryReset extends AgentiaCommand {
3
+ static args: {
4
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ run(): Promise<{
9
+ id: string;
10
+ reset: true;
11
+ }>;
12
+ }
@@ -0,0 +1,29 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { repositoryResetEndpoint } from '../../../lib/repository-types.js';
5
+ export default class RepositoryReset extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Copado Git repository ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Reset a Copado Git repository';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> repo-001',
15
+ '<%= config.bin %> <%= command.id %> repo-001 --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(RepositoryReset);
19
+ await this.withSpinner('Resetting repository', () => CicdGateway.call({
20
+ endpoint: repositoryResetEndpoint(args.id),
21
+ method: 'PUT',
22
+ }));
23
+ this.display(() => {
24
+ this.log(`Reset repository (ID: ${args.id}).`);
25
+ });
26
+ return { id: args.id, reset: true };
27
+ }
28
+ }
29
+ //# sourceMappingURL=reset.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reset.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/reset.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EAAC,uBAAuB,EAAC,MAAM,kCAAkC,CAAA;AAExE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,cAAc;IACzD,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,+BAA+B,CAAA;IAC7D,MAAM,CAAU,QAAQ,GAAG;QACzB,8CAA8C;QAC9C,qDAAqD;KACtD,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAA;QAEhD,MAAM,IAAI,CAAC,WAAW,CAAC,sBAAsB,EAAE,GAAG,EAAE,CAClD,WAAW,CAAC,IAAI,CAAO;YACrB,QAAQ,EAAE,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC;YAC1C,MAAM,EAAE,KAAK;SACd,CAAC,CACH,CAAA;QAED,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,yBAAyB,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QAChD,CAAC,CAAC,CAAA;QAEF,OAAO,EAAC,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAC,CAAA;IACnC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type GitRepository } from '../../../lib/repository-types.js';
3
+ export default class RepositoryUpdate extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ static flags: {
10
+ readonly name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
11
+ readonly provider: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ readonly 'source-format': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ readonly 'auth-type': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
14
+ readonly 'branch-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ readonly 'commit-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
16
+ readonly 'extra-headers': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
17
+ readonly password: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
18
+ readonly 'pull-request-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
19
+ readonly 'tag-base-url': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
20
+ readonly uri: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
21
+ readonly username: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
22
+ readonly 'clear-branch-base-url': import("@oclif/core/interfaces").BooleanFlag<boolean>;
23
+ readonly 'clear-commit-base-url': import("@oclif/core/interfaces").BooleanFlag<boolean>;
24
+ readonly 'clear-extra-headers': import("@oclif/core/interfaces").BooleanFlag<boolean>;
25
+ readonly 'clear-password': import("@oclif/core/interfaces").BooleanFlag<boolean>;
26
+ readonly 'clear-pull-request-base-url': import("@oclif/core/interfaces").BooleanFlag<boolean>;
27
+ readonly 'clear-tag-base-url': import("@oclif/core/interfaces").BooleanFlag<boolean>;
28
+ readonly 'clear-uri': import("@oclif/core/interfaces").BooleanFlag<boolean>;
29
+ readonly 'clear-username': import("@oclif/core/interfaces").BooleanFlag<boolean>;
30
+ readonly 'allow-functions-git-cache': import("@oclif/core/interfaces").BooleanFlag<boolean>;
31
+ readonly 'copado-tunnel-enabled': import("@oclif/core/interfaces").BooleanFlag<boolean>;
32
+ };
33
+ run(): Promise<GitRepository>;
34
+ }
@@ -0,0 +1,64 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { buildRepositoryMutationPayload, collectRepositoryMutationFlagKeys, REPOSITORY_STRING_VALIDATION_KEYS, repositoryUpdateFlags, validateNonEmptyStringFields, validateRepositoryMutationFlags, } from '../../../lib/repository-flags.js';
5
+ import { normalizeRepository, repositoryEndpoint, withRequiredRepositoryFields, } from '../../../lib/repository-types.js';
6
+ export default class RepositoryUpdate extends AgentiaCommand {
7
+ static args = {
8
+ id: Args.string({
9
+ description: 'Copado Git repository ID',
10
+ required: true,
11
+ }),
12
+ };
13
+ static description = 'Update a Copado Git repository by ID';
14
+ static examples = [
15
+ '<%= config.bin %> <%= command.id %> repo-001 --uri https://github.com/org/repo.git',
16
+ '<%= config.bin %> <%= command.id %> repo-001 --clear-password',
17
+ '<%= config.bin %> <%= command.id %> repo-001 --provider Gitlab --json',
18
+ ];
19
+ static flags = repositoryUpdateFlags;
20
+ async run() {
21
+ const { args, flags } = await this.parse(RepositoryUpdate);
22
+ const selectedKeys = collectRepositoryMutationFlagKeys(flags);
23
+ if (selectedKeys.length === 0) {
24
+ this.error('Must provide at least one flag to update.', {
25
+ exit: 2,
26
+ suggestions: [
27
+ `${this.config.bin} cicd repository update ${args.id} --uri <uri>`,
28
+ `${this.config.bin} cicd repository update ${args.id} --clear-password`,
29
+ ],
30
+ });
31
+ }
32
+ const flagError = validateRepositoryMutationFlags(flags);
33
+ if (flagError !== undefined) {
34
+ this.error(flagError, { exit: 2 });
35
+ }
36
+ const currentRepository = await this.withSpinner('Fetching repository', () => CicdGateway.call({
37
+ endpoint: repositoryEndpoint(args.id),
38
+ method: 'GET',
39
+ }));
40
+ const current = normalizeRepository(currentRepository);
41
+ const payload = withRequiredRepositoryFields(buildRepositoryMutationPayload(flags), current);
42
+ const validationError = validateNonEmptyStringFields(payload, REPOSITORY_STRING_VALIDATION_KEYS);
43
+ if (payload.name === undefined ||
44
+ payload.sourceFormat === undefined ||
45
+ payload.provider === undefined ||
46
+ validationError !== undefined) {
47
+ this.error('Repository name, source format, and provider are required to update a repository.', { exit: 2 });
48
+ }
49
+ const response = await this.withSpinner('Updating repository', () => CicdGateway.call({
50
+ body: payload,
51
+ endpoint: repositoryEndpoint(args.id),
52
+ headers: {
53
+ 'Content-Type': 'application/json',
54
+ },
55
+ method: 'PATCH',
56
+ }));
57
+ const repository = normalizeRepository(response);
58
+ this.display(() => {
59
+ this.log(`Updated repository ${repository.name ?? payload.name} (ID: ${repository.id ?? args.id}).`);
60
+ });
61
+ return repository;
62
+ }
63
+ }
64
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.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AC,CACH,CAAA;QACD,MAAM,UAAU,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAA;QAEhD,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,sBAAsB,UAAU,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,SAAS,UAAU,CAAC,EAAE,IAAI,IAAI,CAAC,EAAE,IAAI,CAAC,CAAA;QACtG,CAAC,CAAC,CAAA;QAEF,OAAO,UAAU,CAAA;IACnB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type RepositoryValidateResult } from '../../../lib/repository-types.js';
3
+ export default class RepositoryValidate extends AgentiaCommand {
4
+ static args: {
5
+ id: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
6
+ };
7
+ static description: string;
8
+ static examples: string[];
9
+ run(): Promise<RepositoryValidateResult>;
10
+ }
@@ -0,0 +1,33 @@
1
+ import { Args } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { CicdGateway } from '../../../lib/cicd-gateway.js';
4
+ import { normalizeRepositoryValidateResult, repositoryValidateEndpoint, } from '../../../lib/repository-types.js';
5
+ export default class RepositoryValidate extends AgentiaCommand {
6
+ static args = {
7
+ id: Args.string({
8
+ description: 'Copado Git repository ID',
9
+ required: true,
10
+ }),
11
+ };
12
+ static description = 'Validate Copado Git repository authentication';
13
+ static examples = [
14
+ '<%= config.bin %> <%= command.id %> repo-001',
15
+ '<%= config.bin %> <%= command.id %> repo-001 --json',
16
+ ];
17
+ async run() {
18
+ const { args } = await this.parse(RepositoryValidate);
19
+ const response = await this.withSpinner('Validating repository', () => CicdGateway.call({
20
+ endpoint: repositoryValidateEndpoint(args.id),
21
+ method: 'POST',
22
+ }));
23
+ const result = normalizeRepositoryValidateResult(response);
24
+ this.display(() => {
25
+ this.log(`Repository validation ${result.validated ? 'succeeded' : 'failed'}.`);
26
+ if (result.message !== null && result.message !== undefined && result.message.trim().length > 0) {
27
+ this.log(result.message);
28
+ }
29
+ });
30
+ return result;
31
+ }
32
+ }
33
+ //# sourceMappingURL=validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../../src/commands/cicd/repository/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,WAAW,EAAC,MAAM,8BAA8B,CAAA;AACxD,OAAO,EACL,iCAAiC,EACjC,0BAA0B,GAG3B,MAAM,kCAAkC,CAAA;AAEzC,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,cAAc;IAC5D,MAAM,CAAU,IAAI,GAAG;QACrB,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,WAAW,EAAE,0BAA0B;YACvC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAA;IACD,MAAM,CAAU,WAAW,GAAG,+CAA+C,CAAA;IAC7E,MAAM,CAAU,QAAQ,GAAG;QACzB,8CAA8C;QAC9C,qDAAqD;KACtD,CAAA;IAEM,KAAK,CAAC,GAAG;QACd,MAAM,EAAC,IAAI,EAAC,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,kBAAkB,CAAC,CAAA;QAEnD,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,GAAG,EAAE,CACpE,WAAW,CAAC,IAAI,CAA6B;YAC3C,QAAQ,EAAE,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC;YAC7C,MAAM,EAAE,MAAM;SACf,CAAC,CACH,CAAA;QACD,MAAM,MAAM,GAAG,iCAAiC,CAAC,QAAQ,CAAC,CAAA;QAE1D,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,yBAAyB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,QAAQ,GAAG,CAAC,CAAA;YAC/E,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,IAAI,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAChG,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;YAC1B,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -11,6 +11,7 @@ import { type ProjectDefaultScope } from '../project-defaults.js';
11
11
  import { type Project, type ProjectListFilters } from '../project-types.js';
12
12
  import { type PromotionConflict, type PromotionConflictMode, type PromotionConflictResolutionResult, type PromotionConflictUndoResult } from '../promotion-conflicts.js';
13
13
  import { type PromotionDetail, type PromotionListFilters } from '../promotion-types.js';
14
+ import { type GitRepository, type RepositoryValidateResult } from '../repository-types.js';
14
15
  import { type User } from '../user-types.js';
15
16
  import { type HeadlessWorkStatusResult } from '../work-types.js';
16
17
  type EnvironmentCreateArgs = {
@@ -72,6 +73,31 @@ type ProjectDefaultSetArgs = {
72
73
  team?: string;
73
74
  };
74
75
  type ProjectDefaultUnsetArgs = ProjectDefaultGetArgs;
76
+ type RepositoryMutationArgs = {
77
+ allowFunctionsGitCache?: boolean;
78
+ authType?: null | string;
79
+ branchBaseUrl?: null | string;
80
+ commitBaseUrl?: null | string;
81
+ extraHeaders?: null | string;
82
+ id?: string;
83
+ isCopadoTunnelEnabled?: boolean;
84
+ name?: string;
85
+ password?: null | string;
86
+ provider?: string;
87
+ pullRequestBaseUrl?: null | string;
88
+ sourceFormat?: string;
89
+ tagBaseUrl?: null | string;
90
+ uri?: null | string;
91
+ username?: null | string;
92
+ };
93
+ type RepositoryCreateArgs = RepositoryMutationArgs & {
94
+ name: string;
95
+ provider: string;
96
+ sourceFormat: string;
97
+ };
98
+ type RepositoryUpdateArgs = RepositoryMutationArgs & {
99
+ id: string;
100
+ };
75
101
  type MetadataListArgs = {
76
102
  avoidSourceTracking?: boolean;
77
103
  filterType?: string;
@@ -181,6 +207,34 @@ declare function pipelineConnectionList(args: {
181
207
  connections: PipelineConnection[];
182
208
  }>;
183
209
  declare function projectList(args?: ProjectListFilters): Promise<Record<string, unknown>>;
210
+ declare function repositoryList(): Promise<Record<string, unknown>>;
211
+ declare function repositoryGet(args: {
212
+ id: string;
213
+ }): Promise<{
214
+ repository: GitRepository;
215
+ }>;
216
+ declare function repositoryCreate(args: RepositoryCreateArgs): Promise<{
217
+ repository: GitRepository;
218
+ }>;
219
+ declare function repositoryUpdate(args: RepositoryUpdateArgs): Promise<{
220
+ repository: GitRepository;
221
+ }>;
222
+ declare function repositoryDelete(args: {
223
+ id: string;
224
+ }): Promise<{
225
+ id: string;
226
+ }>;
227
+ declare function repositoryReset(args: {
228
+ id: string;
229
+ }): Promise<{
230
+ id: string;
231
+ reset: boolean;
232
+ }>;
233
+ declare function repositoryValidate(args: {
234
+ id: string;
235
+ }): Promise<{
236
+ validation: RepositoryValidateResult;
237
+ }>;
184
238
  declare function userGet(args?: {
185
239
  id?: string;
186
240
  }): Promise<{
@@ -902,6 +956,13 @@ export declare const agentiaMcpToolHandlers: {
902
956
  promotionConflictUnresolve: typeof promotionConflictUnresolve;
903
957
  promotionGet: typeof promotionGet;
904
958
  promotionList: typeof promotionList;
959
+ repositoryCreate: typeof repositoryCreate;
960
+ repositoryDelete: typeof repositoryDelete;
961
+ repositoryGet: typeof repositoryGet;
962
+ repositoryList: typeof repositoryList;
963
+ repositoryReset: typeof repositoryReset;
964
+ repositoryUpdate: typeof repositoryUpdate;
965
+ repositoryValidate: typeof repositoryValidate;
905
966
  userGet: typeof userGet;
906
967
  workStatus: typeof workStatus;
907
968
  };