@copado/agentia-cli 0.84.0-alpha.0 → 0.86.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.
- package/README.md +778 -161
- package/dist/commands/cicd/pipeline/connection/create.d.ts +19 -0
- package/dist/commands/cicd/pipeline/connection/create.js +67 -0
- package/dist/commands/cicd/pipeline/connection/create.js.map +1 -0
- package/dist/commands/cicd/pipeline/connection/delete.d.ts +15 -0
- package/dist/commands/cicd/pipeline/connection/delete.js +62 -0
- package/dist/commands/cicd/pipeline/connection/delete.js.map +1 -0
- package/dist/commands/cicd/pipeline/connection/open.d.ts +12 -0
- package/dist/commands/cicd/pipeline/connection/open.js +30 -0
- package/dist/commands/cicd/pipeline/connection/open.js.map +1 -0
- package/dist/commands/cicd/pipeline/connection/update.d.ts +19 -0
- package/dist/commands/cicd/pipeline/connection/update.js +55 -0
- package/dist/commands/cicd/pipeline/connection/update.js.map +1 -0
- package/dist/commands/cicd/pipeline/create.d.ts +19 -0
- package/dist/commands/cicd/pipeline/create.js +42 -0
- package/dist/commands/cicd/pipeline/create.js.map +1 -0
- package/dist/commands/cicd/pipeline/list.d.ts +3 -0
- package/dist/commands/cicd/pipeline/list.js +5 -3
- package/dist/commands/cicd/pipeline/list.js.map +1 -1
- package/dist/commands/cicd/pipeline/stage-connection/create.d.ts +12 -0
- package/dist/commands/cicd/pipeline/stage-connection/create.js +33 -0
- package/dist/commands/cicd/pipeline/stage-connection/create.js.map +1 -0
- package/dist/commands/cicd/pipeline/stage-connection/delete.d.ts +16 -0
- package/dist/commands/cicd/pipeline/stage-connection/delete.js +34 -0
- package/dist/commands/cicd/pipeline/stage-connection/delete.js.map +1 -0
- package/dist/commands/cicd/pipeline/stage-connection/list.d.ts +10 -0
- package/dist/commands/cicd/pipeline/stage-connection/list.js +37 -0
- package/dist/commands/cicd/pipeline/stage-connection/list.js.map +1 -0
- package/dist/commands/cicd/pipeline/stage-connection/open.d.ts +12 -0
- package/dist/commands/cicd/pipeline/stage-connection/open.js +16 -0
- package/dist/commands/cicd/pipeline/stage-connection/open.js.map +1 -0
- package/dist/commands/cicd/pipeline/stage-connection/update.d.ts +15 -0
- package/dist/commands/cicd/pipeline/stage-connection/update.js +38 -0
- package/dist/commands/cicd/pipeline/stage-connection/update.js.map +1 -0
- package/dist/commands/cicd/pipeline/update.d.ts +20 -0
- package/dist/commands/cicd/pipeline/update.js +52 -0
- package/dist/commands/cicd/pipeline/update.js.map +1 -0
- package/dist/commands/cicd/stage/create.d.ts +14 -0
- package/dist/commands/cicd/stage/create.js +28 -0
- package/dist/commands/cicd/stage/create.js.map +1 -0
- package/dist/commands/cicd/stage/delete.d.ts +14 -0
- package/dist/commands/cicd/stage/delete.js +28 -0
- package/dist/commands/cicd/stage/delete.js.map +1 -0
- package/dist/commands/cicd/stage/get.d.ts +10 -0
- package/dist/commands/cicd/stage/get.js +17 -0
- package/dist/commands/cicd/stage/get.js.map +1 -0
- package/dist/commands/cicd/stage/list.d.ts +12 -0
- package/dist/commands/cicd/stage/list.js +27 -0
- package/dist/commands/cicd/stage/list.js.map +1 -0
- package/dist/commands/cicd/stage/open.d.ts +12 -0
- package/dist/commands/cicd/stage/open.js +16 -0
- package/dist/commands/cicd/stage/open.js.map +1 -0
- package/dist/commands/cicd/stage/update.d.ts +14 -0
- package/dist/commands/cicd/stage/update.js +30 -0
- package/dist/commands/cicd/stage/update.js.map +1 -0
- package/dist/commands/setup/skills/create.d.ts +15 -0
- package/dist/commands/setup/skills/create.js +64 -0
- package/dist/commands/setup/skills/create.js.map +1 -0
- package/dist/commands/setup/skills/update.d.ts +15 -0
- package/dist/commands/setup/skills/update.js +64 -0
- package/dist/commands/setup/skills/update.js.map +1 -0
- package/dist/lib/mcp/tools.d.ts +134 -2
- package/dist/lib/mcp/tools.js +383 -5
- package/dist/lib/mcp/tools.js.map +1 -1
- package/dist/lib/navigation.d.ts +1 -1
- package/dist/lib/navigation.js +3 -0
- package/dist/lib/navigation.js.map +1 -1
- package/dist/lib/pipeline-connection-flags.d.ts +62 -0
- package/dist/lib/pipeline-connection-flags.js +309 -0
- package/dist/lib/pipeline-connection-flags.js.map +1 -0
- package/dist/lib/pipeline-flags.d.ts +74 -0
- package/dist/lib/pipeline-flags.js +154 -0
- package/dist/lib/pipeline-flags.js.map +1 -0
- package/dist/lib/pipeline-stage-connection-flags.d.ts +25 -0
- package/dist/lib/pipeline-stage-connection-flags.js +46 -0
- package/dist/lib/pipeline-stage-connection-flags.js.map +1 -0
- package/dist/lib/pipeline-types.d.ts +91 -2
- package/dist/lib/pipeline-types.js +51 -5
- package/dist/lib/pipeline-types.js.map +1 -1
- package/dist/lib/setup-skills.d.ts +67 -0
- package/dist/lib/setup-skills.js +251 -0
- package/dist/lib/setup-skills.js.map +1 -0
- package/dist/lib/stage-flags.d.ts +19 -0
- package/dist/lib/stage-flags.js +29 -0
- package/dist/lib/stage-flags.js.map +1 -0
- package/dist/lib/stage-types.d.ts +67 -0
- package/dist/lib/stage-types.js +69 -0
- package/dist/lib/stage-types.js.map +1 -0
- package/oclif.manifest.json +2017 -740
- package/package.json +9 -2
- package/templates/skills/agentia-ai/SKILL.md +34 -0
- package/templates/skills/agentia-ai/references/ai-agents.md +70 -0
- package/templates/skills/agentia-cicd/SKILL.md +41 -0
- package/templates/skills/agentia-cicd/references/data.md +65 -0
- package/templates/skills/agentia-cicd/references/environments-and-credentials.md +55 -0
- package/templates/skills/agentia-cicd/references/jobs.md +42 -0
- package/templates/skills/agentia-cicd/references/pipelines.md +63 -0
- package/templates/skills/agentia-cicd/references/promotions.md +58 -0
- package/templates/skills/agentia-cicd/references/work.md +84 -0
- package/templates/skills/agentia-testing/SKILL.md +34 -0
- package/templates/skills/agentia-testing/references/tests.md +65 -0
|
@@ -1,18 +1,35 @@
|
|
|
1
|
+
import type { PipelineStageConnection } from './stage-types.js';
|
|
1
2
|
import { type ListPaginationQuery, type PaginatedListResult } from './list-pagination.js';
|
|
3
|
+
export declare const PIPELINE_PLATFORMS: readonly ["Salesforce", "SFDX", "Heroku", "Mulesoft", "Marketing", "Other"];
|
|
4
|
+
export type PipelinePlatform = (typeof PIPELINE_PLATFORMS)[number];
|
|
5
|
+
export declare const PIPELINE_CALCULATE_BASED_ON_VALUES: readonly ["User Story", "Branch"];
|
|
6
|
+
export type PipelineCalculateBasedOn = (typeof PIPELINE_CALCULATE_BASED_ON_VALUES)[number];
|
|
7
|
+
export declare const PIPELINE_CONNECTION_SYNC_STATE_NEEDS_RECALCULATING = "Needs recalculating";
|
|
2
8
|
export type Pipeline = {
|
|
9
|
+
active?: boolean | null;
|
|
10
|
+
blockCommits?: boolean | null;
|
|
11
|
+
calculateBasedOn?: null | PipelineCalculateBasedOn;
|
|
12
|
+
enableSmartConflictResolution?: boolean | null;
|
|
13
|
+
gitRepositoryId?: null | string;
|
|
3
14
|
id?: null | string;
|
|
4
15
|
mainBranch?: null | string;
|
|
5
16
|
name?: null | string;
|
|
6
17
|
pipelineConnections?: PipelineConnection[];
|
|
18
|
+
platform?: null | PipelinePlatform;
|
|
7
19
|
};
|
|
8
20
|
export type PipelineConnection = {
|
|
9
21
|
branch?: null | string;
|
|
10
22
|
destinationBranch?: null | string;
|
|
11
23
|
destinationEnvironment?: Environment | null;
|
|
24
|
+
destinationEnvironmentId?: null | string;
|
|
12
25
|
id?: null | string;
|
|
13
26
|
name?: null | string;
|
|
14
27
|
pipelineId?: null | string;
|
|
15
28
|
sourceEnvironment?: Environment | null;
|
|
29
|
+
sourceEnvironmentId?: null | string;
|
|
30
|
+
stageConnectionId?: null | string;
|
|
31
|
+
syncMergeState?: null | string;
|
|
32
|
+
syncPullState?: null | string;
|
|
16
33
|
};
|
|
17
34
|
export type Environment = {
|
|
18
35
|
id?: string;
|
|
@@ -47,6 +64,53 @@ export type QualityGateRuleCondition = {
|
|
|
47
64
|
stage?: null | string;
|
|
48
65
|
status?: null | string;
|
|
49
66
|
};
|
|
67
|
+
export type PipelineSystemProperty = {
|
|
68
|
+
apiName?: null | string;
|
|
69
|
+
environmentId?: null | string;
|
|
70
|
+
isGlobal?: boolean;
|
|
71
|
+
isPublic?: boolean;
|
|
72
|
+
isSensitive?: boolean;
|
|
73
|
+
name?: null | string;
|
|
74
|
+
pipelineId?: null | string;
|
|
75
|
+
userId?: null | string;
|
|
76
|
+
value?: null | string;
|
|
77
|
+
};
|
|
78
|
+
export type PipelineMutationPayload = {
|
|
79
|
+
active?: boolean;
|
|
80
|
+
blockCommits?: boolean;
|
|
81
|
+
calculateBasedOn?: PipelineCalculateBasedOn;
|
|
82
|
+
enableSmartConflictResolution?: boolean;
|
|
83
|
+
gitRepositoryId?: string;
|
|
84
|
+
mainBranch?: string;
|
|
85
|
+
name?: string;
|
|
86
|
+
platform?: PipelinePlatform;
|
|
87
|
+
};
|
|
88
|
+
export type PipelineConnectionMutationPayload = {
|
|
89
|
+
branch: string;
|
|
90
|
+
destinationBranch?: string;
|
|
91
|
+
destinationEnvironmentId: string;
|
|
92
|
+
id?: string;
|
|
93
|
+
sourceEnvironmentId: string;
|
|
94
|
+
stageConnectionId?: string;
|
|
95
|
+
syncMergeState?: string;
|
|
96
|
+
syncPullState?: string;
|
|
97
|
+
};
|
|
98
|
+
export type PipelineConnectionUpdatePayload = {
|
|
99
|
+
branch?: string;
|
|
100
|
+
destinationBranch?: string;
|
|
101
|
+
destinationEnvironmentId?: string;
|
|
102
|
+
id: string;
|
|
103
|
+
sourceEnvironmentId?: string;
|
|
104
|
+
stageConnectionId?: string;
|
|
105
|
+
syncMergeState?: string;
|
|
106
|
+
syncPullState?: string;
|
|
107
|
+
};
|
|
108
|
+
export type PipelineConnectionBulkUpdatePayload = {
|
|
109
|
+
connections: PipelineConnectionUpdatePayload[];
|
|
110
|
+
};
|
|
111
|
+
export type PipelineConnectionBulkDeletePayload = {
|
|
112
|
+
connectionIds: string[];
|
|
113
|
+
};
|
|
50
114
|
export type PipelineListPage = {
|
|
51
115
|
currentPage?: number;
|
|
52
116
|
data?: Pipeline[];
|
|
@@ -61,29 +125,54 @@ export type PipelineListResponse = {
|
|
|
61
125
|
message?: string;
|
|
62
126
|
status?: string;
|
|
63
127
|
};
|
|
128
|
+
export type PipelineResponse = {
|
|
129
|
+
data?: Pipeline;
|
|
130
|
+
message?: string;
|
|
131
|
+
status?: string;
|
|
132
|
+
};
|
|
64
133
|
export type PipelineDescribe = {
|
|
134
|
+
active?: boolean | null;
|
|
65
135
|
automations?: AutomationRule[];
|
|
136
|
+
blockCommits?: boolean | null;
|
|
137
|
+
calculateBasedOn?: null | PipelineCalculateBasedOn;
|
|
66
138
|
connections?: PipelineConnection[];
|
|
67
|
-
|
|
139
|
+
enableSmartConflictResolution?: boolean | null;
|
|
140
|
+
gitRepositoryId?: null | string;
|
|
68
141
|
id?: null | string;
|
|
69
142
|
lastJobs?: JobExecution[];
|
|
70
143
|
mainBranch?: null | string;
|
|
71
144
|
name?: null | string;
|
|
145
|
+
platform?: null | PipelinePlatform;
|
|
72
146
|
qualityGates?: QualityGateRuleCondition[];
|
|
73
147
|
repository?: GitRepository | null;
|
|
148
|
+
stageConnections?: PipelineStageConnection[];
|
|
149
|
+
systemProperties?: PipelineSystemProperty[];
|
|
74
150
|
};
|
|
75
151
|
export type PipelineDescribeResponse = {
|
|
76
152
|
data?: PipelineDescribe;
|
|
77
153
|
message?: string;
|
|
78
154
|
status?: string;
|
|
79
155
|
};
|
|
80
|
-
export type
|
|
156
|
+
export type PipelineConnectionListResponse = {
|
|
157
|
+
data?: PipelineConnection[];
|
|
158
|
+
message?: string;
|
|
159
|
+
status?: string;
|
|
160
|
+
};
|
|
161
|
+
export type PipelineListFilters = ListPaginationQuery & {
|
|
162
|
+
active?: boolean;
|
|
163
|
+
name?: string;
|
|
164
|
+
platform?: PipelinePlatform;
|
|
165
|
+
};
|
|
81
166
|
export declare function pipelineListEndpoint(filters?: PipelineListFilters): string;
|
|
167
|
+
export declare function pipelineEndpoint(id: string): string;
|
|
82
168
|
export declare function pipelineDescribeEndpoint(id: string): string;
|
|
169
|
+
export declare function pipelineConnectionsEndpoint(pipelineId: string): string;
|
|
83
170
|
export declare function normalizePipelinesListPage(response: Pipeline[] | PipelineListResponse): PaginatedListResult<Pipeline>;
|
|
84
171
|
export declare function normalizePipelines(response: Pipeline[] | PipelineListResponse): Pipeline[];
|
|
172
|
+
export declare function normalizePipeline(response: Pipeline | PipelineResponse): Pipeline;
|
|
85
173
|
export declare function pipelineConnectionsFromPipelines(pipelines: Pipeline[]): PipelineConnection[];
|
|
86
174
|
export declare function normalizePipelineDescribe(response: PipelineDescribe | PipelineDescribeResponse): PipelineDescribe;
|
|
175
|
+
export declare function normalizePipelineConnections(response: PipelineConnection[] | PipelineConnectionListResponse): PipelineConnection[];
|
|
87
176
|
export declare function formatPipelineTable(pipelines: Pipeline[]): string;
|
|
88
177
|
export declare function formatPipelineConnectionTable(connections: PipelineConnection[]): string;
|
|
89
178
|
export declare function formatPipelineDetail(pipeline: PipelineDescribe): string;
|
|
@@ -1,14 +1,39 @@
|
|
|
1
1
|
import { cellValue, table } from './format.js';
|
|
2
2
|
import { appendListPaginationQueryParams, paginatedResultFromNestedData, } from './list-pagination.js';
|
|
3
3
|
import { preferSalesforceId } from './salesforce-id.js';
|
|
4
|
+
export const PIPELINE_PLATFORMS = [
|
|
5
|
+
'Salesforce',
|
|
6
|
+
'SFDX',
|
|
7
|
+
'Heroku',
|
|
8
|
+
'Mulesoft',
|
|
9
|
+
'Marketing',
|
|
10
|
+
'Other',
|
|
11
|
+
];
|
|
12
|
+
export const PIPELINE_CALCULATE_BASED_ON_VALUES = ['User Story', 'Branch'];
|
|
13
|
+
export const PIPELINE_CONNECTION_SYNC_STATE_NEEDS_RECALCULATING = 'Needs recalculating';
|
|
4
14
|
export function pipelineListEndpoint(filters = {}) {
|
|
5
15
|
const params = new URLSearchParams();
|
|
16
|
+
if (filters.name !== undefined) {
|
|
17
|
+
params.set('name', filters.name);
|
|
18
|
+
}
|
|
19
|
+
if (filters.active !== undefined) {
|
|
20
|
+
params.set('active', String(filters.active));
|
|
21
|
+
}
|
|
22
|
+
if (filters.platform !== undefined) {
|
|
23
|
+
params.set('platform', filters.platform);
|
|
24
|
+
}
|
|
6
25
|
appendListPaginationQueryParams(params, filters);
|
|
7
26
|
const query = params.toString();
|
|
8
27
|
return query.length > 0 ? `/corpus/pipelines?${query}` : '/corpus/pipelines';
|
|
9
28
|
}
|
|
29
|
+
export function pipelineEndpoint(id) {
|
|
30
|
+
return `/corpus/pipelines/${encodeURIComponent(preferSalesforceId(id))}`;
|
|
31
|
+
}
|
|
10
32
|
export function pipelineDescribeEndpoint(id) {
|
|
11
|
-
return
|
|
33
|
+
return `${pipelineEndpoint(id)}/describe`;
|
|
34
|
+
}
|
|
35
|
+
export function pipelineConnectionsEndpoint(pipelineId) {
|
|
36
|
+
return `${pipelineEndpoint(pipelineId)}/connections`;
|
|
12
37
|
}
|
|
13
38
|
export function normalizePipelinesListPage(response) {
|
|
14
39
|
return paginatedResultFromNestedData(response);
|
|
@@ -16,6 +41,12 @@ export function normalizePipelinesListPage(response) {
|
|
|
16
41
|
export function normalizePipelines(response) {
|
|
17
42
|
return normalizePipelinesListPage(response).data;
|
|
18
43
|
}
|
|
44
|
+
export function normalizePipeline(response) {
|
|
45
|
+
if ('data' in response && response.data !== undefined) {
|
|
46
|
+
return response.data;
|
|
47
|
+
}
|
|
48
|
+
return response;
|
|
49
|
+
}
|
|
19
50
|
export function pipelineConnectionsFromPipelines(pipelines) {
|
|
20
51
|
return pipelines.flatMap((pipeline) => pipeline.pipelineConnections ?? []);
|
|
21
52
|
}
|
|
@@ -25,17 +56,30 @@ export function normalizePipelineDescribe(response) {
|
|
|
25
56
|
}
|
|
26
57
|
return response;
|
|
27
58
|
}
|
|
59
|
+
export function normalizePipelineConnections(response) {
|
|
60
|
+
if (Array.isArray(response)) {
|
|
61
|
+
return response;
|
|
62
|
+
}
|
|
63
|
+
if ('data' in response && Array.isArray(response.data)) {
|
|
64
|
+
return response.data;
|
|
65
|
+
}
|
|
66
|
+
return [];
|
|
67
|
+
}
|
|
28
68
|
export function formatPipelineTable(pipelines) {
|
|
29
69
|
return table([
|
|
30
70
|
{ alias: 'ID', value: 'id' },
|
|
31
71
|
{ alias: 'NAME', value: 'name' },
|
|
32
72
|
{ alias: 'MAIN BRANCH', value: 'mainBranch' },
|
|
73
|
+
{ alias: 'PLATFORM', value: 'platform' },
|
|
74
|
+
{ alias: 'ACTIVE', value: 'active' },
|
|
33
75
|
{ alias: 'CONNECTIONS', value: 'connections' },
|
|
34
76
|
], pipelines.map((pipeline) => ({
|
|
77
|
+
active: cellValue(pipeline.active),
|
|
35
78
|
connections: cellValue(pipeline.pipelineConnections?.length ?? 0),
|
|
36
79
|
id: cellValue(pipeline.id),
|
|
37
80
|
mainBranch: cellValue(pipeline.mainBranch),
|
|
38
81
|
name: cellValue(pipeline.name),
|
|
82
|
+
platform: cellValue(pipeline.platform),
|
|
39
83
|
})));
|
|
40
84
|
}
|
|
41
85
|
export function formatPipelineConnectionTable(connections) {
|
|
@@ -50,11 +94,11 @@ export function formatPipelineConnectionTable(connections) {
|
|
|
50
94
|
], connections.map((connection) => ({
|
|
51
95
|
branch: cellValue(connection.branch),
|
|
52
96
|
destinationBranch: cellValue(connection.destinationBranch),
|
|
53
|
-
fromEnvironmentId: cellValue(connection.sourceEnvironment?.id),
|
|
97
|
+
fromEnvironmentId: cellValue(connection.sourceEnvironment?.id ?? connection.sourceEnvironmentId),
|
|
54
98
|
id: cellValue(connection.id),
|
|
55
99
|
name: cellValue(connection.name),
|
|
56
100
|
pipelineId: cellValue(connection.pipelineId),
|
|
57
|
-
toEnvironmentId: cellValue(connection.destinationEnvironment?.id),
|
|
101
|
+
toEnvironmentId: cellValue(connection.destinationEnvironment?.id ?? connection.destinationEnvironmentId),
|
|
58
102
|
})));
|
|
59
103
|
}
|
|
60
104
|
export function formatPipelineDetail(pipeline) {
|
|
@@ -62,9 +106,11 @@ export function formatPipelineDetail(pipeline) {
|
|
|
62
106
|
`ID: ${cellValue(pipeline.id)}`,
|
|
63
107
|
`Name: ${cellValue(pipeline.name)}`,
|
|
64
108
|
`Main Branch: ${cellValue(pipeline.mainBranch)}`,
|
|
65
|
-
`
|
|
109
|
+
`Platform: ${cellValue(pipeline.platform)}`,
|
|
110
|
+
`Active: ${cellValue(pipeline.active)}`,
|
|
111
|
+
`Repository ID: ${cellValue(pipeline.repository?.id ?? pipeline.gitRepositoryId)}`,
|
|
66
112
|
`Repository Name: ${cellValue(pipeline.repository?.name)}`,
|
|
67
|
-
`
|
|
113
|
+
`System Properties: ${cellValue(pipeline.systemProperties?.length ?? 0)}`,
|
|
68
114
|
`Connections: ${cellValue(pipeline.connections?.length ?? 0)}`,
|
|
69
115
|
`Last Jobs: ${cellValue(pipeline.lastJobs?.length ?? 0)}`,
|
|
70
116
|
].join('\n');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeline-types.js","sourceRoot":"","sources":["../../src/lib/pipeline-types.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pipeline-types.js","sourceRoot":"","sources":["../../src/lib/pipeline-types.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,KAAK,EAAC,MAAM,aAAa,CAAA;AAC5C,OAAO,EACL,+BAA+B,EAG/B,6BAA6B,GAC9B,MAAM,sBAAsB,CAAA;AAC7B,OAAO,EAAC,kBAAkB,EAAC,MAAM,oBAAoB,CAAA;AAErD,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,YAAY;IACZ,MAAM;IACN,QAAQ;IACR,UAAU;IACV,WAAW;IACX,OAAO;CACC,CAAA;AAIV,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAU,CAAA;AAInF,MAAM,CAAC,MAAM,kDAAkD,GAAG,qBAAqB,CAAA;AAoLvF,MAAM,UAAU,oBAAoB,CAAC,UAA+B,EAAE;IACpE,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAA;IA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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>;
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { mkdir, readFile, writeFile } from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { resolveProjectContext } from './project-setup.js';
|
|
6
|
+
export const SETUP_SKILL_MANAGED_MARKER = '<!-- Agentia managed skill file: agentia setup skills -->';
|
|
7
|
+
export const SETUP_SKILL_PACKS = ['cicd', 'testing', 'ai'];
|
|
8
|
+
export const SETUP_SKILL_TARGETS = ['agents', 'cursor', 'claude'];
|
|
9
|
+
const DEFAULT_TARGET = 'agents';
|
|
10
|
+
const TARGET_DIRS = {
|
|
11
|
+
agents: '.agents/skills',
|
|
12
|
+
claude: '.claude/skills',
|
|
13
|
+
cursor: '.cursor/skills',
|
|
14
|
+
};
|
|
15
|
+
const PACK_SKILL_DIRS = {
|
|
16
|
+
ai: 'agentia-ai',
|
|
17
|
+
cicd: 'agentia-cicd',
|
|
18
|
+
testing: 'agentia-testing',
|
|
19
|
+
};
|
|
20
|
+
const TEMPLATE_MANIFEST = [
|
|
21
|
+
{ pack: 'cicd', path: 'agentia-cicd/SKILL.md' },
|
|
22
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/work.md' },
|
|
23
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/promotions.md' },
|
|
24
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/jobs.md' },
|
|
25
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/environments-and-credentials.md' },
|
|
26
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/pipelines.md' },
|
|
27
|
+
{ pack: 'cicd', path: 'agentia-cicd/references/data.md' },
|
|
28
|
+
{ pack: 'testing', path: 'agentia-testing/SKILL.md' },
|
|
29
|
+
{ pack: 'testing', path: 'agentia-testing/references/tests.md' },
|
|
30
|
+
{ pack: 'ai', path: 'agentia-ai/SKILL.md' },
|
|
31
|
+
{ pack: 'ai', path: 'agentia-ai/references/ai-agents.md' },
|
|
32
|
+
];
|
|
33
|
+
let testDeps;
|
|
34
|
+
export function setSetupSkillsDepsForTests(deps) {
|
|
35
|
+
testDeps = deps;
|
|
36
|
+
}
|
|
37
|
+
export function resetSetupSkillsDepsForTests() {
|
|
38
|
+
testDeps = undefined;
|
|
39
|
+
}
|
|
40
|
+
function templatesRoot() {
|
|
41
|
+
return path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../templates/skills');
|
|
42
|
+
}
|
|
43
|
+
function resolveDeps(overrides = {}) {
|
|
44
|
+
const merged = { ...testDeps, ...overrides };
|
|
45
|
+
return {
|
|
46
|
+
existsSync: merged.existsSync ?? existsSync,
|
|
47
|
+
getCurrentBranch: merged.getCurrentBranch,
|
|
48
|
+
getGitRepoRoot: merged.getGitRepoRoot,
|
|
49
|
+
getRemoteUrl: merged.getRemoteUrl,
|
|
50
|
+
isInsideGitWorkTree: merged.isInsideGitWorkTree,
|
|
51
|
+
mkdir: merged.mkdir ?? ((dirPath, options) => mkdir(dirPath, options)),
|
|
52
|
+
prompts: merged.prompts,
|
|
53
|
+
readFile: merged.readFile ?? ((filePath, encoding) => readFile(filePath, encoding)),
|
|
54
|
+
readTemplateFile: merged.readTemplateFile ??
|
|
55
|
+
((relativePath) => readFile(path.join(templatesRoot(), relativePath), 'utf8')),
|
|
56
|
+
templates: merged.templates,
|
|
57
|
+
writeFile: merged.writeFile ?? ((filePath, contents, encoding) => writeFile(filePath, contents, encoding)),
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
export function formatSetupSkillPack(pack) {
|
|
61
|
+
if (pack === 'cicd') {
|
|
62
|
+
return 'CICD';
|
|
63
|
+
}
|
|
64
|
+
if (pack === 'ai') {
|
|
65
|
+
return 'AI';
|
|
66
|
+
}
|
|
67
|
+
return 'Testing';
|
|
68
|
+
}
|
|
69
|
+
export function isSetupSkillPack(value) {
|
|
70
|
+
return SETUP_SKILL_PACKS.includes(value);
|
|
71
|
+
}
|
|
72
|
+
export function isSetupSkillTarget(value) {
|
|
73
|
+
return SETUP_SKILL_TARGETS.includes(value);
|
|
74
|
+
}
|
|
75
|
+
export function resolveSelectedSkillPacks(flags) {
|
|
76
|
+
const selected = SETUP_SKILL_PACKS.filter((pack) => flags[pack] === true);
|
|
77
|
+
return selected.length > 0 ? selected : [...SETUP_SKILL_PACKS];
|
|
78
|
+
}
|
|
79
|
+
export function skillRootDirectory(target) {
|
|
80
|
+
return TARGET_DIRS[target];
|
|
81
|
+
}
|
|
82
|
+
export function skillDirectoryForPack(pack) {
|
|
83
|
+
return PACK_SKILL_DIRS[pack];
|
|
84
|
+
}
|
|
85
|
+
export async function resolveSetupSkillTarget(options) {
|
|
86
|
+
const { noPrompt = false, prompts, target } = options;
|
|
87
|
+
if (target !== undefined) {
|
|
88
|
+
return target;
|
|
89
|
+
}
|
|
90
|
+
if (noPrompt || prompts === undefined) {
|
|
91
|
+
return DEFAULT_TARGET;
|
|
92
|
+
}
|
|
93
|
+
return prompts.select({
|
|
94
|
+
choices: [
|
|
95
|
+
{ name: '.agents/skills (portable Agent Skills)', value: 'agents' },
|
|
96
|
+
{ name: '.cursor/skills (Cursor project skills)', value: 'cursor' },
|
|
97
|
+
{ name: '.claude/skills (Claude compatibility)', value: 'claude' },
|
|
98
|
+
],
|
|
99
|
+
default: DEFAULT_TARGET,
|
|
100
|
+
message: 'Where should Agentia skills be created?',
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
async function loadTemplates(deps) {
|
|
104
|
+
if (deps.templates !== undefined) {
|
|
105
|
+
return deps.templates;
|
|
106
|
+
}
|
|
107
|
+
return Promise.all(TEMPLATE_MANIFEST.map(async (entry) => ({
|
|
108
|
+
content: await deps.readTemplateFile(entry.path),
|
|
109
|
+
pack: entry.pack,
|
|
110
|
+
relativePath: entry.path,
|
|
111
|
+
})));
|
|
112
|
+
}
|
|
113
|
+
function containsManagedMarker(content) {
|
|
114
|
+
return content.includes(SETUP_SKILL_MANAGED_MARKER);
|
|
115
|
+
}
|
|
116
|
+
function summarizeStatus(files) {
|
|
117
|
+
if (files.some((file) => file.status === 'updated')) {
|
|
118
|
+
return 'updated';
|
|
119
|
+
}
|
|
120
|
+
if (files.some((file) => file.status === 'created')) {
|
|
121
|
+
return 'created';
|
|
122
|
+
}
|
|
123
|
+
if (files.some((file) => file.status === 'failed')) {
|
|
124
|
+
return 'failed';
|
|
125
|
+
}
|
|
126
|
+
if (files.some((file) => file.status === 'skipped')) {
|
|
127
|
+
return 'skipped';
|
|
128
|
+
}
|
|
129
|
+
return 'unchanged';
|
|
130
|
+
}
|
|
131
|
+
function relativeTo(cwd, filePath) {
|
|
132
|
+
return path.relative(cwd, filePath) || path.basename(filePath);
|
|
133
|
+
}
|
|
134
|
+
async function planWrites(params) {
|
|
135
|
+
const { deps, force, mode, projectRoot, selectedPacks, skillRoot, templates } = params;
|
|
136
|
+
const selected = new Set(selectedPacks);
|
|
137
|
+
const planned = await Promise.all(templates
|
|
138
|
+
.filter((entry) => selected.has(entry.pack))
|
|
139
|
+
.map(async (template) => {
|
|
140
|
+
const fullPath = path.join(projectRoot, skillRoot, template.relativePath);
|
|
141
|
+
const exists = deps.existsSync(fullPath);
|
|
142
|
+
const skill = template.relativePath.split('/')[0] ?? skillDirectoryForPack(template.pack);
|
|
143
|
+
if (!exists) {
|
|
144
|
+
return {
|
|
145
|
+
planned: {
|
|
146
|
+
content: template.content,
|
|
147
|
+
fullPath,
|
|
148
|
+
pack: template.pack,
|
|
149
|
+
relativePath: template.relativePath,
|
|
150
|
+
skill,
|
|
151
|
+
status: 'created',
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const current = await deps.readFile(fullPath, 'utf8');
|
|
156
|
+
const managed = containsManagedMarker(current);
|
|
157
|
+
if (!managed && !force) {
|
|
158
|
+
return { conflict: fullPath };
|
|
159
|
+
}
|
|
160
|
+
if (mode === 'create' && managed) {
|
|
161
|
+
return {
|
|
162
|
+
planned: {
|
|
163
|
+
content: template.content,
|
|
164
|
+
fullPath,
|
|
165
|
+
pack: template.pack,
|
|
166
|
+
relativePath: template.relativePath,
|
|
167
|
+
skill,
|
|
168
|
+
status: 'unchanged',
|
|
169
|
+
},
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
planned: {
|
|
174
|
+
content: template.content,
|
|
175
|
+
fullPath,
|
|
176
|
+
pack: template.pack,
|
|
177
|
+
relativePath: template.relativePath,
|
|
178
|
+
skill,
|
|
179
|
+
status: 'updated',
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}));
|
|
183
|
+
const conflicts = planned.flatMap((item) => (item.conflict === undefined ? [] : [item.conflict]));
|
|
184
|
+
if (conflicts.length > 0) {
|
|
185
|
+
throw new Error([
|
|
186
|
+
'Refusing to overwrite existing skill files that are not managed by Agentia.',
|
|
187
|
+
'Re-run with --force to replace these files:',
|
|
188
|
+
...conflicts.map((filePath) => `- ${filePath}`),
|
|
189
|
+
].join('\n'));
|
|
190
|
+
}
|
|
191
|
+
return planned.flatMap((item) => (item.planned === undefined ? [] : [item.planned]));
|
|
192
|
+
}
|
|
193
|
+
export async function runSetupSkills(options, depsOverrides = {}) {
|
|
194
|
+
const deps = resolveDeps(depsOverrides);
|
|
195
|
+
const cwd = options.cwd ?? process.cwd();
|
|
196
|
+
const selectedPacks = options.packs ?? [...SETUP_SKILL_PACKS];
|
|
197
|
+
const target = await resolveSetupSkillTarget({
|
|
198
|
+
noPrompt: options.noPrompt,
|
|
199
|
+
prompts: deps.prompts,
|
|
200
|
+
target: options.target,
|
|
201
|
+
});
|
|
202
|
+
const context = await resolveProjectContext(cwd, deps);
|
|
203
|
+
const skillRoot = skillRootDirectory(target);
|
|
204
|
+
const templates = await loadTemplates(deps);
|
|
205
|
+
const planned = await planWrites({
|
|
206
|
+
deps,
|
|
207
|
+
force: options.force === true,
|
|
208
|
+
mode: options.mode,
|
|
209
|
+
projectRoot: context.projectRoot,
|
|
210
|
+
selectedPacks,
|
|
211
|
+
skillRoot,
|
|
212
|
+
templates,
|
|
213
|
+
});
|
|
214
|
+
await Promise.all(planned
|
|
215
|
+
.filter((item) => item.status !== 'unchanged')
|
|
216
|
+
.map(async (item) => {
|
|
217
|
+
await deps.mkdir(path.dirname(item.fullPath), { recursive: true });
|
|
218
|
+
const content = item.content.endsWith('\n') ? item.content : `${item.content}\n`;
|
|
219
|
+
await deps.writeFile(item.fullPath, content, 'utf8');
|
|
220
|
+
}));
|
|
221
|
+
const skills = selectedPacks.map((pack) => {
|
|
222
|
+
const skill = skillDirectoryForPack(pack);
|
|
223
|
+
const files = planned
|
|
224
|
+
.filter((item) => item.pack === pack)
|
|
225
|
+
.map((item) => ({
|
|
226
|
+
path: relativeTo(cwd, item.fullPath),
|
|
227
|
+
status: item.status,
|
|
228
|
+
}));
|
|
229
|
+
return {
|
|
230
|
+
files,
|
|
231
|
+
pack,
|
|
232
|
+
path: relativeTo(cwd, path.join(context.projectRoot, skillRoot, skill)),
|
|
233
|
+
skill,
|
|
234
|
+
status: summarizeStatus(files),
|
|
235
|
+
};
|
|
236
|
+
});
|
|
237
|
+
options.log?.(`Agentia skills ${options.mode === 'create' ? 'created' : 'updated'} in ${relativeTo(cwd, path.join(context.projectRoot, skillRoot))}.`);
|
|
238
|
+
for (const entry of skills) {
|
|
239
|
+
options.log?.(`${formatSetupSkillPack(entry.pack)} skill ${entry.status}: ${entry.path}`);
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
cwd,
|
|
243
|
+
git: context.git,
|
|
244
|
+
mode: options.mode,
|
|
245
|
+
projectRoot: context.projectRoot,
|
|
246
|
+
skillRoot: relativeTo(cwd, path.join(context.projectRoot, skillRoot)),
|
|
247
|
+
skills,
|
|
248
|
+
target,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
//# sourceMappingURL=setup-skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-skills.js","sourceRoot":"","sources":["../../src/lib/setup-skills.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAA;AAClC,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,kBAAkB,CAAA;AAC3D,OAAO,IAAI,MAAM,WAAW,CAAA;AAC5B,OAAO,EAAC,aAAa,EAAC,MAAM,UAAU,CAAA;AAEtC,O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AAG,EAAE,IAAI,CAAC,QAAQ,CAAC;YACpC,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC,CAAC,CAAA;QAEL,OAAO;YACL,KAAK;YACL,IAAI;YACJ,IAAI,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YACvE,KAAK;YACL,MAAM,EAAE,eAAe,CAAC,KAAK,CAAC;SAC/B,CAAA;IACH,CAAC,CAAC,CAAA;IAEF,OAAO,CAAC,GAAG,EAAE,CACX,kBAAkB,OAAO,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,OAAO,UAAU,CAClF,GAAG,EACH,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAC1C,GAAG,CACL,CAAA;IAED,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,OAAO,CAAC,GAAG,EAAE,CAAC,GAAG,oBAAoB,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,KAAK,CAAC,MAAM,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC,CAAA;IAC3F,CAAC;IAED,OAAO;QACL,GAAG;QACH,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,SAAS,EAAE,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;QACrE,MAAM;QACN,MAAM;KACP,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type StageMutationPayload } from './stage-types.js';
|
|
2
|
+
export declare const stageMutationFlags: {
|
|
3
|
+
readonly 'meta-stage': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
4
|
+
readonly name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
5
|
+
};
|
|
6
|
+
export declare const stageCreateFlags: {
|
|
7
|
+
readonly 'meta-stage': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
readonly name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
export declare const stageUpdateFlags: {
|
|
11
|
+
readonly 'meta-stage': import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
12
|
+
readonly name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
13
|
+
};
|
|
14
|
+
export type StageMutationFlagValues = {
|
|
15
|
+
'meta-stage'?: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
};
|
|
18
|
+
export declare function buildStageMutationPayload(flags: StageMutationFlagValues): StageMutationPayload;
|
|
19
|
+
export declare function validateStagePayload(payload: StageMutationPayload, requireName?: boolean): string | undefined;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Flags } from '@oclif/core';
|
|
2
|
+
import { STAGE_META_STAGE_SUGGESTIONS } from './stage-types.js';
|
|
3
|
+
export const stageMutationFlags = {
|
|
4
|
+
'meta-stage': Flags.string({
|
|
5
|
+
description: `Meta stage (common values: ${STAGE_META_STAGE_SUGGESTIONS.join(', ')}; custom values are allowed)`,
|
|
6
|
+
}),
|
|
7
|
+
name: Flags.string({ description: 'Stage name' }),
|
|
8
|
+
};
|
|
9
|
+
export const stageCreateFlags = stageMutationFlags;
|
|
10
|
+
export const stageUpdateFlags = stageMutationFlags;
|
|
11
|
+
export function buildStageMutationPayload(flags) {
|
|
12
|
+
const payload = {};
|
|
13
|
+
if (flags.name !== undefined)
|
|
14
|
+
payload.name = flags.name;
|
|
15
|
+
if (flags['meta-stage'] !== undefined)
|
|
16
|
+
payload.metaStage = flags['meta-stage'];
|
|
17
|
+
return payload;
|
|
18
|
+
}
|
|
19
|
+
export function validateStagePayload(payload, requireName = false) {
|
|
20
|
+
if (requireName && (payload.name === undefined || payload.name.trim().length === 0)) {
|
|
21
|
+
return 'name is required.';
|
|
22
|
+
}
|
|
23
|
+
for (const [key, value] of Object.entries(payload)) {
|
|
24
|
+
if (value.trim().length === 0)
|
|
25
|
+
return `${key} value cannot be empty`;
|
|
26
|
+
}
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=stage-flags.js.map
|