@copado/agentia-cli 1.0.0-beta.1 → 1.0.0-beta.2
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/CHANGELOG.md +31 -0
- package/README.md +499 -323
- package/dist/commands/cicd/cloud/commit.js +252 -0
- package/dist/commands/cicd/cloud/promote.js +139 -0
- package/dist/commands/cicd/health-check.js +77 -0
- package/dist/commands/cicd/work/commit.js +10 -324
- package/dist/commands/cicd/work/environment-sync.js +120 -0
- package/dist/commands/cicd/work/get.js +25 -4
- package/dist/commands/cicd/work/promote.js +93 -97
- package/dist/commands/cicd/work/set.js +4 -2
- package/dist/commands/cicd/work/submit.js +7 -0
- package/dist/lib/defaults-store.js +2 -1
- package/dist/lib/git-sizer.js +5 -0
- package/dist/lib/git-worktree.js +16 -1
- package/dist/lib/health-check.js +3 -0
- package/dist/lib/mcp/command-id.js +1 -0
- package/dist/lib/mcp/health-check-tools.js +16 -0
- package/dist/lib/mcp/server.js +2 -1
- package/dist/lib/mcp/tool-annotations.js +265 -0
- package/dist/lib/mcp/tools.js +3 -0
- package/dist/lib/mcp/work-tools.js +96 -78
- package/dist/lib/metadata-pathspecs.js +4 -0
- package/dist/lib/metadataRegistry.json +5427 -0
- package/dist/lib/promotion-types.js +4 -1
- package/dist/lib/runtime.js +1 -1
- package/dist/lib/work-environment-sync-errors.js +4 -0
- package/dist/lib/work-environment-sync-ready.js +18 -0
- package/dist/lib/work-environment-sync.js +42 -0
- package/dist/lib/work-promote-deploy.js +13 -0
- package/dist/lib/work-promote-errors.js +5 -0
- package/dist/lib/work-promote.js +12 -0
- package/dist/lib/work-set-selection.js +2 -1
- package/dist/lib/work-submit-ahead-behind.js +8 -0
- package/dist/lib/work-types.js +2 -1
- package/oclif.manifest.json +1118 -675
- package/package.json +5 -2
- package/templates/skills/agentia-cicd/SKILL.md +2 -2
- package/templates/skills/agentia-cicd/references/promotions.md +8 -8
- package/templates/skills/agentia-cicd/references/work.md +16 -14
|
@@ -1,141 +1,137 @@
|
|
|
1
|
-
import { confirm } from '@inquirer/prompts';
|
|
2
1
|
import { Args, Flags } from '@oclif/core';
|
|
3
2
|
import { AgentiaCommand } from '../../../lib/agentia-command.js';
|
|
4
|
-
import {
|
|
5
|
-
import { resolveWorkItemId, WorkActiveResolutionError } from '../../../lib/work-active.js';
|
|
3
|
+
import { collectPromoteUserStoryIds, formatWorkPromoteResult, performWorkPromote, WorkPromoteConflictError, WorkPromoteValidationError, } from '../../../lib/work-promote.js';
|
|
6
4
|
export default class WorkPromote extends AgentiaCommand {
|
|
7
5
|
static args = {
|
|
8
|
-
|
|
9
|
-
description: 'User
|
|
6
|
+
userStoryIds: Args.string({
|
|
7
|
+
description: 'User story ID. Pass more than one to merge those feature branches in order. Omit when using --promotion with --continue or --abort.',
|
|
8
|
+
multiple: true,
|
|
10
9
|
required: false,
|
|
11
10
|
}),
|
|
12
11
|
};
|
|
13
12
|
static description = [
|
|
14
|
-
'
|
|
15
|
-
'
|
|
13
|
+
'Experimental: skips Quality Gates. Requires enableLocalPromote true in .agentia/config.json.',
|
|
14
|
+
'Create a promotion for one or more user stories and merge each feature/<name> branch into promotion/<promotionName>.',
|
|
15
|
+
'The promotion branch is created from the destination environment branch.',
|
|
16
|
+
'Without --backpromote, the stories promote forward from their source environment to the next pipeline environment.',
|
|
17
|
+
'With --backpromote, pass --destination-branch. The destination environment is the pipeline environment whose connection branch matches that name, and the source is the next environment above it.',
|
|
18
|
+
'Story merges stop at the first conflict and the promotion status is set to Merge Conflict.',
|
|
19
|
+
'Resolve those files, then re-run with --promotion=<name-or-id> --continue to commit the merge, merge any remaining stories, and finish the promotion.',
|
|
20
|
+
'To discard a conflicted merge, re-run with --promotion=<name-or-id> --abort (runs git merge --abort and sets the promotion status to Draft).',
|
|
21
|
+
'That continue command repeats --validate or --deploy and --sf-alias when the original command used them.',
|
|
22
|
+
'After every story merges, the promotion branch is pushed.',
|
|
23
|
+
'Without --validate or --deploy, the promotion status is set to Completed.',
|
|
24
|
+
'With --validate or --deploy, --sf-alias is required. The command writes a temporary package.xml and postdestructivechanges.xml from the promotion metadata and runs sf project deploy start --test-level NoTestRun -o <alias>.',
|
|
25
|
+
'--validate adds --dry-run, does not merge the destination branch, and sets the promotion status to Validated.',
|
|
26
|
+
'--deploy merges the promotion branch into the destination branch and sets the promotion status to Completed only after that deployment succeeds.',
|
|
27
|
+
'User story records are not updated.',
|
|
16
28
|
].join(' ');
|
|
17
29
|
static examples = [
|
|
18
|
-
'<%= config.bin %> <%= command.id %>
|
|
19
|
-
'<%= config.bin %> <%= command.id %>
|
|
20
|
-
'<%= config.bin %> <%= command.id %> --
|
|
30
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC',
|
|
31
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC a16P7000006By4qIAC',
|
|
32
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC --backpromote --destination-branch dev1-sfp',
|
|
33
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC --validate --sf-alias destOrg',
|
|
34
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC --deploy --sf-alias destOrg',
|
|
35
|
+
'<%= config.bin %> <%= command.id %> --promotion=P29354 --continue',
|
|
36
|
+
'<%= config.bin %> <%= command.id %> --promotion=P29354 --abort',
|
|
37
|
+
'<%= config.bin %> <%= command.id %> a16P7000006By3pIAC --json',
|
|
21
38
|
];
|
|
22
39
|
static flags = {
|
|
23
|
-
|
|
40
|
+
abort: Flags.boolean({
|
|
24
41
|
default: false,
|
|
25
|
-
description: '
|
|
42
|
+
description: 'Abort an in-progress merge (`git merge --abort`) and set the promotion status to Draft. Requires --promotion. Exclusive with --continue.',
|
|
43
|
+
exclusive: ['continue'],
|
|
26
44
|
}),
|
|
27
|
-
|
|
45
|
+
backpromote: Flags.boolean({
|
|
28
46
|
default: false,
|
|
29
|
-
description: '
|
|
47
|
+
description: 'Create a back promotion. Requires --destination-branch. Omit to promote forward to the next pipeline environment.',
|
|
30
48
|
}),
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
49
|
+
continue: Flags.boolean({
|
|
50
|
+
default: false,
|
|
51
|
+
description: 'Commit a resolved merge on promotion/<name> and finish the remaining story merges. Requires --promotion.',
|
|
52
|
+
exclusive: ['abort'],
|
|
34
53
|
}),
|
|
35
|
-
|
|
36
|
-
|
|
54
|
+
deploy: Flags.boolean({
|
|
55
|
+
default: false,
|
|
56
|
+
description: 'Deploy the promotion metadata with sf project deploy start, then merge the promotion branch into the destination branch and set the promotion status to Completed. Requires --sf-alias.',
|
|
57
|
+
exclusive: ['validate'],
|
|
37
58
|
}),
|
|
38
|
-
'
|
|
39
|
-
|
|
59
|
+
'destination-branch': Flags.string({
|
|
60
|
+
dependsOn: ['backpromote'],
|
|
61
|
+
description: 'Destination environment Git branch for --backpromote. The destination environment is the pipeline environment whose connection branch matches this name.',
|
|
40
62
|
}),
|
|
41
|
-
'
|
|
42
|
-
description: '
|
|
63
|
+
'destination-credential': Flags.string({
|
|
64
|
+
description: 'Credential ID posted as destinationCredentialId. Defaults to the destination environment default credential for a forward promotion, or the next/source environment default credential for --backpromote.',
|
|
43
65
|
}),
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
default: true,
|
|
47
|
-
description: 'Poll promotion and deployment executions to terminal status.',
|
|
66
|
+
promotion: Flags.string({
|
|
67
|
+
description: 'Promotion Id or name for --continue after a merge conflict, or for --abort.',
|
|
48
68
|
}),
|
|
49
|
-
'
|
|
50
|
-
|
|
51
|
-
description: 'Maximum total seconds to wait for promotion and deployment executions.',
|
|
69
|
+
'sf-alias': Flags.string({
|
|
70
|
+
description: 'Salesforce org alias or username for --validate or --deploy. Passed to sf project deploy start -o.',
|
|
52
71
|
}),
|
|
53
|
-
|
|
54
|
-
char: 'y',
|
|
72
|
+
validate: Flags.boolean({
|
|
55
73
|
default: false,
|
|
56
|
-
description: '
|
|
74
|
+
description: 'Validate the promotion metadata with sf project deploy start --dry-run. Does not merge the destination branch. Sets the promotion status to Validated. Requires --sf-alias.',
|
|
75
|
+
exclusive: ['deploy'],
|
|
57
76
|
}),
|
|
58
77
|
};
|
|
59
78
|
async run() {
|
|
60
79
|
const { args, flags } = await this.parse(WorkPromote);
|
|
61
|
-
const
|
|
62
|
-
if (!promoteFlags.cloud) {
|
|
63
|
-
this.error('Only cloud promotion is supported for this command. Pass --cloud.', { exit: 2 });
|
|
64
|
-
}
|
|
65
|
-
if (!Number.isInteger(promoteFlags['wait-timeout']) || promoteFlags['wait-timeout'] <= 0) {
|
|
66
|
-
this.error('--wait-timeout must be a positive integer.', { exit: 2 });
|
|
67
|
-
}
|
|
68
|
-
if (!promoteFlags.deploy && promoteFlags['deployment-step-id'] !== undefined) {
|
|
69
|
-
this.error('--deployment-step-id requires --deploy.', { exit: 2 });
|
|
70
|
-
}
|
|
71
|
-
let workItemId;
|
|
80
|
+
const userStoryIds = collectPromoteUserStoryIds(args.userStoryIds);
|
|
72
81
|
try {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
if (error instanceof WorkActiveResolutionError) {
|
|
77
|
-
this.error(error.message, {
|
|
78
|
-
exit: 1,
|
|
79
|
-
suggestions: [`${this.config.bin} cicd work set <id>`],
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
try {
|
|
85
|
-
const promotionId = await this.withSpinner('Resolving User Story promotion', () => resolvePromotionIdForWorkItem(workItemId, promoteFlags['promotion-id']));
|
|
86
|
-
if (promoteFlags['recreate-promotion-branch'] === true && !promoteFlags.yes) {
|
|
87
|
-
if (this.jsonEnabled() || !process.stdin.isTTY) {
|
|
88
|
-
this.error('Promotion branch recreation requires confirmation. Pass --yes for headless or JSON execution.', {
|
|
89
|
-
exit: 2,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
const confirmed = await confirm({
|
|
93
|
-
default: false,
|
|
94
|
-
message: `Recreate the promotion branch for ${promotionId}? Existing promotion branch changes may be replaced.`,
|
|
95
|
-
});
|
|
96
|
-
if (!confirmed) {
|
|
97
|
-
this.error('Promotion canceled.', { exit: 1 });
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const result = await performPromotionRun({
|
|
101
|
-
deploymentStepIds: promoteFlags['deployment-step-id'],
|
|
82
|
+
const result = await performWorkPromote({
|
|
83
|
+
backpromote: flags.backpromote === true,
|
|
84
|
+
cliBin: this.config.bin,
|
|
102
85
|
hooks: {
|
|
103
|
-
log: (message) =>
|
|
86
|
+
log: (message) => {
|
|
87
|
+
this.display(() => {
|
|
88
|
+
this.log(message);
|
|
89
|
+
});
|
|
90
|
+
},
|
|
104
91
|
withSpinner: (message, action) => this.withSpinner(message, action),
|
|
105
92
|
},
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
93
|
+
userStoryIds,
|
|
94
|
+
...(flags.abort ? { abort: true } : {}),
|
|
95
|
+
...(flags.continue ? { continue: true } : {}),
|
|
96
|
+
...(flags.deploy ? { deploy: true } : {}),
|
|
97
|
+
...(flags['destination-branch'] === undefined ? {} : { destinationBranch: flags['destination-branch'] }),
|
|
98
|
+
...(flags['destination-credential'] === undefined
|
|
99
|
+
? {}
|
|
100
|
+
: { destinationCredentialId: flags['destination-credential'] }),
|
|
101
|
+
...(flags.promotion === undefined ? {} : { promotion: flags.promotion }),
|
|
102
|
+
...(flags['sf-alias'] === undefined ? {} : { sfAlias: flags['sf-alias'] }),
|
|
103
|
+
...(flags.validate ? { validate: true } : {}),
|
|
112
104
|
});
|
|
113
|
-
const workResult = { ...result, workItemId };
|
|
114
105
|
this.display(() => {
|
|
115
|
-
this.log(
|
|
116
|
-
this.log(formatPromotionRunResult(result));
|
|
106
|
+
this.log(formatWorkPromoteResult(result));
|
|
117
107
|
});
|
|
118
|
-
return
|
|
108
|
+
return result;
|
|
119
109
|
}
|
|
120
110
|
catch (error) {
|
|
121
|
-
if (error instanceof
|
|
122
|
-
|
|
111
|
+
if (error instanceof WorkPromoteConflictError) {
|
|
112
|
+
const { suggestions } = error;
|
|
113
|
+
const suggestionOptions = suggestions === undefined ? {} : { suggestions };
|
|
114
|
+
if (this.jsonEnabled()) {
|
|
115
|
+
const message = error.gitStatus === undefined || error.gitStatus.length === 0
|
|
116
|
+
? error.message
|
|
117
|
+
: `${error.message}\n\n${error.gitStatus}`;
|
|
118
|
+
this.error(message, { exit: error.exit, ...suggestionOptions });
|
|
119
|
+
}
|
|
120
|
+
this.error(error.message, { exit: false, ...suggestionOptions });
|
|
121
|
+
if (error.gitStatus !== undefined && error.gitStatus.length > 0) {
|
|
122
|
+
this.log('');
|
|
123
|
+
this.log(error.gitStatus);
|
|
124
|
+
}
|
|
125
|
+
this.exit(error.exit);
|
|
123
126
|
}
|
|
124
|
-
if (
|
|
125
|
-
this.
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
this.log(formatPromotionRunResult(error.result));
|
|
129
|
-
}
|
|
127
|
+
if (error instanceof WorkPromoteValidationError) {
|
|
128
|
+
this.error(error.message, {
|
|
129
|
+
exit: error.exit,
|
|
130
|
+
...(error.suggestions === undefined ? {} : { suggestions: error.suggestions }),
|
|
130
131
|
});
|
|
131
|
-
error.oclif = { exit: 1 };
|
|
132
132
|
}
|
|
133
133
|
throw error;
|
|
134
134
|
}
|
|
135
135
|
}
|
|
136
|
-
toErrorJson(err) {
|
|
137
|
-
const base = super.toErrorJson(err);
|
|
138
|
-
return promotionRunErrorJson(base, err);
|
|
139
|
-
}
|
|
140
136
|
}
|
|
141
137
|
//# sourceMappingURL=promote.js.map
|
|
@@ -5,7 +5,7 @@ import { reconcileWorkSetCredential } from '../../../lib/credential-sync.js';
|
|
|
5
5
|
import { writeLastWorkSelection } from '../../../lib/defaults-store.js';
|
|
6
6
|
import { checkoutFeatureBranch, fetchOriginBranch, fetchOriginBranchIfExists, listPendingChanges, } from '../../../lib/git-worktree.js';
|
|
7
7
|
import { performWorkSetNone, WorkSetNoneValidationError } from '../../../lib/work-set-none.js';
|
|
8
|
-
import { isWorkSetWarning, parseWorkSetSelection, toWorkSetWarningResult } from '../../../lib/work-set-selection.js';
|
|
8
|
+
import { isWorkSetWarning, parseWorkSetSelection, toWorkSetWarningResult, writeWorkSetWarningSelection, } from '../../../lib/work-set-selection.js';
|
|
9
9
|
import { featureBranchName, workSetEndpoint, } from '../../../lib/work-types.js';
|
|
10
10
|
export default class WorkSet extends AgentiaCommand {
|
|
11
11
|
static args = {
|
|
@@ -20,7 +20,8 @@ export default class WorkSet extends AgentiaCommand {
|
|
|
20
20
|
'fetches the work item base branch from origin, fetches the feature branch when it',
|
|
21
21
|
'exists on origin, then creates or checks out feature/<user-story-name> from the',
|
|
22
22
|
'remote feature branch when present, otherwise from the base branch.',
|
|
23
|
-
'A gateway warning prints the message, skips git,
|
|
23
|
+
'A gateway warning prints the message, skips git, clears lastBaseBranch/lastDevOrgBranch/lastPullRequestBaseUrl,',
|
|
24
|
+
'and records lastWorkItemId/lastWorkItem/lastWorkItemTitle from the returned work item.',
|
|
24
25
|
'After work/set returns, compares the Story source credential with the CICD project default:',
|
|
25
26
|
'warns when the default or Story credential is missing, and warns without changing the Story',
|
|
26
27
|
'when they differ (shows the current credential and environment; use work update to change it).',
|
|
@@ -111,6 +112,7 @@ export default class WorkSet extends AgentiaCommand {
|
|
|
111
112
|
this.log(setResponse.message);
|
|
112
113
|
});
|
|
113
114
|
if (isWorkSetWarning(setResponse)) {
|
|
115
|
+
await writeWorkSetWarningSelection(setResponse);
|
|
114
116
|
return toWorkSetWarningResult(setResponse);
|
|
115
117
|
}
|
|
116
118
|
let selection;
|
|
@@ -10,6 +10,7 @@ import { openUrl } from '../../../lib/open-browser.js';
|
|
|
10
10
|
import { pickWorkDoneFlags, runWorkDone, workDoneFlags } from '../../../lib/work-done.js';
|
|
11
11
|
import { reportLocalQualityGatesFailure, reportLocalQualityGatesOutcome, } from '../../../lib/work-local-run-tests.js';
|
|
12
12
|
import { performWorkPush, resolveActiveFeatureWorkItem, resolveWorkPushContext, resolveWorkPushNeed, WorkPushValidationError, } from '../../../lib/work-push.js';
|
|
13
|
+
import { reportSubmitUserStoriesAheadBehind } from '../../../lib/work-submit-ahead-behind.js';
|
|
13
14
|
import { waitForPendingCommitJobBeforeSubmit } from '../../../lib/work-submit-wait.js';
|
|
14
15
|
import { buildPullRequestCompareUrl, formatWorkCommandMessage, workSubmitEndpoint, } from '../../../lib/work-types.js';
|
|
15
16
|
export default class WorkSubmit extends AgentiaCommand {
|
|
@@ -19,6 +20,7 @@ export default class WorkSubmit extends AgentiaCommand {
|
|
|
19
20
|
'pushes and registers commits when the branch is ahead of origin, then calls headless work/submit',
|
|
20
21
|
'(Promote Action with validate=true).',
|
|
21
22
|
'When the last pending related job template name contains Commit, waits up to 5 minutes for that job before submitting.',
|
|
23
|
+
'Before submit or promote, counts user stories ahead and behind between the source environment and the next pipeline environment, and warns when stories behind might cause promotion conflicts.',
|
|
22
24
|
'With --done or --deploy, matches Copado UI Submit when promoting (validate=false / headless work/done).',
|
|
23
25
|
'cicd work done is a compatibility alias of this command with --done.',
|
|
24
26
|
].join(' ');
|
|
@@ -201,6 +203,10 @@ export default class WorkSubmit extends AgentiaCommand {
|
|
|
201
203
|
this.log('Branch is up to date with origin; skipping push.');
|
|
202
204
|
});
|
|
203
205
|
}
|
|
206
|
+
const userStoriesAheadBehind = await reportSubmitUserStoriesAheadBehind(workItem, {
|
|
207
|
+
log: (message) => this.display(() => this.log(message)),
|
|
208
|
+
warn: (message) => this.warn(message),
|
|
209
|
+
});
|
|
204
210
|
await waitForPendingCommitJobBeforeSubmit(this, workItem);
|
|
205
211
|
const submit = await this.withSpinner('Submitting work item', () => CicdGateway.call({
|
|
206
212
|
body: attachCapturedOutputLogs({ workItem }),
|
|
@@ -221,6 +227,7 @@ export default class WorkSubmit extends AgentiaCommand {
|
|
|
221
227
|
pushed: needsPush,
|
|
222
228
|
qualityGates,
|
|
223
229
|
submit,
|
|
230
|
+
...(userStoriesAheadBehind === undefined ? {} : { userStoriesAheadBehind }),
|
|
224
231
|
workItem,
|
|
225
232
|
};
|
|
226
233
|
}, commandStdioCaptureOptions(this));
|
|
@@ -8,6 +8,7 @@ const isValidUserContext = modules["defaults-store.js"]["isValidUserContext"]
|
|
|
8
8
|
const migrateUserSettingsFromProjectConfig = modules["defaults-store.js"]["migrateUserSettingsFromProjectConfig"]
|
|
9
9
|
const readCredentialSyncReceipt = modules["defaults-store.js"]["readCredentialSyncReceipt"]
|
|
10
10
|
const readDefaults = modules["defaults-store.js"]["readDefaults"]
|
|
11
|
+
const readEnableLocalPromote = modules["defaults-store.js"]["readEnableLocalPromote"]
|
|
11
12
|
const readLastApexTestClassesSelected = modules["defaults-store.js"]["readLastApexTestClassesSelected"]
|
|
12
13
|
const readLastBaseBranch = modules["defaults-store.js"]["readLastBaseBranch"]
|
|
13
14
|
const readLastDevOrgBranch = modules["defaults-store.js"]["readLastDevOrgBranch"]
|
|
@@ -31,4 +32,4 @@ const writeDefaults = modules["defaults-store.js"]["writeDefaults"]
|
|
|
31
32
|
const writeLastCommitSelections = modules["defaults-store.js"]["writeLastCommitSelections"]
|
|
32
33
|
const writeLastWorkSelection = modules["defaults-store.js"]["writeLastWorkSelection"]
|
|
33
34
|
const writeUserContext = modules["defaults-store.js"]["writeUserContext"]
|
|
34
|
-
export {DEFAULT_WORK_PUSH_RETRY_TIMEOUT_SECONDS, clearCredentialSyncReceipt, clearLastKeysFromUserConfig, clearUserContext, getDefaultsStorePaths, isValidUserContext, migrateUserSettingsFromProjectConfig, readCredentialSyncReceipt, readDefaults, readLastApexTestClassesSelected, readLastBaseBranch, readLastDevOrgBranch, readLastFullMetadataSelected, readLastPermissionSelected, readLastPullRequestBaseUrl, readLastWorkItem, readLastWorkItemId, readLastWorkItemTitle, readSkipNestedMetadataDetection, readSkipPullRequest, readUserContext, readWorkPushRetryTimeoutSeconds, resetDefaultsStorePathsForTests, resolveDefaults, setDefaultsStorePathsForTests, setDefaultsStoreProjectRoot, unsetDefaults, writeCredentialSyncReceipt, writeDefaults, writeLastCommitSelections, writeLastWorkSelection, writeUserContext};
|
|
35
|
+
export {DEFAULT_WORK_PUSH_RETRY_TIMEOUT_SECONDS, clearCredentialSyncReceipt, clearLastKeysFromUserConfig, clearUserContext, getDefaultsStorePaths, isValidUserContext, migrateUserSettingsFromProjectConfig, readCredentialSyncReceipt, readDefaults, readEnableLocalPromote, readLastApexTestClassesSelected, readLastBaseBranch, readLastDevOrgBranch, readLastFullMetadataSelected, readLastPermissionSelected, readLastPullRequestBaseUrl, readLastWorkItem, readLastWorkItemId, readLastWorkItemTitle, readSkipNestedMetadataDetection, readSkipPullRequest, readUserContext, readWorkPushRetryTimeoutSeconds, resetDefaultsStorePathsForTests, resolveDefaults, setDefaultsStorePathsForTests, setDefaultsStoreProjectRoot, unsetDefaults, writeCredentialSyncReceipt, writeDefaults, writeLastCommitSelections, writeLastWorkSelection, writeUserContext};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import {modules} from './runtime.js';
|
|
2
|
+
const analyzeGitRepository = modules["git-sizer.js"]["analyzeGitRepository"]
|
|
3
|
+
const gitSizerRows = modules["git-sizer.js"]["gitSizerRows"]
|
|
4
|
+
const parseGitSizerMetrics = modules["git-sizer.js"]["parseGitSizerMetrics"]
|
|
5
|
+
export {analyzeGitRepository, gitSizerRows, parseGitSizerMetrics};
|
package/dist/lib/git-worktree.js
CHANGED
|
@@ -6,8 +6,11 @@ const checkoutFeatureBranch = modules["git-worktree.js"]["checkoutFeatureBranch"
|
|
|
6
6
|
const checkoutPreferredBranch = modules["git-worktree.js"]["checkoutPreferredBranch"]
|
|
7
7
|
const commitAllTrackedChanges = modules["git-worktree.js"]["commitAllTrackedChanges"]
|
|
8
8
|
const commitAllowEmpty = modules["git-worktree.js"]["commitAllowEmpty"]
|
|
9
|
+
const commitCurrentMerge = modules["git-worktree.js"]["commitCurrentMerge"]
|
|
9
10
|
const commitStagedChanges = modules["git-worktree.js"]["commitStagedChanges"]
|
|
10
11
|
const countCommitsSince = modules["git-worktree.js"]["countCommitsSince"]
|
|
12
|
+
const createAndCheckoutBranch = modules["git-worktree.js"]["createAndCheckoutBranch"]
|
|
13
|
+
const fetchAndCheckoutBranch = modules["git-worktree.js"]["fetchAndCheckoutBranch"]
|
|
11
14
|
const fetchOriginBranch = modules["git-worktree.js"]["fetchOriginBranch"]
|
|
12
15
|
const fetchOriginBranchIfExists = modules["git-worktree.js"]["fetchOriginBranchIfExists"]
|
|
13
16
|
const getCommitsNameStatus = modules["git-worktree.js"]["getCommitsNameStatus"]
|
|
@@ -15,22 +18,34 @@ const getCurrentBranch = modules["git-worktree.js"]["getCurrentBranch"]
|
|
|
15
18
|
const getFileAtRef = modules["git-worktree.js"]["getFileAtRef"]
|
|
16
19
|
const getGitRepoRoot = modules["git-worktree.js"]["getGitRepoRoot"]
|
|
17
20
|
const getHeadCommitId = modules["git-worktree.js"]["getHeadCommitId"]
|
|
21
|
+
const getHumanGitStatus = modules["git-worktree.js"]["getHumanGitStatus"]
|
|
18
22
|
const getMergeBase = modules["git-worktree.js"]["getMergeBase"]
|
|
19
23
|
const getRemoteUrl = modules["git-worktree.js"]["getRemoteUrl"]
|
|
20
24
|
const hasUnpushedCommits = modules["git-worktree.js"]["hasUnpushedCommits"]
|
|
25
|
+
const isAncestor = modules["git-worktree.js"]["isAncestor"]
|
|
21
26
|
const isInsideGitWorkTree = modules["git-worktree.js"]["isInsideGitWorkTree"]
|
|
27
|
+
const isMergeInProgress = modules["git-worktree.js"]["isMergeInProgress"]
|
|
28
|
+
const isSafeGitBranchName = modules["git-worktree.js"]["isSafeGitBranchName"]
|
|
29
|
+
const listDiffNamesVsHead = modules["git-worktree.js"]["listDiffNamesVsHead"]
|
|
22
30
|
const listPendingChanges = modules["git-worktree.js"]["listPendingChanges"]
|
|
23
31
|
const listStagedChanges = modules["git-worktree.js"]["listStagedChanges"]
|
|
32
|
+
const listUnmergedFiles = modules["git-worktree.js"]["listUnmergedFiles"]
|
|
24
33
|
const localBranchExists = modules["git-worktree.js"]["localBranchExists"]
|
|
34
|
+
const mergeFfOnly = modules["git-worktree.js"]["mergeFfOnly"]
|
|
35
|
+
const mergeNoFf = modules["git-worktree.js"]["mergeNoFf"]
|
|
36
|
+
const mergeNoFfNoCommit = modules["git-worktree.js"]["mergeNoFfNoCommit"]
|
|
25
37
|
const mergeTheirsIgnoreSpaceChange = modules["git-worktree.js"]["mergeTheirsIgnoreSpaceChange"]
|
|
26
38
|
const originBranchRef = modules["git-worktree.js"]["originBranchRef"]
|
|
27
39
|
const originFetchRefspec = modules["git-worktree.js"]["originFetchRefspec"]
|
|
40
|
+
const parseNameOnly = modules["git-worktree.js"]["parseNameOnly"]
|
|
28
41
|
const parsePorcelainPaths = modules["git-worktree.js"]["parsePorcelainPaths"]
|
|
29
42
|
const pullOriginBranch = modules["git-worktree.js"]["pullOriginBranch"]
|
|
30
43
|
const pushOriginBranch = modules["git-worktree.js"]["pushOriginBranch"]
|
|
44
|
+
const pushOriginBranches = modules["git-worktree.js"]["pushOriginBranches"]
|
|
31
45
|
const resetGitExecForTests = modules["git-worktree.js"]["resetGitExecForTests"]
|
|
32
46
|
const resetHardHead = modules["git-worktree.js"]["resetHardHead"]
|
|
33
47
|
const restoreFeatureBranch = modules["git-worktree.js"]["restoreFeatureBranch"]
|
|
48
|
+
const restoreHeadPaths = modules["git-worktree.js"]["restoreHeadPaths"]
|
|
34
49
|
const setGitExecForTests = modules["git-worktree.js"]["setGitExecForTests"]
|
|
35
50
|
const stageAndCommit = modules["git-worktree.js"]["stageAndCommit"]
|
|
36
|
-
export {NAME_STATUS_PRETTY_FORMAT, abortMerge, checkoutBranch, checkoutFeatureBranch, checkoutPreferredBranch, commitAllTrackedChanges, commitAllowEmpty, commitStagedChanges, countCommitsSince, fetchOriginBranch, fetchOriginBranchIfExists, getCommitsNameStatus, getCurrentBranch, getFileAtRef, getGitRepoRoot, getHeadCommitId, getMergeBase, getRemoteUrl, hasUnpushedCommits, isInsideGitWorkTree, listPendingChanges, listStagedChanges, localBranchExists, mergeTheirsIgnoreSpaceChange, originBranchRef, originFetchRefspec, parsePorcelainPaths, pullOriginBranch, pushOriginBranch, resetGitExecForTests, resetHardHead, restoreFeatureBranch, setGitExecForTests, stageAndCommit};
|
|
51
|
+
export {NAME_STATUS_PRETTY_FORMAT, abortMerge, checkoutBranch, checkoutFeatureBranch, checkoutPreferredBranch, commitAllTrackedChanges, commitAllowEmpty, commitCurrentMerge, commitStagedChanges, countCommitsSince, createAndCheckoutBranch, fetchAndCheckoutBranch, fetchOriginBranch, fetchOriginBranchIfExists, getCommitsNameStatus, getCurrentBranch, getFileAtRef, getGitRepoRoot, getHeadCommitId, getHumanGitStatus, getMergeBase, getRemoteUrl, hasUnpushedCommits, isAncestor, isInsideGitWorkTree, isMergeInProgress, isSafeGitBranchName, listDiffNamesVsHead, listPendingChanges, listStagedChanges, listUnmergedFiles, localBranchExists, mergeFfOnly, mergeNoFf, mergeNoFfNoCommit, mergeTheirsIgnoreSpaceChange, originBranchRef, originFetchRefspec, parseNameOnly, parsePorcelainPaths, pullOriginBranch, pushOriginBranch, pushOriginBranches, resetGitExecForTests, resetHardHead, restoreFeatureBranch, restoreHeadPaths, setGitExecForTests, stageAndCommit};
|
|
@@ -24,6 +24,7 @@ const HYPHENATED_TOKEN_REPLACEMENTS = [
|
|
|
24
24
|
['preview_updates', 'preview-updates'],
|
|
25
25
|
['convert_old', 'convert-old'],
|
|
26
26
|
['get_detail', 'get-detail'],
|
|
27
|
+
['health_check', 'health-check'],
|
|
27
28
|
['save_detail', 'save-detail'],
|
|
28
29
|
['stage_connection', 'stage-connection'],
|
|
29
30
|
['run_local', 'run-local'],
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { runOrganizationHealthChecks } from '../health-check.js';
|
|
2
|
+
import { safelyHandleTool } from './result.js';
|
|
3
|
+
async function healthCheck() {
|
|
4
|
+
return runOrganizationHealthChecks();
|
|
5
|
+
}
|
|
6
|
+
export const agentiaMcpHealthCheckToolHandlers = {
|
|
7
|
+
healthCheck,
|
|
8
|
+
};
|
|
9
|
+
export function registerAgentiaMcpHealthCheckTools(server) {
|
|
10
|
+
server.registerTool('agentia_health_check', {
|
|
11
|
+
description: 'Run organization-scoped governance health checks via the CICD gateway.',
|
|
12
|
+
inputSchema: {},
|
|
13
|
+
title: 'Agentia Health Check',
|
|
14
|
+
}, () => safelyHandleTool(() => healthCheck()));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=health-check-tools.js.map
|
package/dist/lib/mcp/server.js
CHANGED
|
@@ -6,6 +6,7 @@ import { migrateUserSettingsFromProjectConfig } from '../defaults-store.js';
|
|
|
6
6
|
import { applyProjectRoot } from '../project-root.js';
|
|
7
7
|
import { runWithMcpRequestSignal } from './request-context.js';
|
|
8
8
|
import { runWithMcpToolContext } from './result.js';
|
|
9
|
+
import { withToolAnnotations } from './tool-annotations.js';
|
|
9
10
|
import { registerAgentiaMcpTools } from './tools.js';
|
|
10
11
|
const require = createRequire(import.meta.url);
|
|
11
12
|
const packageJson = require('../../../package.json');
|
|
@@ -43,7 +44,7 @@ function combineSignals(requestSignal, lifecycleSignal) {
|
|
|
43
44
|
}
|
|
44
45
|
function wrapMcpToolRegistration(server, lifecycleSignal) {
|
|
45
46
|
const registerTool = server.registerTool.bind(server);
|
|
46
|
-
server.registerTool = ((name, config, handler) => registerTool(name, config, (...args) => {
|
|
47
|
+
server.registerTool = ((name, config, handler) => registerTool(name, withToolAnnotations(name, config), (...args) => {
|
|
47
48
|
const extra = args.at(-1);
|
|
48
49
|
const { dispose, signal } = combineSignals(extra?.signal, lifecycleSignal);
|
|
49
50
|
return runWithMcpRequestSignal(signal, async () => {
|