@copado/agentia-cli 0.85.0-alpha.0 → 0.87.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 (29) hide show
  1. package/README.md +315 -176
  2. package/dist/commands/cicd/notification/configure.d.ts +14 -0
  3. package/dist/commands/cicd/notification/configure.js +62 -0
  4. package/dist/commands/cicd/notification/configure.js.map +1 -0
  5. package/dist/commands/setup/skills/create.d.ts +15 -0
  6. package/dist/commands/setup/skills/create.js +64 -0
  7. package/dist/commands/setup/skills/create.js.map +1 -0
  8. package/dist/commands/setup/skills/update.d.ts +15 -0
  9. package/dist/commands/setup/skills/update.js +64 -0
  10. package/dist/commands/setup/skills/update.js.map +1 -0
  11. package/dist/lib/notifications-configure.d.ts +34 -0
  12. package/dist/lib/notifications-configure.js +101 -0
  13. package/dist/lib/notifications-configure.js.map +1 -0
  14. package/dist/lib/setup-skills.d.ts +67 -0
  15. package/dist/lib/setup-skills.js +251 -0
  16. package/dist/lib/setup-skills.js.map +1 -0
  17. package/oclif.manifest.json +367 -97
  18. package/package.json +11 -1
  19. package/templates/skills/agentia-ai/SKILL.md +34 -0
  20. package/templates/skills/agentia-ai/references/ai-agents.md +70 -0
  21. package/templates/skills/agentia-cicd/SKILL.md +41 -0
  22. package/templates/skills/agentia-cicd/references/data.md +65 -0
  23. package/templates/skills/agentia-cicd/references/environments-and-credentials.md +55 -0
  24. package/templates/skills/agentia-cicd/references/jobs.md +42 -0
  25. package/templates/skills/agentia-cicd/references/pipelines.md +63 -0
  26. package/templates/skills/agentia-cicd/references/promotions.md +58 -0
  27. package/templates/skills/agentia-cicd/references/work.md +84 -0
  28. package/templates/skills/agentia-testing/SKILL.md +34 -0
  29. package/templates/skills/agentia-testing/references/tests.md +65 -0
@@ -0,0 +1,14 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type ConfigureNotificationResult } from '../../../lib/notifications-configure.js';
3
+ export default class NotificationConfigure extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ 'destination-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
8
+ 'destination-type': import("@oclif/core/interfaces").OptionFlag<"user" | "channel", import("@oclif/core/interfaces").CustomOptions>;
9
+ event: import("@oclif/core/interfaces").OptionFlag<"Promotion_Success" | "Promotion_Failed" | "Promotion_Conflict" | "Failed_Promotion_Creation" | "Deploy_Success" | "Deploy_Failed" | "Commit_Failed" | "Successful_Snapshot" | "Failed_Snapshot" | "ManualTask_Assigned" | "Test_Success" | "Test_Failed" | "Test_Cancelled" | "Test_Not Started" | "Quality_Gate_Success" | "Quality_Gate_Failed" | "Quality_Gate_Cancelled" | "Quality_Gate_Not Started" | "Create_Package_Success" | "Create_Package_Failure" | "Generate_Package_Version_Success" | "Generate_Package_Version_Failure" | "Import_Package_Success" | "Import_Package_Failure" | "Publish_Package_Success" | "Publish_Package_Failure", import("@oclif/core/interfaces").CustomOptions>;
10
+ 'pipeline-id': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
11
+ subscription: import("@oclif/core/interfaces").OptionFlag<"user" | "all", import("@oclif/core/interfaces").CustomOptions>;
12
+ };
13
+ run(): Promise<ConfigureNotificationResult>;
14
+ }
@@ -0,0 +1,62 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { configureNotification, formatConfigureNotificationSummary, NOTIFICATION_DESTINATION_TYPES, NOTIFICATION_EVENTS, NOTIFICATION_SUBSCRIPTIONS, NotificationConfigureInputError, withNotificationConfigureErrorTranslation, } from '../../../lib/notifications-configure.js';
4
+ export default class NotificationConfigure extends AgentiaCommand {
5
+ static description = 'Configure one Slack notification subscription for the current user on a pipeline';
6
+ static examples = [
7
+ '<%= config.bin %> <%= command.id %> --pipeline-id <pipeline-id> --event Promotion_Failed --destination-type user --destination-id U0123ABCD --subscription user',
8
+ '<%= config.bin %> <%= command.id %> -p <pipeline-id> --event Commit_Failed --destination-type channel --destination-id C0123ABCD --subscription all',
9
+ '<%= config.bin %> <%= command.id %> --pipeline-id <pipeline-id> --event "Test_Not Started" --destination-type user --destination-id @jane --subscription user --json',
10
+ ];
11
+ static flags = {
12
+ 'destination-id': Flags.string({
13
+ description: 'Slack user or channel id or name',
14
+ required: true,
15
+ }),
16
+ 'destination-type': Flags.option({
17
+ description: 'Slack destination type',
18
+ options: [...NOTIFICATION_DESTINATION_TYPES],
19
+ required: true,
20
+ })(),
21
+ event: Flags.option({
22
+ description: 'Notification event',
23
+ options: [...NOTIFICATION_EVENTS],
24
+ required: true,
25
+ })(),
26
+ 'pipeline-id': Flags.string({
27
+ char: 'p',
28
+ description: 'Copado pipeline Salesforce Id',
29
+ required: true,
30
+ }),
31
+ subscription: Flags.option({
32
+ description: 'Notification audience for this event',
33
+ options: [...NOTIFICATION_SUBSCRIPTIONS],
34
+ required: true,
35
+ })(),
36
+ };
37
+ async run() {
38
+ const { flags } = await this.parse(NotificationConfigure);
39
+ const result = await this.withSpinner('Configuring notification', async () => {
40
+ try {
41
+ return await withNotificationConfigureErrorTranslation(() => configureNotification({
42
+ destinationId: flags['destination-id'],
43
+ destinationType: flags['destination-type'],
44
+ event: flags.event,
45
+ pipelineId: flags['pipeline-id'],
46
+ subscription: flags.subscription,
47
+ }));
48
+ }
49
+ catch (error) {
50
+ if (error instanceof NotificationConfigureInputError) {
51
+ this.error(error.message, { exit: error.exitCode });
52
+ }
53
+ throw error;
54
+ }
55
+ });
56
+ this.display(() => {
57
+ this.log(formatConfigureNotificationSummary(result));
58
+ });
59
+ return result;
60
+ }
61
+ }
62
+ //# sourceMappingURL=configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../../../../src/commands/cicd/notification/configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,OAAO,E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,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,0BAA0B,EAAE,KAAK,IAAI,EAAE;YAC3E,IAAI,CAAC;gBACH,OAAO,MAAM,yCAAyC,CAAC,GAAG,EAAE,CAC1D,qBAAqB,CAAC;oBACpB,aAAa,EAAE,KAAK,CAAC,gBAAgB,CAAC;oBACtC,eAAe,EAAE,KAAK,CAAC,kBAAkB,CAAC;oBAC1C,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,UAAU,EAAE,KAAK,CAAC,aAAa,CAAC;oBAChC,YAAY,EAAE,KAAK,CAAC,YAAY;iBACjC,CAAC,CACH,CAAA;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,IAAI,KAAK,YAAY,+BAA+B,EAAE,CAAC;oBACrD,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAC,CAAC,CAAA;gBACnD,CAAC;gBAED,MAAM,KAAK,CAAA;YACb,CAAC;QACH,CAAC,CAAC,CAAA;QAEF,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE;YAChB,IAAI,CAAC,GAAG,CAAC,kCAAkC,CAAC,MAAM,CAAC,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;QAEF,OAAO,MAAM,CAAA;IACf,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
2
+ import { type SetupSkillsResult } from '../../../lib/setup-skills.js';
3
+ export default class SetupSkillsCreate extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ ai: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ cicd: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ 'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ testing: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<SetupSkillsResult>;
15
+ }
@@ -0,0 +1,64 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { createInquirerSetupPrompts, isPromptCanceled } from '../../../lib/setup-prompts.js';
4
+ import { resolveSelectedSkillPacks, runSetupSkills, SETUP_SKILL_TARGETS, } from '../../../lib/setup-skills.js';
5
+ export default class SetupSkillsCreate extends AgentiaCommand {
6
+ static description = 'Create portable Markdown-only Agentia CLI skills in this project without overwriting managed files';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> --cicd --target agents --no-prompt',
10
+ '<%= config.bin %> <%= command.id %> --testing --ai --target cursor --no-prompt',
11
+ '<%= config.bin %> <%= command.id %> --json',
12
+ ];
13
+ static flags = {
14
+ ai: Flags.boolean({
15
+ description: 'Create the Copado AI agent skill pack',
16
+ }),
17
+ cicd: Flags.boolean({
18
+ description: 'Create the Copado CICD skill pack',
19
+ }),
20
+ force: Flags.boolean({
21
+ default: false,
22
+ description: 'Replace conflicting unmanaged Agentia skill files',
23
+ }),
24
+ 'no-prompt': Flags.boolean({
25
+ char: 'n',
26
+ default: false,
27
+ description: 'Skip interactive prompts; defaults the target to .agents/skills when --target is omitted',
28
+ }),
29
+ target: Flags.string({
30
+ description: 'Project skill root to write',
31
+ options: [...SETUP_SKILL_TARGETS],
32
+ }),
33
+ testing: Flags.boolean({
34
+ description: 'Create the Copado Robotic Testing skill pack',
35
+ }),
36
+ };
37
+ async run() {
38
+ const { flags } = await this.parse(SetupSkillsCreate);
39
+ const noPrompt = flags['no-prompt'] || this.jsonEnabled();
40
+ try {
41
+ return await runSetupSkills({
42
+ force: flags.force,
43
+ log: (message) => {
44
+ this.display(() => {
45
+ this.log(message);
46
+ });
47
+ },
48
+ mode: 'create',
49
+ noPrompt,
50
+ packs: resolveSelectedSkillPacks(flags),
51
+ target: flags.target,
52
+ }, {
53
+ prompts: noPrompt ? undefined : createInquirerSetupPrompts(),
54
+ });
55
+ }
56
+ catch (error) {
57
+ if (isPromptCanceled(error)) {
58
+ this.error('Setup skills create cancelled.', { exit: 1 });
59
+ }
60
+ this.error(error.message, { exit: 1 });
61
+ }
62
+ }
63
+ }
64
+ //# sourceMappingURL=create.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create.js","sourceRoot":"","sources":["../../../../src/commands/setup/skills/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,+BAA+B,CAAA;AAC1F,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,mBAAmB,GAGpB,MAAM,8BAA8B,CAAA;AAErC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAC3D,MAAM,CAAU,WAAW,GACzB,oGAAoG,CAAA;IACtG,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,wEAAwE;QACxE,gFAAgF;QAChF,4CAA4C;KAC7C,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC;YAChB,WAAW,EAAE,uCAAuC;SACrD,CAAC;QACF,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YAClB,WAAW,EAAE,mCAAmC;SACjD,CAAC;QACF,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC;YACnB,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,mDAAmD;SACjE,CAAC;QACF,WAAW,EAAE,KAAK,CAAC,OAAO,CAAC;YACzB,IAAI,EAAE,GAAG;YACT,OAAO,EAAE,KAAK;YACd,WAAW,EAAE,0FAA0F;SACxG,CAAC;QACF,MAAM,EAA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ommand } from '../../../lib/agentia-command.js';
2
+ import { type SetupSkillsResult } from '../../../lib/setup-skills.js';
3
+ export default class SetupSkillsUpdate extends AgentiaCommand {
4
+ static description: string;
5
+ static examples: string[];
6
+ static flags: {
7
+ ai: import("@oclif/core/interfaces").BooleanFlag<boolean>;
8
+ cicd: import("@oclif/core/interfaces").BooleanFlag<boolean>;
9
+ force: import("@oclif/core/interfaces").BooleanFlag<boolean>;
10
+ 'no-prompt': import("@oclif/core/interfaces").BooleanFlag<boolean>;
11
+ target: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
12
+ testing: import("@oclif/core/interfaces").BooleanFlag<boolean>;
13
+ };
14
+ run(): Promise<SetupSkillsResult>;
15
+ }
@@ -0,0 +1,64 @@
1
+ import { Flags } from '@oclif/core';
2
+ import { AgentiaCommand } from '../../../lib/agentia-command.js';
3
+ import { createInquirerSetupPrompts, isPromptCanceled } from '../../../lib/setup-prompts.js';
4
+ import { resolveSelectedSkillPacks, runSetupSkills, SETUP_SKILL_TARGETS, } from '../../../lib/setup-skills.js';
5
+ export default class SetupSkillsUpdate extends AgentiaCommand {
6
+ static description = 'Update Agentia-managed Markdown skill files and restore missing files in this project';
7
+ static examples = [
8
+ '<%= config.bin %> <%= command.id %>',
9
+ '<%= config.bin %> <%= command.id %> --ai --target cursor --no-prompt',
10
+ '<%= config.bin %> <%= command.id %> --cicd --testing --target agents --no-prompt',
11
+ '<%= config.bin %> <%= command.id %> --force --json',
12
+ ];
13
+ static flags = {
14
+ ai: Flags.boolean({
15
+ description: 'Update the Copado AI agent skill pack',
16
+ }),
17
+ cicd: Flags.boolean({
18
+ description: 'Update the Copado CICD skill pack',
19
+ }),
20
+ force: Flags.boolean({
21
+ default: false,
22
+ description: 'Replace conflicting unmanaged Agentia skill files',
23
+ }),
24
+ 'no-prompt': Flags.boolean({
25
+ char: 'n',
26
+ default: false,
27
+ description: 'Skip interactive prompts; defaults the target to .agents/skills when --target is omitted',
28
+ }),
29
+ target: Flags.string({
30
+ description: 'Project skill root to write',
31
+ options: [...SETUP_SKILL_TARGETS],
32
+ }),
33
+ testing: Flags.boolean({
34
+ description: 'Update the Copado Robotic Testing skill pack',
35
+ }),
36
+ };
37
+ async run() {
38
+ const { flags } = await this.parse(SetupSkillsUpdate);
39
+ const noPrompt = flags['no-prompt'] || this.jsonEnabled();
40
+ try {
41
+ return await runSetupSkills({
42
+ force: flags.force,
43
+ log: (message) => {
44
+ this.display(() => {
45
+ this.log(message);
46
+ });
47
+ },
48
+ mode: 'update',
49
+ noPrompt,
50
+ packs: resolveSelectedSkillPacks(flags),
51
+ target: flags.target,
52
+ }, {
53
+ prompts: noPrompt ? undefined : createInquirerSetupPrompts(),
54
+ });
55
+ }
56
+ catch (error) {
57
+ if (isPromptCanceled(error)) {
58
+ this.error('Setup skills update cancelled.', { exit: 1 });
59
+ }
60
+ this.error(error.message, { exit: 1 });
61
+ }
62
+ }
63
+ }
64
+ //# sourceMappingURL=update.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update.js","sourceRoot":"","sources":["../../../../src/commands/setup/skills/update.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAA;AAEjC,OAAO,EAAC,cAAc,EAAC,MAAM,iCAAiC,CAAA;AAC9D,OAAO,EAAC,0BAA0B,EAAE,gBAAgB,EAAC,MAAM,+BAA+B,CAAA;AAC1F,OAAO,EACL,yBAAyB,EACzB,cAAc,EACd,mBAAmB,GAGpB,MAAM,8BAA8B,CAAA;AAErC,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,cAAc;IAC3D,MAAM,CAAU,WAAW,GACzB,uFAAuF,CAAA;IACzF,MAAM,CAAU,QAAQ,GAAG;QACzB,qCAAqC;QACrC,sEAAsE;QACtE,kFAAkF;QAClF,oDAAoD;KACrD,CAAA;IACD,MAAM,CAAU,KAAK,GAAG;QACtB,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC;YACh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CACF,CAAA;QACH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,gBAAgB,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC5B,IAAI,CAAC,KAAK,CAAC,gCAAgC,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;YACzD,CAAC;YAED,IAAI,CAAC,KAAK,CAAE,KAAe,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,CAAC,EAAC,CAAC,CAAA;QACjD,CAAC;IACH,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { CicdGateway } from './cicd-gateway.js';
2
+ export declare const NOTIFICATIONS_CONFIGURE_ENDPOINT = "/notifications/configure";
3
+ export declare const NOTIFICATION_EVENTS: readonly ["Promotion_Success", "Promotion_Failed", "Promotion_Conflict", "Failed_Promotion_Creation", "Deploy_Success", "Deploy_Failed", "Commit_Failed", "Successful_Snapshot", "Failed_Snapshot", "ManualTask_Assigned", "Test_Success", "Test_Failed", "Test_Cancelled", "Test_Not Started", "Quality_Gate_Success", "Quality_Gate_Failed", "Quality_Gate_Cancelled", "Quality_Gate_Not Started", "Create_Package_Success", "Create_Package_Failure", "Generate_Package_Version_Success", "Generate_Package_Version_Failure", "Import_Package_Success", "Import_Package_Failure", "Publish_Package_Success", "Publish_Package_Failure"];
4
+ export declare const NOTIFICATION_DESTINATION_TYPES: readonly ["user", "channel"];
5
+ export declare const NOTIFICATION_SUBSCRIPTIONS: readonly ["user", "all"];
6
+ export type NotificationEvent = (typeof NOTIFICATION_EVENTS)[number];
7
+ export type NotificationDestinationType = (typeof NOTIFICATION_DESTINATION_TYPES)[number];
8
+ export type NotificationSubscription = (typeof NOTIFICATION_SUBSCRIPTIONS)[number];
9
+ export type ConfigureNotificationRequest = {
10
+ destinationId: string;
11
+ destinationType: NotificationDestinationType;
12
+ event: NotificationEvent;
13
+ pipelineId: string;
14
+ providers: ['slack'];
15
+ subscription: NotificationSubscription;
16
+ };
17
+ export type ConfigureNotificationResult = ConfigureNotificationRequest;
18
+ export type ConfigureNotificationInput = {
19
+ destinationId: string;
20
+ destinationType: NotificationDestinationType;
21
+ event: NotificationEvent;
22
+ pipelineId: string;
23
+ subscription: NotificationSubscription;
24
+ };
25
+ export declare class NotificationConfigureInputError extends Error {
26
+ readonly exitCode = 2;
27
+ constructor(message: string);
28
+ }
29
+ export declare function validatePipelineId(value: string): string;
30
+ export declare function buildConfigureNotificationPayload(input: ConfigureNotificationInput): ConfigureNotificationRequest;
31
+ export declare function formatConfigureNotificationSummary(result: ConfigureNotificationResult): string;
32
+ export declare function translateNotificationConfigureError(error: unknown): Error;
33
+ export declare function withNotificationConfigureErrorTranslation<T>(action: () => Promise<T>): Promise<T>;
34
+ export declare function configureNotification(input: ConfigureNotificationInput, gatewayCall?: typeof CicdGateway.call): Promise<ConfigureNotificationResult>;
@@ -0,0 +1,101 @@
1
+ import { CicdGateway, CicdGatewayError } from './cicd-gateway.js';
2
+ export const NOTIFICATIONS_CONFIGURE_ENDPOINT = '/notifications/configure';
3
+ export const NOTIFICATION_EVENTS = [
4
+ 'Promotion_Success',
5
+ 'Promotion_Failed',
6
+ 'Promotion_Conflict',
7
+ 'Failed_Promotion_Creation',
8
+ 'Deploy_Success',
9
+ 'Deploy_Failed',
10
+ 'Commit_Failed',
11
+ 'Successful_Snapshot',
12
+ 'Failed_Snapshot',
13
+ 'ManualTask_Assigned',
14
+ 'Test_Success',
15
+ 'Test_Failed',
16
+ 'Test_Cancelled',
17
+ 'Test_Not Started',
18
+ 'Quality_Gate_Success',
19
+ 'Quality_Gate_Failed',
20
+ 'Quality_Gate_Cancelled',
21
+ 'Quality_Gate_Not Started',
22
+ 'Create_Package_Success',
23
+ 'Create_Package_Failure',
24
+ 'Generate_Package_Version_Success',
25
+ 'Generate_Package_Version_Failure',
26
+ 'Import_Package_Success',
27
+ 'Import_Package_Failure',
28
+ 'Publish_Package_Success',
29
+ 'Publish_Package_Failure',
30
+ ];
31
+ export const NOTIFICATION_DESTINATION_TYPES = ['user', 'channel'];
32
+ export const NOTIFICATION_SUBSCRIPTIONS = ['user', 'all'];
33
+ const PIPELINE_ID_PATTERN = /^[A-Za-z0-9_]+$/;
34
+ const NOTIFICATION_CONFIGURE_ERROR_MESSAGES = {
35
+ 'NTF-003': 'Slack destination is invalid for the selected destination type. Check destinationId and destinationType.',
36
+ 'NTF-004': 'Pipeline id is missing or invalid. Use a 15- or 18-character Copado pipeline Salesforce id.',
37
+ };
38
+ export class NotificationConfigureInputError extends Error {
39
+ exitCode = 2;
40
+ constructor(message) {
41
+ super(message);
42
+ this.name = 'NotificationConfigureInputError';
43
+ }
44
+ }
45
+ export function validatePipelineId(value) {
46
+ const trimmed = value.trim();
47
+ if (trimmed.length === 0) {
48
+ throw new NotificationConfigureInputError('--pipeline-id cannot be empty.');
49
+ }
50
+ if (trimmed.length !== 15 && trimmed.length !== 18) {
51
+ throw new NotificationConfigureInputError('--pipeline-id must be 15 or 18 characters. Use a valid Copado pipeline Salesforce id.');
52
+ }
53
+ if (!PIPELINE_ID_PATTERN.test(trimmed)) {
54
+ throw new NotificationConfigureInputError('--pipeline-id contains invalid characters. Only letters, digits, and underscores are allowed.');
55
+ }
56
+ return trimmed;
57
+ }
58
+ export function buildConfigureNotificationPayload(input) {
59
+ return {
60
+ destinationId: input.destinationId.trim(),
61
+ destinationType: input.destinationType,
62
+ event: input.event,
63
+ pipelineId: validatePipelineId(input.pipelineId),
64
+ providers: ['slack'],
65
+ subscription: input.subscription,
66
+ };
67
+ }
68
+ export function formatConfigureNotificationSummary(result) {
69
+ return `Configured ${result.event} notification for pipeline ${result.pipelineId} (destination: ${result.destinationId}, type: ${result.destinationType}, subscription: ${result.subscription}).`;
70
+ }
71
+ export function translateNotificationConfigureError(error) {
72
+ if (error instanceof CicdGatewayError) {
73
+ const identifiers = [...error.categories, error.code];
74
+ const identifier = identifiers.find((value) => value !== undefined && value in NOTIFICATION_CONFIGURE_ERROR_MESSAGES);
75
+ if (identifier !== undefined) {
76
+ return new Error(NOTIFICATION_CONFIGURE_ERROR_MESSAGES[identifier]);
77
+ }
78
+ }
79
+ return error instanceof Error ? error : new Error(String(error));
80
+ }
81
+ export async function withNotificationConfigureErrorTranslation(action) {
82
+ try {
83
+ return await action();
84
+ }
85
+ catch (error) {
86
+ throw translateNotificationConfigureError(error);
87
+ }
88
+ }
89
+ export async function configureNotification(input, gatewayCall = CicdGateway.call) {
90
+ const body = buildConfigureNotificationPayload(input);
91
+ if (body.destinationId.length === 0) {
92
+ throw new NotificationConfigureInputError('--destination-id cannot be empty.');
93
+ }
94
+ return gatewayCall({
95
+ body,
96
+ endpoint: NOTIFICATIONS_CONFIGURE_ENDPOINT,
97
+ headers: { 'Content-Type': 'application/json' },
98
+ method: 'POST',
99
+ });
100
+ }
101
+ //# sourceMappingURL=notifications-configure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notifications-configure.js","sourceRoot":"","sources":["../../src/lib/notifications-configure.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAA;AAE/D,MAAM,CAAC,MAAM,gCAAgC,GAAG,0BAA0B,CAAA;AAE1E,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,mBAAmB;IACnB,kBAAkB;IAClB,oBAAoB;IACpB,2BAA2B;IAC3B,gBAAgB;IAChB,eAAe;IACf,eAAe;IACf,qBAAqB;IACrB,iBAAiB;IACjB,qBAAqB;IACrB,cAAc;IACd,aAAa;IACb,gBAAgB;IAChB,kBAAkB;IAClB,sBAAsB;IACtB,qBAAqB;IACrB,wBAAwB;IACxB,0BAA0B;IAC1B,wBAAwB;IACxB,wBAAwB;IACxB,kCAAkC;IAClC,kCAAkC;IAClC,wBAAwB;IACxB,wBAAwB;IACxB,yBAAyB;IACzB,yBAAyB;CACjB,CAAA;AAEV,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAAC,MAAM,EAAE,SAAS,CAAU,CAAA;AAE1E,MAAM,CAAC,MAAM,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,mCAAmC,CAAC,CAAA;IAChF,CAAC;IAED,OAAO,WAAW,CAA8B;QAC9C,IAAI;QACJ,QAAQ,EAAE,gCAAgC;QAC1C,OAAO,EAAE,EAAC,cAAc,EAAE,kBAAkB,EAAC;QAC7C,MAAM,EAAE,MAAM;KACf,CAAC,CAAA;AACJ,CAAC"}
@@ -0,0 +1,67 @@
1
+ import { type SetupActionStatus, type SetupDeps } from './project-setup.js';
2
+ import { type SetupPrompts } from './setup-prompts.js';
3
+ export declare const SETUP_SKILL_MANAGED_MARKER = "<!-- Agentia managed skill file: agentia setup skills -->";
4
+ export declare const SETUP_SKILL_PACKS: readonly ["cicd", "testing", "ai"];
5
+ export type SetupSkillPack = (typeof SETUP_SKILL_PACKS)[number];
6
+ export declare const SETUP_SKILL_TARGETS: readonly ["agents", "cursor", "claude"];
7
+ export type SetupSkillTarget = (typeof SETUP_SKILL_TARGETS)[number];
8
+ export type SetupSkillsMode = 'create' | 'update';
9
+ export type SetupSkillFileResult = {
10
+ path: string;
11
+ status: SetupActionStatus;
12
+ };
13
+ export type SetupSkillPackResult = {
14
+ files: SetupSkillFileResult[];
15
+ pack: SetupSkillPack;
16
+ path: string;
17
+ skill: string;
18
+ status: SetupActionStatus;
19
+ };
20
+ export type SetupSkillsResult = {
21
+ cwd: string;
22
+ git?: {
23
+ branch: string;
24
+ remoteUrl?: string;
25
+ root: string;
26
+ };
27
+ mode: SetupSkillsMode;
28
+ projectRoot: string;
29
+ skillRoot: string;
30
+ skills: SetupSkillPackResult[];
31
+ target: SetupSkillTarget;
32
+ };
33
+ export type SetupSkillsOptions = {
34
+ cwd?: string;
35
+ force?: boolean;
36
+ log?: (message: string) => void;
37
+ mode: SetupSkillsMode;
38
+ noPrompt?: boolean;
39
+ packs?: SetupSkillPack[];
40
+ target?: SetupSkillTarget;
41
+ };
42
+ export type SetupSkillTemplateFile = {
43
+ content: string;
44
+ pack: SetupSkillPack;
45
+ relativePath: string;
46
+ };
47
+ export type SetupSkillsDeps = SetupDeps & {
48
+ mkdir?: (dirPath: string, options: {
49
+ recursive: true;
50
+ }) => Promise<unknown>;
51
+ readTemplateFile?: (relativePath: string) => Promise<string>;
52
+ templates?: SetupSkillTemplateFile[];
53
+ };
54
+ export declare function setSetupSkillsDepsForTests(deps: SetupSkillsDeps | undefined): void;
55
+ export declare function resetSetupSkillsDepsForTests(): void;
56
+ export declare function formatSetupSkillPack(pack: SetupSkillPack): string;
57
+ export declare function isSetupSkillPack(value: string): value is SetupSkillPack;
58
+ export declare function isSetupSkillTarget(value: string): value is SetupSkillTarget;
59
+ export declare function resolveSelectedSkillPacks(flags: Partial<Record<SetupSkillPack, boolean>>): SetupSkillPack[];
60
+ export declare function skillRootDirectory(target: SetupSkillTarget): string;
61
+ export declare function skillDirectoryForPack(pack: SetupSkillPack): string;
62
+ export declare function resolveSetupSkillTarget(options: {
63
+ noPrompt?: boolean;
64
+ prompts?: SetupPrompts;
65
+ target?: SetupSkillTarget;
66
+ }): Promise<SetupSkillTarget>;
67
+ export declare function runSetupSkills(options: SetupSkillsOptions, depsOverrides?: SetupSkillsDeps): Promise<SetupSkillsResult>;