@copado/agentia-cli 1.0.0-beta.7 → 1.0.0-beta.9

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 (34) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +455 -307
  3. package/dist/commands/adv/auth/status.js +1 -0
  4. package/dist/commands/adv/component/add.js +3 -0
  5. package/dist/commands/adv/component/remove.js +3 -0
  6. package/dist/commands/adv/component/types.js +1 -0
  7. package/dist/commands/adv/job/wait.js +1 -1
  8. package/dist/commands/adv/organization/list.js +1 -0
  9. package/dist/commands/cicd/template/defaults.js +42 -0
  10. package/dist/commands/cicd/template/delete.js +36 -0
  11. package/dist/commands/cicd/template/get.js +48 -0
  12. package/dist/commands/cicd/template/list.js +53 -0
  13. package/dist/commands/cicd/template/upsert.js +45 -0
  14. package/dist/commands/plugins/install.js +76 -0
  15. package/dist/lib/adv-operations.js +3 -1
  16. package/dist/lib/agentia-command.js +35 -0
  17. package/dist/lib/mcp/adv-tools.js +40 -26
  18. package/dist/lib/mcp/tool-annotations.js +5 -0
  19. package/dist/lib/mcp/tools.js +118 -0
  20. package/dist/lib/plugin-trust/catalog.js +6 -0
  21. package/dist/lib/plugin-trust/gate.js +14 -0
  22. package/dist/lib/plugin-trust/http.js +5 -0
  23. package/dist/lib/plugin-trust/policy.js +3 -0
  24. package/dist/lib/runtime.js +1 -1
  25. package/dist/lib/template-flags.js +8 -0
  26. package/dist/lib/template-types.js +21 -0
  27. package/oclif.manifest.json +773 -377
  28. package/package.json +1 -1
  29. package/templates/AGENTS.md +1 -1
  30. package/templates/skills/agentia-adv/SKILL.md +7 -1
  31. package/templates/skills/agentia-adv/references/pipelines-advanced.md +7 -7
  32. package/templates/skills/agentia-cicd/SKILL.md +5 -1
  33. package/templates/skills/agentia-cicd/references/functions.md +148 -0
  34. package/templates/skills/agentia-cicd/references/templates.md +132 -0
@@ -46,6 +46,8 @@ import { normalizeRepositoriesListPage, normalizeRepository, normalizeRepository
46
46
  import { buildStageMutationPayload, validateStagePayload } from '../stage-flags.js';
47
47
  import { fetchStages } from '../stage-list.js';
48
48
  import { normalizePipelineStageConnection, normalizeStage, pipelineStageConnectionEndpoint, pipelineStageConnectionsEndpoint, STAGE_META_STAGE_SUGGESTIONS, stageEndpoint, stagesEndpoint, } from '../stage-types.js';
49
+ import { buildTemplateDefaultsQuery } from '../template-flags.js';
50
+ import { normalizeTemplate, normalizeTemplatesListPage, normalizeTemplateUpsertPayload, TEMPLATE_LIST_TYPES, templateDefaultsEndpoint, templateEndpoint, templatesEndpoint, } from '../template-types.js';
49
51
  import { getUserContext } from '../user-context.js';
50
52
  import { fetchUser } from '../user-get.js';
51
53
  import { DEFAULT_USER_ID } from '../user-types.js';
@@ -637,6 +639,52 @@ async function functionDelete(args) {
637
639
  });
638
640
  return { apiName };
639
641
  }
642
+ async function templateList(args = {}) {
643
+ const response = await CicdGateway.call({
644
+ endpoint: templatesEndpoint({ ...args, type: args.type ?? 'custom' }),
645
+ method: 'GET',
646
+ });
647
+ return mcpPaginatedListPayload('templates', normalizeTemplatesListPage(response));
648
+ }
649
+ async function templateGet(args) {
650
+ const response = await CicdGateway.call({
651
+ endpoint: templateEndpoint(assertRequired(args.apiName, 'apiName')),
652
+ method: 'GET',
653
+ });
654
+ return { template: normalizeTemplate(response) };
655
+ }
656
+ async function templateDefaults(args) {
657
+ const query = buildTemplateDefaultsQuery({
658
+ name: assertRequired(args.name, 'name'),
659
+ ...(args.apiName === undefined ? {} : { 'api-name': args.apiName }),
660
+ });
661
+ const response = await CicdGateway.call({
662
+ endpoint: templateDefaultsEndpoint(query),
663
+ method: 'GET',
664
+ });
665
+ return { template: normalizeTemplate(response) };
666
+ }
667
+ async function templateUpsert(args) {
668
+ const apiName = assertRequired(args.apiName, 'apiName');
669
+ const payload = normalizeTemplateUpsertPayload(apiName, args);
670
+ const response = await CicdGateway.call({
671
+ body: payload,
672
+ endpoint: templateEndpoint(apiName),
673
+ headers: {
674
+ 'Content-Type': 'application/json',
675
+ },
676
+ method: 'PUT',
677
+ });
678
+ return { template: normalizeTemplate(response) };
679
+ }
680
+ async function templateDelete(args) {
681
+ const apiName = assertRequired(args.apiName, 'apiName');
682
+ await CicdGateway.call({
683
+ endpoint: templateEndpoint(apiName),
684
+ method: 'DELETE',
685
+ });
686
+ return { apiName };
687
+ }
640
688
  async function functionRun(args) {
641
689
  const apiName = assertRequired(args.apiName, 'apiName');
642
690
  const response = await CicdGateway.call({
@@ -1280,6 +1328,11 @@ export const agentiaMcpToolHandlers = wrapMcpToolHandlers({
1280
1328
  stageGet,
1281
1329
  stageList,
1282
1330
  stageUpdate,
1331
+ templateDefaults,
1332
+ templateDelete,
1333
+ templateGet,
1334
+ templateList,
1335
+ templateUpsert,
1283
1336
  userGet,
1284
1337
  workStatus,
1285
1338
  ...agentiaMcpTestingToolHandlers,
@@ -2117,6 +2170,71 @@ export function registerAgentiaMcpTools(server) {
2117
2170
  },
2118
2171
  title: 'Agentia Function Result Log Get',
2119
2172
  }, (args) => safelyHandleTool(() => functionResultLogGet(args)));
2173
+ server.registerTool('agentia_template_list', {
2174
+ description: 'List Copado Job Templates via the CICD gateway.',
2175
+ inputSchema: {
2176
+ fetchAll: z.boolean().optional().describe('Fetch all matching templates.'),
2177
+ name: z.string().optional().describe('Filter by name substring.'),
2178
+ type: z.enum(TEMPLATE_LIST_TYPES).optional().describe('List Custom templates only, or all templates.'),
2179
+ ...listPaginationZodFields,
2180
+ },
2181
+ title: 'Agentia Template List',
2182
+ }, (args) => safelyHandleTool(() => templateList(args)));
2183
+ server.registerTool('agentia_template_get', {
2184
+ description: 'Get a Copado Job Template by API name via the CICD gateway.',
2185
+ inputSchema: { apiName: z.string().describe('Template API name.') },
2186
+ title: 'Agentia Template Get',
2187
+ }, (args) => safelyHandleTool(() => templateGet(args)));
2188
+ server.registerTool('agentia_template_defaults', {
2189
+ description: 'Scaffold default Copado Job Template metadata without writing to Salesforce.',
2190
+ inputSchema: {
2191
+ apiName: z.string().optional().describe('Optional template API name for the scaffold.'),
2192
+ name: z.string().describe('Template display name.'),
2193
+ },
2194
+ title: 'Agentia Template Defaults',
2195
+ }, (args) => safelyHandleTool(() => templateDefaults(args)));
2196
+ server.registerTool('agentia_template_upsert', {
2197
+ description: 'Create or update a Copado Job Template by API name via the CICD gateway.',
2198
+ inputSchema: {
2199
+ apiName: z.string().describe('Template API name.'),
2200
+ description: z.string().nullable().optional().describe('Template description.'),
2201
+ name: z.string().optional().describe('Template display name.'),
2202
+ steps: z
2203
+ .array(z.object({
2204
+ apiName: z.string().describe('Step API name.'),
2205
+ config: z.unknown().nullable().optional().describe('Step config JSON.'),
2206
+ customType: z.string().nullable().optional().describe('Step custom type.'),
2207
+ name: z.string().describe('Step display name.'),
2208
+ order: z.number().nullable().optional().describe('Step order (server may reassign).'),
2209
+ type: z.string().describe('Step type.'),
2210
+ }))
2211
+ .describe('Full step list (replace semantics; use [] to clear all steps).'),
2212
+ type: z.string().optional().describe('Template type.'),
2213
+ version: z.string().optional().describe('Template version.'),
2214
+ volumeOptions: z.unknown().nullable().optional().describe('Volume options JSON or string.'),
2215
+ },
2216
+ title: 'Agentia Template Upsert',
2217
+ }, (args) => safelyHandleTool(() => templateUpsert({
2218
+ apiName: args.apiName,
2219
+ description: args.description,
2220
+ name: args.name,
2221
+ steps: args.steps.map((step) => ({
2222
+ apiName: step.apiName,
2223
+ customType: step.customType,
2224
+ name: step.name,
2225
+ order: step.order,
2226
+ type: step.type,
2227
+ ...(step.config === undefined ? {} : { config: step.config }),
2228
+ })),
2229
+ type: args.type,
2230
+ version: args.version,
2231
+ volumeOptions: args.volumeOptions,
2232
+ })));
2233
+ server.registerTool('agentia_template_delete', {
2234
+ description: 'Delete a Copado Job Template by API name via the CICD gateway.',
2235
+ inputSchema: { apiName: z.string().describe('Template API name.') },
2236
+ title: 'Agentia Template Delete',
2237
+ }, (args) => safelyHandleTool(() => templateDelete(args)));
2120
2238
  server.registerTool('agentia_promotion_conflict_list', {
2121
2239
  description: 'List merge conflicts for a Copado promotion.',
2122
2240
  inputSchema: { promotionId: z.string().describe('Copado promotion ID.') },
@@ -0,0 +1,6 @@
1
+ import {modules} from '../runtime.js';
2
+ const DEFAULT_CATALOG_URL = modules["plugin-trust/catalog.js"]["DEFAULT_CATALOG_URL"]
3
+ const cleanText = modules["plugin-trust/catalog.js"]["cleanText"]
4
+ const loadCatalog = modules["plugin-trust/catalog.js"]["loadCatalog"]
5
+ const parseCatalog = modules["plugin-trust/catalog.js"]["parseCatalog"]
6
+ export {DEFAULT_CATALOG_URL, cleanText, loadCatalog, parseCatalog};
@@ -0,0 +1,14 @@
1
+ import {modules} from '../runtime.js';
2
+ const PluginTrustError = modules["plugin-trust/gate.js"]["PluginTrustError"]
3
+ const assessInstalls = modules["plugin-trust/gate.js"]["assessInstalls"]
4
+ const confirmationWarning = modules["plugin-trust/gate.js"]["confirmationWarning"]
5
+ const deprecationWarning = modules["plugin-trust/gate.js"]["deprecationWarning"]
6
+ const enforceInstalls = modules["plugin-trust/gate.js"]["enforceInstalls"]
7
+ const installPrompt = modules["plugin-trust/gate.js"]["installPrompt"]
8
+ const parseInstallArguments = modules["plugin-trust/gate.js"]["parseInstallArguments"]
9
+ const parseInstallTarget = modules["plugin-trust/gate.js"]["parseInstallTarget"]
10
+ const pluginSpec = modules["plugin-trust/gate.js"]["pluginSpec"]
11
+ const resolveNpmVersion = modules["plugin-trust/gate.js"]["resolveNpmVersion"]
12
+ const stockInstallArguments = modules["plugin-trust/gate.js"]["stockInstallArguments"]
13
+ const uncheckedWarning = modules["plugin-trust/gate.js"]["uncheckedWarning"]
14
+ export {PluginTrustError, assessInstalls, confirmationWarning, deprecationWarning, enforceInstalls, installPrompt, parseInstallArguments, parseInstallTarget, pluginSpec, resolveNpmVersion, stockInstallArguments, uncheckedWarning};
@@ -0,0 +1,5 @@
1
+ import {modules} from '../runtime.js';
2
+ const defaultFetchJson = modules["plugin-trust/http.js"]["defaultFetchJson"]
3
+ const fetchJson = modules["plugin-trust/http.js"]["fetchJson"]
4
+ const setFetchJsonForTests = modules["plugin-trust/http.js"]["setFetchJsonForTests"]
5
+ export {defaultFetchJson, fetchJson, setFetchJsonForTests};
@@ -0,0 +1,3 @@
1
+ import {modules} from '../runtime.js';
2
+ const decideInstall = modules["plugin-trust/policy.js"]["decideInstall"]
3
+ export {decideInstall};