@copado/agentia-cli 0.26.0-alpha.0 → 0.28.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 (37) hide show
  1. package/README.md +98 -60
  2. package/dist/commands/project/default/get.d.ts +1 -0
  3. package/dist/commands/project/default/set.d.ts +1 -0
  4. package/dist/commands/project/default/unset.d.ts +1 -0
  5. package/dist/commands/work/submit.d.ts +3 -0
  6. package/dist/commands/work/submit.js +53 -3
  7. package/dist/commands/work/submit.js.map +1 -1
  8. package/dist/commands/work/test.d.ts +10 -0
  9. package/dist/commands/work/test.js +61 -0
  10. package/dist/commands/work/test.js.map +1 -0
  11. package/dist/lib/agentia-command.d.ts +3 -0
  12. package/dist/lib/agentia-command.js +12 -1
  13. package/dist/lib/agentia-command.js.map +1 -1
  14. package/dist/lib/cicd-gateway.d.ts +3 -0
  15. package/dist/lib/cicd-gateway.js +19 -2
  16. package/dist/lib/cicd-gateway.js.map +1 -1
  17. package/dist/lib/local-quality-gates.d.ts +45 -0
  18. package/dist/lib/local-quality-gates.js +103 -0
  19. package/dist/lib/local-quality-gates.js.map +1 -0
  20. package/dist/lib/mcp/tools.d.ts +55 -50
  21. package/dist/lib/mcp/tools.js +7 -306
  22. package/dist/lib/mcp/tools.js.map +1 -1
  23. package/dist/lib/mcp/work-tools.d.ts +75 -0
  24. package/dist/lib/mcp/work-tools.js +464 -0
  25. package/dist/lib/mcp/work-tools.js.map +1 -0
  26. package/dist/lib/project-default-flags.d.ts +2 -0
  27. package/dist/lib/project-default-flags.js +6 -0
  28. package/dist/lib/project-default-flags.js.map +1 -1
  29. package/dist/lib/project-defaults.d.ts +2 -1
  30. package/dist/lib/project-defaults.js +3 -0
  31. package/dist/lib/project-defaults.js.map +1 -1
  32. package/dist/lib/work-defaults.js +1 -0
  33. package/dist/lib/work-defaults.js.map +1 -1
  34. package/dist/lib/work-types.d.ts +12 -0
  35. package/dist/lib/work-types.js.map +1 -1
  36. package/oclif.manifest.json +67 -2
  37. package/package.json +1 -1
@@ -11,7 +11,7 @@ import { type Project } from '../project-types.js';
11
11
  import { type PromotionConflict, type PromotionConflictMode, type PromotionConflictResolutionResult, type PromotionConflictUndoResult } from '../promotion-conflicts.js';
12
12
  import { type PromotionDetail, type PromotionListFilters } from '../promotion-types.js';
13
13
  import { type User } from '../user-types.js';
14
- import { type HeadlessWorkStatusResult, type UserStory, type UserStoryMutationPayload, type WorkDoneResult, type WorkListFilters, type WorkPushResult, type WorkSetResult, type WorkSubmitResult } from '../work-types.js';
14
+ import { type HeadlessWorkStatusResult } from '../work-types.js';
15
15
  type EnvironmentCreateArgs = {
16
16
  apexTestLevel?: string;
17
17
  enableRollback?: boolean;
@@ -50,6 +50,7 @@ type JobRunArgs = JobIdArgs & {
50
50
  };
51
51
  type ProjectDefaultGetArgs = {
52
52
  assignMe?: boolean;
53
+ credential?: boolean;
53
54
  environment?: boolean;
54
55
  epic?: boolean;
55
56
  feature?: boolean;
@@ -60,6 +61,7 @@ type ProjectDefaultGetArgs = {
60
61
  };
61
62
  type ProjectDefaultSetArgs = {
62
63
  assignMe?: boolean;
64
+ credential?: string;
63
65
  environment?: string;
64
66
  epic?: string;
65
67
  feature?: string;
@@ -131,21 +133,6 @@ type MetadataDependencyArgs = {
131
133
  sourceOrgId: string;
132
134
  targetOrgId?: string;
133
135
  };
134
- type WorkMutationInput = Partial<UserStoryMutationPayload>;
135
- type WorkListArgs = WorkListFilters & {
136
- assignedToMe?: boolean;
137
- ownedByMe?: boolean;
138
- };
139
- type WorkCreateArgs = WorkMutationInput;
140
- type WorkUpdateArgs = WorkMutationInput & {
141
- id?: string;
142
- };
143
- type WorkGetArgs = {
144
- id?: string;
145
- };
146
- type WorkDeleteArgs = {
147
- id: string;
148
- };
149
136
  declare function environmentList(args?: {
150
137
  limit?: number;
151
138
  name?: string;
@@ -223,14 +210,14 @@ declare function projectDefaultGet(args?: ProjectDefaultGetArgs): Promise<{
223
210
  }>;
224
211
  declare function projectDefaultSet(args: ProjectDefaultSetArgs): Promise<{
225
212
  defaults: {
226
- key: "project" | "team" | "environment" | "sprint" | "epic" | "feature" | "assignMe";
213
+ key: "project" | "team" | "environment" | "credential" | "sprint" | "epic" | "feature" | "assignMe";
227
214
  source: ProjectDefaultScope;
228
215
  value: string | boolean | undefined;
229
216
  }[];
230
217
  scope: ProjectDefaultScope;
231
218
  }>;
232
219
  declare function projectDefaultUnset(args: ProjectDefaultUnsetArgs): Promise<{
233
- removed: ("project" | "team" | "environment" | "sprint" | "epic" | "feature" | "assignMe")[];
220
+ removed: ("project" | "team" | "environment" | "credential" | "sprint" | "epic" | "feature" | "assignMe")[];
234
221
  scope: ProjectDefaultScope;
235
222
  }>;
236
223
  declare function metadataList(args: MetadataListArgs): Promise<{
@@ -253,22 +240,6 @@ declare function metadataContentCompare(args: MetadataContentCompareArgs): Promi
253
240
  declare function metadataDependencyList(args: MetadataDependencyArgs): Promise<{
254
241
  result: DependencyResult;
255
242
  }>;
256
- declare function workList(args?: WorkListArgs): Promise<{
257
- userStories: UserStory[];
258
- }>;
259
- declare function workGet(args?: WorkGetArgs): Promise<{
260
- userStory: UserStory;
261
- }>;
262
- declare function workCreate(args?: WorkCreateArgs): Promise<{
263
- userStory: UserStory;
264
- }>;
265
- declare function workUpdate(args: WorkUpdateArgs): Promise<{
266
- userStory: UserStory;
267
- }>;
268
- declare function workDelete(args: WorkDeleteArgs): Promise<{
269
- deleted: boolean;
270
- id: string;
271
- }>;
272
243
  type AuthGetArgs = {
273
244
  cicd?: boolean;
274
245
  crt?: boolean;
@@ -385,19 +356,62 @@ declare function metadataRefreshDeleted(args: {
385
356
  }): Promise<{
386
357
  result: RefreshDeletedMetadataIndexResult;
387
358
  }>;
388
- declare function workSet(args: {
389
- baseBranch?: string;
390
- id: string;
391
- }): Promise<WorkSetResult>;
392
- declare function workPush(): Promise<WorkPushResult>;
393
359
  declare function workStatus(args?: {
394
360
  id?: string;
395
361
  }): Promise<{
396
362
  result: HeadlessWorkStatusResult;
397
363
  }>;
398
- declare function workSubmit(): Promise<WorkSubmitResult>;
399
- declare function workDone(): Promise<WorkDoneResult>;
400
364
  export declare const agentiaMcpToolHandlers: {
365
+ workCreate: (args?: Partial<import("../work-types.js").UserStoryMutationPayload>) => Promise<{
366
+ userStory: import("../work-types.js").UserStory;
367
+ }>;
368
+ workDelete: (args: {
369
+ id: string;
370
+ }) => Promise<{
371
+ deleted: boolean;
372
+ id: string;
373
+ }>;
374
+ workDone: () => Promise<{
375
+ branch: string;
376
+ done: import("../work-types.js").HeadlessCommandResult;
377
+ push: import("../work-types.js").WorkPushResult | undefined;
378
+ pushed: boolean;
379
+ workItem: string;
380
+ }>;
381
+ workGet: (args?: {
382
+ id?: string;
383
+ }) => Promise<{
384
+ userStory: import("../work-types.js").UserStory;
385
+ }>;
386
+ workList: (args?: import("../work-types.js").WorkListFilters & {
387
+ assignedToMe?: boolean;
388
+ ownedByMe?: boolean;
389
+ }) => Promise<{
390
+ userStories: import("../work-types.js").UserStory[];
391
+ }>;
392
+ workPush: () => Promise<import("../work-types.js").WorkPushResult>;
393
+ workSet: (args: {
394
+ baseBranch?: string;
395
+ id: string;
396
+ }) => Promise<import("../work-types.js").WorkSetResult>;
397
+ workSubmit: (args?: {
398
+ skipLocalTests?: boolean;
399
+ }) => Promise<{
400
+ branch: string;
401
+ push: import("../work-types.js").WorkPushResult | undefined;
402
+ pushed: boolean;
403
+ qualityGates: import("../local-quality-gates.js").LocalQualityGatesRunResult;
404
+ submit: import("../work-types.js").HeadlessCommandResult;
405
+ workItem: string;
406
+ }>;
407
+ workTest: (args?: {
408
+ local?: boolean;
409
+ }) => Promise<import("../work-types.js").WorkTestResult>;
410
+ workUpdate: (args: Partial<import("../work-types.js").UserStoryMutationPayload> & {
411
+ id?: string;
412
+ }) => Promise<{
413
+ userStory: import("../work-types.js").UserStory;
414
+ }>;
401
415
  authGet: typeof authGet;
402
416
  authSet: typeof authSet;
403
417
  environmentAuthStatus: typeof environmentAuthStatus;
@@ -435,16 +449,7 @@ export declare const agentiaMcpToolHandlers: {
435
449
  promotionGet: typeof promotionGet;
436
450
  promotionList: typeof promotionList;
437
451
  userGet: typeof userGet;
438
- workCreate: typeof workCreate;
439
- workDelete: typeof workDelete;
440
- workDone: typeof workDone;
441
- workGet: typeof workGet;
442
- workList: typeof workList;
443
- workPush: typeof workPush;
444
- workSet: typeof workSet;
445
452
  workStatus: typeof workStatus;
446
- workSubmit: typeof workSubmit;
447
- workUpdate: typeof workUpdate;
448
453
  };
449
454
  export declare function registerAgentiaMcpTools(server: McpServer): void;
450
455
  export {};
@@ -9,11 +9,10 @@ import { assertRequired } from '../assert.js';
9
9
  import { CicdGateway, normalizeCicdBaseUrl } from '../cicd-gateway.js';
10
10
  import { CICD_REGIONS } from '../cicd-region.js';
11
11
  import { ALL_CREDENTIAL_TYPES, credentialLabel, getCicdBaseUrl, getCredential, maskSecret, setCicdBaseUrl, setCredential, } from '../credential-store.js';
12
- import { readDefaults, readLastBaseBranch, readLastWorkItem, resolveDefaults, unsetDefaults, writeDefaults, writeLastWorkSelection, } from '../defaults-store.js';
12
+ import { readDefaults, readLastWorkItem, resolveDefaults, unsetDefaults, writeDefaults, } from '../defaults-store.js';
13
13
  import { runEnvironmentAuthStatus } from '../environment-auth-status.js';
14
14
  import { buildCreatePayload, buildMutationPayload, ENVIRONMENT_STRING_VALIDATION_KEYS, validateNonEmptyStringFields, } from '../environment-flags.js';
15
15
  import { DEFAULT_ENVIRONMENT_PLATFORM, DEFAULT_ENVIRONMENT_TYPE, ENVIRONMENT_TYPES, environmentEndpoint, environmentsListEndpoint, } from '../environment-types.js';
16
- import { checkoutFeatureBranch, fetchOriginBranch, getCurrentBranch, hasUnpushedCommits, listPendingChanges, } from '../git-worktree.js';
17
16
  import { JOB_LIST_LIMIT_MAX, JOB_LIST_LIMIT_MIN, jobEndpoint, jobKillEndpoint, jobListEndpoint, jobPauseEndpoint, jobResultLogEndpoint, jobResumeEndpoint, jobRunEndpoint, normalizeJob, normalizeJobOperation, normalizeJobs, resolveJobStepForLog, } from '../job-types.js';
18
17
  import { normalizeLocalGatewayBaseUrl, readLocalGatewayConfig } from '../local-gateway-config.js';
19
18
  import { COMPARISON_MODES, CONTENT_SOURCES, contentResultToCompareSide, createUnifiedDiff, INDEX_SOURCES, MODULE_TYPES, ORDER_DIRECTIONS, PLATFORM_EXPERIENCES, RETRIEVE_MODES, sourceSideLabel, } from '../metadata-common.js';
@@ -26,51 +25,10 @@ import { buildPromotionConflictResolutionRequest, normalizePromotionConflicts, P
26
25
  import { normalizePromotionDetail, normalizePromotions, PROMOTION_LIST_LIMIT_MAX, PROMOTION_LIST_LIMIT_MIN, promotionEndpoint, promotionListEndpoint, } from '../promotion-types.js';
27
26
  import { getUserContext } from '../user-context.js';
28
27
  import { DEFAULT_USER_ID, resolveUserId, userEndpoint } from '../user-types.js';
29
- import { resolveWorkItemId } from '../work-active.js';
30
- import { buildWorkCreatePayload } from '../work-defaults.js';
31
- import { validateNonEmptyStringFields as validateWorkNonEmptyStringFields, WORK_STRING_VALIDATION_KEYS, } from '../work-flags.js';
32
- import { performWorkPush } from '../work-push.js';
33
- import { extractUserStoryFromFeatureBranch, featureBranchName, normalizeUserStories, workCreateEndpoint, workDoneEndpoint, workEndpoint, workListEndpoint, workSetEndpoint, workStatusEndpoint, workSubmitEndpoint, } from '../work-types.js';
28
+ import { workStatusEndpoint } from '../work-types.js';
34
29
  import { safelyHandleTool } from './result.js';
30
+ import { agentiaMcpWorkToolHandlers, registerAgentiaMcpWorkTools } from './work-tools.js';
35
31
  const MAX_LIMIT = 2000;
36
- const WORK_MUTATION_PAYLOAD_KEYS = [
37
- 'acceptanceCriteria',
38
- 'actualPoints',
39
- 'asA',
40
- 'assignee',
41
- 'cancellationReason',
42
- 'closeDate',
43
- 'epic',
44
- 'excludedFromCbm',
45
- 'feature',
46
- 'functionalRequirements',
47
- 'ownerId',
48
- 'plannedPoints',
49
- 'priority',
50
- 'project',
51
- 'recordType',
52
- 'releaseId',
53
- 'soThat',
54
- 'sourceCredential',
55
- 'sourceEnvironment',
56
- 'sprintId',
57
- 'status',
58
- 'team',
59
- 'technicalSpecifications',
60
- 'theme',
61
- 'title',
62
- 'wantTo',
63
- ];
64
- function buildWorkMutationPayloadFromArgs(args) {
65
- const payload = {};
66
- for (const key of WORK_MUTATION_PAYLOAD_KEYS) {
67
- const value = args[key];
68
- if (value !== undefined) {
69
- Object.assign(payload, { [key]: value });
70
- }
71
- }
72
- return payload;
73
- }
74
32
  async function environmentList(args = {}) {
75
33
  const filters = {};
76
34
  if (args.name !== undefined) {
@@ -499,99 +457,6 @@ async function metadataDependencyList(args) {
499
457
  });
500
458
  return { result };
501
459
  }
502
- async function workList(args = {}) {
503
- const filters = {
504
- assigneeId: args.assigneeId,
505
- assigneeName: args.assigneeName,
506
- name: args.name,
507
- ownerId: args.ownerId,
508
- ownerName: args.ownerName,
509
- projectId: args.projectId,
510
- projectName: args.projectName,
511
- status: args.status,
512
- title: args.title,
513
- };
514
- const assignedToMe = args.assignedToMe === true;
515
- const ownedByMe = args.ownedByMe === true;
516
- if (assignedToMe && ownedByMe) {
517
- throw new Error('Use either assignedToMe or ownedByMe, not both.');
518
- }
519
- if (assignedToMe && args.assigneeId !== undefined) {
520
- throw new Error('Cannot use assignedToMe with assigneeId.');
521
- }
522
- if (ownedByMe && args.ownerId !== undefined) {
523
- throw new Error('Cannot use ownedByMe with ownerId.');
524
- }
525
- if (assignedToMe || ownedByMe) {
526
- const userContext = await getUserContext();
527
- const userId = userContext.id;
528
- if (userId === undefined || userId.trim().length === 0) {
529
- throw new Error('Current user ID is unavailable from the CICD gateway context.');
530
- }
531
- if (assignedToMe) {
532
- filters.assigneeId = userId;
533
- }
534
- else {
535
- filters.ownerId = userId;
536
- }
537
- }
538
- const response = await CicdGateway.call({
539
- endpoint: workListEndpoint(filters),
540
- method: 'GET',
541
- });
542
- return { userStories: normalizeUserStories(response) };
543
- }
544
- async function workGet(args = {}) {
545
- const workItemId = await resolveWorkItemId(args.id);
546
- const userStory = await CicdGateway.call({
547
- endpoint: workEndpoint(workItemId),
548
- method: 'GET',
549
- });
550
- return { userStory };
551
- }
552
- async function workCreate(args = {}) {
553
- const explicitPayload = buildWorkMutationPayloadFromArgs(args);
554
- const [localDefaults, globalDefaults] = await Promise.all([readDefaults('local'), readDefaults('global')]);
555
- const resolvedDefaults = resolveDefaults(localDefaults, globalDefaults, [...PROJECT_DEFAULT_KEYS]);
556
- const payload = await buildWorkCreatePayload(explicitPayload, resolvedDefaults);
557
- const validationError = validateWorkNonEmptyStringFields(payload, WORK_STRING_VALIDATION_KEYS);
558
- if (validationError !== undefined) {
559
- throw new Error(validationError);
560
- }
561
- const userStory = await CicdGateway.call({
562
- body: payload,
563
- endpoint: workCreateEndpoint(),
564
- headers: { 'Content-Type': 'application/json' },
565
- method: 'POST',
566
- });
567
- return { userStory };
568
- }
569
- async function workUpdate(args) {
570
- const payload = buildWorkMutationPayloadFromArgs(args);
571
- if (Object.keys(payload).length === 0) {
572
- throw new Error('Must provide at least one field to update.');
573
- }
574
- const validationError = validateWorkNonEmptyStringFields(payload, WORK_STRING_VALIDATION_KEYS);
575
- if (validationError !== undefined) {
576
- throw new Error(validationError);
577
- }
578
- const workItemId = await resolveWorkItemId(args.id);
579
- const userStory = await CicdGateway.call({
580
- body: payload,
581
- endpoint: workEndpoint(workItemId),
582
- headers: { 'Content-Type': 'application/json' },
583
- method: 'PATCH',
584
- });
585
- return { userStory };
586
- }
587
- async function workDelete(args) {
588
- const id = assertRequired(args.id, 'id');
589
- await CicdGateway.call({
590
- endpoint: workEndpoint(id),
591
- method: 'DELETE',
592
- });
593
- return { deleted: true, id };
594
- }
595
460
  function authCredentialResult(type) {
596
461
  if (type === 'cicd') {
597
462
  const localConfig = readLocalGatewayConfig();
@@ -756,50 +621,6 @@ async function metadataRefreshDeleted(args) {
756
621
  });
757
622
  return { result };
758
623
  }
759
- function assertCleanWorktree(pendingFiles) {
760
- if (pendingFiles.length > 0) {
761
- throw new Error(`Uncommitted tracked changes present:\n${pendingFiles.map((file) => ` ${file}`).join('\n')}`);
762
- }
763
- }
764
- const mcpWorkPushHooks = {
765
- display: (render) => render(),
766
- log() { },
767
- withSpinner: async (_message, action) => action(),
768
- };
769
- async function workSet(args) {
770
- const setResponse = await CicdGateway.call({
771
- body: { workItem: assertRequired(args.id, 'id') },
772
- endpoint: workSetEndpoint(),
773
- headers: { 'Content-Type': 'application/json' },
774
- method: 'POST',
775
- });
776
- const baseBranch = args.baseBranch?.trim() || setResponse.baseBranch?.trim();
777
- const userStoryId = setResponse.workItem.id?.trim();
778
- const userStoryName = setResponse.workItem.name?.trim();
779
- if (!baseBranch || !userStoryId || !userStoryName)
780
- throw new Error('Work set response is missing a base branch, user story ID, or name.');
781
- assertCleanWorktree(await listPendingChanges());
782
- const branch = featureBranchName(userStoryName);
783
- await fetchOriginBranch(baseBranch);
784
- const checkout = await checkoutFeatureBranch(branch, baseBranch);
785
- await writeLastWorkSelection({ lastBaseBranch: baseBranch, lastWorkItem: userStoryName, lastWorkItemId: userStoryId });
786
- return { ...setResponse, baseBranch, git: { branch: checkout.branch, branchCreated: checkout.created, fetched: true } };
787
- }
788
- async function resolveCurrentWorkBranch() {
789
- const branch = await getCurrentBranch();
790
- const workItem = extractUserStoryFromFeatureBranch(branch);
791
- if (workItem === undefined)
792
- throw new Error(`Current branch '${branch}' is not a feature/US-XXXX branch.`);
793
- assertCleanWorktree(await listPendingChanges());
794
- return { branch, workItem };
795
- }
796
- async function workPush() {
797
- const { branch, workItem } = await resolveCurrentWorkBranch();
798
- const baseBranch = (await readLastBaseBranch())?.trim();
799
- if (!baseBranch)
800
- throw new Error('No base branch recorded. Run work set first.');
801
- return performWorkPush({ baseBranch, branch, hooks: mcpWorkPushHooks, workItem });
802
- }
803
624
  async function workStatus(args = {}) {
804
625
  const workItem = args.id?.trim() || (await readLastWorkItem());
805
626
  if (!workItem)
@@ -807,25 +628,6 @@ async function workStatus(args = {}) {
807
628
  const result = await CicdGateway.call({ endpoint: workStatusEndpoint(workItem), method: 'GET' });
808
629
  return { result };
809
630
  }
810
- async function workSubmitOrDone(kind) {
811
- const { branch, workItem } = await resolveCurrentWorkBranch();
812
- const pushed = await hasUnpushedCommits(branch);
813
- const push = pushed ? await workPush() : undefined;
814
- const endpoint = kind === 'submit' ? workSubmitEndpoint() : workDoneEndpoint();
815
- const result = await CicdGateway.call({
816
- body: { workItem },
817
- endpoint,
818
- headers: { 'Content-Type': 'application/json' },
819
- method: 'POST',
820
- });
821
- return { branch, [kind]: result, ...(push === undefined ? {} : { push }), pushed, workItem };
822
- }
823
- async function workSubmit() {
824
- return workSubmitOrDone('submit');
825
- }
826
- async function workDone() {
827
- return workSubmitOrDone('done');
828
- }
829
631
  export const agentiaMcpToolHandlers = {
830
632
  authGet,
831
633
  authSet,
@@ -864,16 +666,8 @@ export const agentiaMcpToolHandlers = {
864
666
  promotionGet,
865
667
  promotionList,
866
668
  userGet,
867
- workCreate,
868
- workDelete,
869
- workDone,
870
- workGet,
871
- workList,
872
- workPush,
873
- workSet,
874
669
  workStatus,
875
- workSubmit,
876
- workUpdate,
670
+ ...agentiaMcpWorkToolHandlers,
877
671
  };
878
672
  const environmentMutationSchema = {
879
673
  apexTestLevel: z.string().optional().describe('Apex test level.'),
@@ -889,6 +683,7 @@ const environmentMutationSchema = {
889
683
  };
890
684
  const projectSelectorSchema = {
891
685
  assignMe: z.boolean().optional().describe('Select or set the assign-me default.'),
686
+ credential: z.boolean().optional().describe('Select the source credential default.'),
892
687
  environment: z.boolean().optional().describe('Select the environment default.'),
893
688
  epic: z.boolean().optional().describe('Select the epic default.'),
894
689
  feature: z.boolean().optional().describe('Select the feature default.'),
@@ -897,34 +692,6 @@ const projectSelectorSchema = {
897
692
  sprint: z.boolean().optional().describe('Select the sprint default.'),
898
693
  team: z.boolean().optional().describe('Select the team default.'),
899
694
  };
900
- const workMutationSchema = {
901
- acceptanceCriteria: z.string().optional().describe('Acceptance criteria.'),
902
- actualPoints: z.number().int().optional().describe('Actual points.'),
903
- asA: z.string().optional().describe('User story "as a" clause.'),
904
- assignee: z.string().optional().describe('Assignee ID.'),
905
- cancellationReason: z.string().optional().describe('Cancellation reason.'),
906
- closeDate: z.string().optional().describe('Close date.'),
907
- epic: z.string().optional().describe('Epic.'),
908
- excludedFromCbm: z.boolean().optional().describe('Exclude from CBM.'),
909
- feature: z.string().optional().describe('Feature.'),
910
- functionalRequirements: z.string().optional().describe('Functional requirements.'),
911
- ownerId: z.string().optional().describe('Owner ID.'),
912
- plannedPoints: z.number().int().optional().describe('Planned points.'),
913
- priority: z.number().int().optional().describe('Priority.'),
914
- project: z.string().optional().describe('Project ID.'),
915
- recordType: z.string().optional().describe('Record type.'),
916
- releaseId: z.string().optional().describe('Release ID.'),
917
- soThat: z.string().optional().describe('User story "so that" clause.'),
918
- sourceCredential: z.string().optional().describe('Source credential ID.'),
919
- sourceEnvironment: z.string().optional().describe('Source environment ID.'),
920
- sprintId: z.string().optional().describe('Sprint ID.'),
921
- status: z.string().optional().describe('Status.'),
922
- team: z.string().optional().describe('Team.'),
923
- technicalSpecifications: z.string().optional().describe('Technical specifications.'),
924
- theme: z.string().optional().describe('Theme.'),
925
- title: z.string().optional().describe('Title.'),
926
- wantTo: z.string().optional().describe('User story "want to" clause.'),
927
- };
928
695
  const promotionListSchema = {
929
696
  createdById: z.string().optional().describe('Filter by creator ID.'),
930
697
  createdByName: z.string().optional().describe('Filter by creator name.'),
@@ -948,19 +715,6 @@ const promotionListSchema = {
948
715
  status: z.string().optional().describe('Filter by status.'),
949
716
  userStoryId: z.string().optional().describe('Filter by user story ID.'),
950
717
  };
951
- const workListSchema = {
952
- assignedToMe: z.boolean().optional().describe('Filter by the current user as assignee.'),
953
- assigneeId: z.string().optional().describe('Filter by assignee ID.'),
954
- assigneeName: z.string().optional().describe('Filter by assignee name.'),
955
- name: z.string().optional().describe('Filter by name.'),
956
- ownedByMe: z.boolean().optional().describe('Filter by the current user as owner.'),
957
- ownerId: z.string().optional().describe('Filter by owner ID.'),
958
- ownerName: z.string().optional().describe('Filter by owner name.'),
959
- projectId: z.string().optional().describe('Filter by project ID.'),
960
- projectName: z.string().optional().describe('Filter by project name.'),
961
- status: z.string().optional().describe('Filter by status.'),
962
- title: z.string().optional().describe('Filter by title.'),
963
- };
964
718
  export function registerAgentiaMcpTools(server) {
965
719
  server.registerTool('agentia_environment_list', {
966
720
  description: 'List Copado environments via the CICD gateway.',
@@ -1111,6 +865,7 @@ export function registerAgentiaMcpTools(server) {
1111
865
  description: 'Set Agentia project default values for the current project or globally.',
1112
866
  inputSchema: {
1113
867
  assignMe: z.boolean().optional().describe('Assign work items to the current user by default.'),
868
+ credential: z.string().optional().describe('Default source credential.'),
1114
869
  environment: z.string().optional().describe('Default environment.'),
1115
870
  epic: z.string().optional().describe('Default epic.'),
1116
871
  feature: z.string().optional().describe('Default feature.'),
@@ -1126,38 +881,7 @@ export function registerAgentiaMcpTools(server) {
1126
881
  inputSchema: projectSelectorSchema,
1127
882
  title: 'Agentia Project Default Unset',
1128
883
  }, (args) => safelyHandleTool(() => projectDefaultUnset(args || {})));
1129
- server.registerTool('agentia_work_list', {
1130
- description: 'List Copado user stories via the CICD gateway.',
1131
- inputSchema: workListSchema,
1132
- title: 'Agentia Work List',
1133
- }, (args) => safelyHandleTool(() => workList(args || {})));
1134
- server.registerTool('agentia_work_get', {
1135
- description: 'Get a Copado user story by Id via the CICD gateway. Omit Id to use the active work item from work set.',
1136
- inputSchema: {
1137
- id: z.string().optional().describe('User story Id. Defaults to the active work item from work set.'),
1138
- },
1139
- title: 'Agentia Work Get',
1140
- }, (args) => safelyHandleTool(() => workGet(args || {})));
1141
- server.registerTool('agentia_work_create', {
1142
- description: 'Create a Copado user story via the CICD gateway.',
1143
- inputSchema: workMutationSchema,
1144
- title: 'Agentia Work Create',
1145
- }, (args) => safelyHandleTool(() => workCreate(args || {})));
1146
- server.registerTool('agentia_work_update', {
1147
- description: 'Update a Copado user story by Id via the CICD gateway. Omit Id to use the active work item from work set.',
1148
- inputSchema: {
1149
- ...workMutationSchema,
1150
- id: z.string().optional().describe('User story Id. Defaults to the active work item from work set.'),
1151
- },
1152
- title: 'Agentia Work Update',
1153
- }, (args) => safelyHandleTool(() => workUpdate(args)));
1154
- server.registerTool('agentia_work_delete', {
1155
- description: 'Delete a Copado user story by Id via the CICD gateway.',
1156
- inputSchema: {
1157
- id: z.string().describe('User story Id.'),
1158
- },
1159
- title: 'Agentia Work Delete',
1160
- }, (args) => safelyHandleTool(() => workDelete(args)));
884
+ registerAgentiaMcpWorkTools(server);
1161
885
  server.registerTool('agentia_metadata_list', {
1162
886
  description: 'Search the Copado metadata index via the CICD gateway.',
1163
887
  inputSchema: {
@@ -1350,33 +1074,10 @@ export function registerAgentiaMcpTools(server) {
1350
1074
  },
1351
1075
  title: 'Agentia Metadata Refresh Deleted',
1352
1076
  }, (args) => safelyHandleTool(() => metadataRefreshDeleted(args)));
1353
- server.registerTool('agentia_work_set', {
1354
- description: 'Set the active work item, then fetch and check out its feature branch in the MCP server current Git repository. Changes the current branch.',
1355
- inputSchema: {
1356
- baseBranch: z.string().optional().describe('Override the base branch returned by Copado.'),
1357
- id: z.string().describe('User story ID or name.'),
1358
- },
1359
- title: 'Agentia Work Set',
1360
- }, (args) => safelyHandleTool(() => workSet(args)));
1361
1077
  server.registerTool('agentia_work_status', {
1362
1078
  description: 'Get work status and related jobs. Defaults to the active work item from work set.',
1363
1079
  inputSchema: { id: z.string().optional().describe('User story ID or name.') },
1364
1080
  title: 'Agentia Work Status',
1365
1081
  }, (args) => safelyHandleTool(() => workStatus(args || {})));
1366
- server.registerTool('agentia_work_push', {
1367
- description: 'Push and register commits for the current feature branch in the MCP server current Git repository. Pushes to origin.',
1368
- inputSchema: {},
1369
- title: 'Agentia Work Push',
1370
- }, () => safelyHandleTool(() => workPush()));
1371
- server.registerTool('agentia_work_submit', {
1372
- description: 'Submit the current feature-branch work item. Pushes and registers unpushed commits in the MCP server current Git repository first.',
1373
- inputSchema: {},
1374
- title: 'Agentia Work Submit',
1375
- }, () => safelyHandleTool(() => workSubmit()));
1376
- server.registerTool('agentia_work_done', {
1377
- description: 'Mark the current feature-branch work item done. Pushes and registers unpushed commits in the MCP server current Git repository first.',
1378
- inputSchema: {},
1379
- title: 'Agentia Work Done',
1380
- }, () => safelyHandleTool(() => workDone()));
1381
1082
  }
1382
1083
  //# sourceMappingURL=tools.js.map