@cyberismo/cli 0.0.1
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/LICENSE +702 -0
- package/bin/run +13 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +485 -0
- package/dist/index.js.map +1 -0
- package/dist/resource-type-parser.d.ts +40 -0
- package/dist/resource-type-parser.js +197 -0
- package/dist/resource-type-parser.js.map +1 -0
- package/package.json +37 -0
- package/src/index.ts +745 -0
- package/src/resource-type-parser.ts +223 -0
package/bin/run
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node --no-warnings=ExperimentalWarning
|
|
2
|
+
|
|
3
|
+
import program from '@cyberismo/cli';
|
|
4
|
+
import { updatePathWithVendorUtils } from '../../../scripts/install-vendor-utils.mjs';
|
|
5
|
+
|
|
6
|
+
updatePathWithVendorUtils();
|
|
7
|
+
|
|
8
|
+
process.removeAllListeners('warning');
|
|
9
|
+
|
|
10
|
+
program.parseAsync(process.argv).catch((error) => {
|
|
11
|
+
console.error(error.message);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
Cyberismo
|
|
4
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
7
|
+
the Free Software Foundation.
|
|
8
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
11
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
12
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
13
|
+
*/
|
|
14
|
+
import { Command } from 'commander';
|
|
15
|
+
declare const program: Command;
|
|
16
|
+
export default program;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,485 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
Cyberismo
|
|
4
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under
|
|
6
|
+
the terms of the GNU Affero General Public License version 3 as published by
|
|
7
|
+
the Free Software Foundation.
|
|
8
|
+
This program is distributed in the hope that it will be useful, but WITHOUT
|
|
9
|
+
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
|
10
|
+
FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
|
|
11
|
+
details. You should have received a copy of the GNU Affero General Public
|
|
12
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
13
|
+
*/
|
|
14
|
+
import { Argument, Command } from 'commander';
|
|
15
|
+
import confirm from '@inquirer/confirm';
|
|
16
|
+
import { Cmd, Commands, ExportFormats, } from '@cyberismocom/data-handler';
|
|
17
|
+
import { ResourceTypeParser as Parser } from './resource-type-parser.js';
|
|
18
|
+
import { startServer } from '@cyberismocom/backend';
|
|
19
|
+
// How many validation errors are shown when staring app, if any.
|
|
20
|
+
const VALIDATION_ERROR_ROW_LIMIT = 10;
|
|
21
|
+
// To avoid duplication, fetch description and version from package.json file.
|
|
22
|
+
// Importing dynamically allows filtering of warnings in cli/bin/run.
|
|
23
|
+
const packageDef = (await import('../package.json', { with: { type: 'json' } }))
|
|
24
|
+
.default;
|
|
25
|
+
// Truncates a multi-row message to an array of items.
|
|
26
|
+
// Logs maximum of 'limit' items to console. If there are more items than
|
|
27
|
+
// 'limit', the last element is replaced with "..." to indicate truncation.
|
|
28
|
+
// Returns the potentially truncated array.
|
|
29
|
+
function truncateMessage(messages, limit = VALIDATION_ERROR_ROW_LIMIT) {
|
|
30
|
+
const array = messages.split('\n');
|
|
31
|
+
if (array.length < limit) {
|
|
32
|
+
return [...array];
|
|
33
|
+
}
|
|
34
|
+
if (limit <= 0) {
|
|
35
|
+
return [];
|
|
36
|
+
}
|
|
37
|
+
if (limit === 1) {
|
|
38
|
+
return ['...'];
|
|
39
|
+
}
|
|
40
|
+
return [...array.slice(0, limit - 1), '...'];
|
|
41
|
+
}
|
|
42
|
+
// Handle the response object from data-handler
|
|
43
|
+
function handleResponse(response) {
|
|
44
|
+
if (response.statusCode === 200) {
|
|
45
|
+
if (response.payload) {
|
|
46
|
+
if (response.message) {
|
|
47
|
+
console.log(response.message);
|
|
48
|
+
}
|
|
49
|
+
console.log(JSON.stringify(response.payload, null, 2));
|
|
50
|
+
}
|
|
51
|
+
else if (response.message) {
|
|
52
|
+
console.log(response.message);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
console.log('Done');
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
if (response.message) {
|
|
60
|
+
program.error(response.message);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
// Commander
|
|
65
|
+
const program = new Command();
|
|
66
|
+
// CLI command handler
|
|
67
|
+
const commandHandler = new Commands();
|
|
68
|
+
// Ensure that all names have the same guideline.
|
|
69
|
+
const nameGuideline = 'Name can contain letters (a-z|A-Z), spaces, underscores or hyphens.';
|
|
70
|
+
const pathGuideline = 'Path to the project root. Mandatory if not running inside a project tree.';
|
|
71
|
+
const additionalHelpForCreate = `Sub-command help:
|
|
72
|
+
create attachment <cardKey> <filename>, where
|
|
73
|
+
<cardKey> is card key of a card to have the attachment,
|
|
74
|
+
<filename> is attachment filename.
|
|
75
|
+
|
|
76
|
+
create card <template> [cardKey], where
|
|
77
|
+
<template> Template to use. You can list the templates in a project with "show templates" command.
|
|
78
|
+
[cardKey] Parent card's card key. If defined, new card will be created as a child card to that card.
|
|
79
|
+
|
|
80
|
+
create cardType <name> <workflow>, where
|
|
81
|
+
<name> Name for cardType. ${nameGuideline}
|
|
82
|
+
<workflow> Workflow for the card type. You can list workflows in a project with "show workflows" command.
|
|
83
|
+
|
|
84
|
+
create fieldType <name> <dataType>, where
|
|
85
|
+
<name> Name for fieldType. ${nameGuideline}
|
|
86
|
+
<dataType> Type of field. You can list field types in a project with "show fieldTypes" command.
|
|
87
|
+
|
|
88
|
+
create graphModel <name>, where
|
|
89
|
+
<name> Name for graph model. ${nameGuideline}
|
|
90
|
+
|
|
91
|
+
create graphView <name>, where
|
|
92
|
+
<name> Name for graph view. ${nameGuideline}
|
|
93
|
+
|
|
94
|
+
create label <cardKey> <labelName>, where
|
|
95
|
+
<cardKey> Card key of the label
|
|
96
|
+
<labelName> Name for the new label
|
|
97
|
+
|
|
98
|
+
create link <source> <destination> <linkType> [description], where
|
|
99
|
+
<source> Source card key of the link
|
|
100
|
+
<destination> Destination card key of the link
|
|
101
|
+
<linkType> Link type to create
|
|
102
|
+
[description] Link description
|
|
103
|
+
|
|
104
|
+
create linkType <name>, where
|
|
105
|
+
<name> Name for linkType. ${nameGuideline}
|
|
106
|
+
|
|
107
|
+
create project <name> <prefix> <path>, where
|
|
108
|
+
<name> Name of the project.
|
|
109
|
+
<prefix> Prefix for the project.
|
|
110
|
+
<path> Path where to create the project
|
|
111
|
+
|
|
112
|
+
create report <name>, where
|
|
113
|
+
<name> Name for report. ${nameGuideline}
|
|
114
|
+
|
|
115
|
+
create template <name> [content], where
|
|
116
|
+
<name> Name for template. ${nameGuideline}
|
|
117
|
+
[content] If empty, template is created with default values. Template content must conform to schema "templateSchema.json"
|
|
118
|
+
|
|
119
|
+
create workflow <name> [content], where
|
|
120
|
+
<name> Name for workflow. ${nameGuideline}
|
|
121
|
+
[content] If empty, workflow is created with default values. Workflow content must conform to schema "workflowSchema.json"
|
|
122
|
+
|
|
123
|
+
create <resourceName> [content], where
|
|
124
|
+
<resourceName> Name of the resource (e.g. <prefix>/<type>/<identifier>)
|
|
125
|
+
[content] If empty, resource is created with default values. Content must conform to its resource schema.`;
|
|
126
|
+
const additionalHelpForRemove = `Sub-command help:
|
|
127
|
+
remove attachment <cardKey> <filename>, where
|
|
128
|
+
<cardKey> is card key of the owning card,
|
|
129
|
+
<filename> is attachment filename.
|
|
130
|
+
|
|
131
|
+
remove card <cardKey>, where
|
|
132
|
+
<cardKey> Card key of card to remove
|
|
133
|
+
|
|
134
|
+
remove label <cardKey> [label], where
|
|
135
|
+
<cardKey> Card key of the label
|
|
136
|
+
[label] Label being removed
|
|
137
|
+
|
|
138
|
+
remove link <source> <destination> <linkType>, where
|
|
139
|
+
<source> Source card key of the link
|
|
140
|
+
<destination> Destination card key of the link
|
|
141
|
+
<linkType> Link type to remove
|
|
142
|
+
|
|
143
|
+
remove module <name>, where
|
|
144
|
+
<name> Name of the module to remove
|
|
145
|
+
|
|
146
|
+
remove <resourceName>, where
|
|
147
|
+
<resourceName> is <project prefix>/<type>/<identifier>, where
|
|
148
|
+
<project prefix> Prefix for the project.
|
|
149
|
+
<type> is plural form of supported types; e.g. "workflows"
|
|
150
|
+
<identifier> name of a specific resource.
|
|
151
|
+
Note that you cannot remove resources from imported modules.`;
|
|
152
|
+
// Main CLI program.
|
|
153
|
+
program
|
|
154
|
+
.name('cyberismo')
|
|
155
|
+
.description(packageDef.description)
|
|
156
|
+
.version(packageDef.version);
|
|
157
|
+
// Add card to a template
|
|
158
|
+
program
|
|
159
|
+
.command('add')
|
|
160
|
+
.description('Add card to a template')
|
|
161
|
+
.argument('<template>', 'Template for a new card. \nYou can list the templates in a project with "show templates" command.')
|
|
162
|
+
.argument('<cardType>', 'Card type to use for the new card. \nYou can list the card types in a project with "show cardTypes" command.')
|
|
163
|
+
.argument('[cardKey]', "Parent card's card key")
|
|
164
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
165
|
+
.option('-r, --repeat <quantity>', 'Add multiple cards to a template')
|
|
166
|
+
.action(async (template, cardType, cardKey, options) => {
|
|
167
|
+
const result = await commandHandler.command(Cmd.add, [template, cardType, cardKey], options);
|
|
168
|
+
handleResponse(result);
|
|
169
|
+
});
|
|
170
|
+
const calculate = program
|
|
171
|
+
.command('calc')
|
|
172
|
+
.description('Used for running logic programs');
|
|
173
|
+
calculate
|
|
174
|
+
.command('generate')
|
|
175
|
+
.description('DEPRECATED: Generate a logic program')
|
|
176
|
+
.argument('[cardKey]', 'If given, calculates on the subtree of the card')
|
|
177
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
178
|
+
.action(async () => {
|
|
179
|
+
console.warn('This command is deprecated. Use "cyberismo calc run" directly instead.');
|
|
180
|
+
});
|
|
181
|
+
calculate
|
|
182
|
+
.command('run')
|
|
183
|
+
.description('Run a logic program')
|
|
184
|
+
.argument('<filePath>', 'Path to the logic program')
|
|
185
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
186
|
+
.action(async (filePath, options) => {
|
|
187
|
+
const result = await commandHandler.command(Cmd.calc, ['run', filePath], options);
|
|
188
|
+
handleResponse(result);
|
|
189
|
+
});
|
|
190
|
+
program
|
|
191
|
+
.command('create')
|
|
192
|
+
.argument('<type>', `types to create: '${Parser.listTargets('create').join("', '")}', or resource name (e.g. <prefix>/<type>/<identifier>)`, Parser.parseCreateTypes)
|
|
193
|
+
.argument('[target]', 'Name to create, or in some operations cardKey to create data to a specific card. See below')
|
|
194
|
+
.argument('[parameter1]', 'Depends on context; see below for specific remove operation')
|
|
195
|
+
.argument('[parameter2]', 'Depends on context; see below for specific remove operation')
|
|
196
|
+
.argument('[parameter3]', 'Depends on context; see below for specific remove operation')
|
|
197
|
+
.addHelpText('after', additionalHelpForCreate)
|
|
198
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
199
|
+
.action(async (type, target, parameter1, parameter2, parameter3, options) => {
|
|
200
|
+
if (!type) {
|
|
201
|
+
program.error(`missing required argument <type>`);
|
|
202
|
+
}
|
|
203
|
+
const resourceName = type.split('/').length === 3;
|
|
204
|
+
function nameOfFirstArgument(type) {
|
|
205
|
+
if (type === 'attachment' || type === 'label')
|
|
206
|
+
return 'cardKey';
|
|
207
|
+
if (type === 'card')
|
|
208
|
+
return 'template';
|
|
209
|
+
if (type === 'link')
|
|
210
|
+
return 'source';
|
|
211
|
+
return 'name';
|
|
212
|
+
}
|
|
213
|
+
function nameOfSecondArgument(type) {
|
|
214
|
+
if (type === 'attachment')
|
|
215
|
+
return 'fileName';
|
|
216
|
+
if (type === 'cardType')
|
|
217
|
+
return 'workflow';
|
|
218
|
+
if (type === 'fieldType')
|
|
219
|
+
return 'dataType';
|
|
220
|
+
if (type === 'label')
|
|
221
|
+
return 'labelName';
|
|
222
|
+
if (type === 'link')
|
|
223
|
+
return 'destination';
|
|
224
|
+
if (type === 'project')
|
|
225
|
+
return 'prefix';
|
|
226
|
+
return type;
|
|
227
|
+
}
|
|
228
|
+
if (!target && !resourceName) {
|
|
229
|
+
program.error(`missing required argument <${nameOfFirstArgument(type)}>`);
|
|
230
|
+
}
|
|
231
|
+
if (!resourceName &&
|
|
232
|
+
!parameter1 &&
|
|
233
|
+
type !== 'card' &&
|
|
234
|
+
type !== 'graphModel' &&
|
|
235
|
+
type !== 'graphView' &&
|
|
236
|
+
type !== 'linkType' &&
|
|
237
|
+
type !== 'report' &&
|
|
238
|
+
type !== 'template' &&
|
|
239
|
+
type !== 'workflow') {
|
|
240
|
+
program.error(`missing required argument <${nameOfSecondArgument(type)}>`);
|
|
241
|
+
}
|
|
242
|
+
if (resourceName &&
|
|
243
|
+
(type.includes('cardTypes') || type.includes('fieldTypes')) &&
|
|
244
|
+
!target) {
|
|
245
|
+
program.error(`missing required argument <${nameOfSecondArgument(type)}>`);
|
|
246
|
+
}
|
|
247
|
+
if (type === 'project') {
|
|
248
|
+
if (!parameter2) {
|
|
249
|
+
program.error(`missing required argument <path>`);
|
|
250
|
+
}
|
|
251
|
+
// Project path must be set to 'options' when creating a project.
|
|
252
|
+
options.projectPath = parameter2;
|
|
253
|
+
}
|
|
254
|
+
const result = await commandHandler.command(Cmd.create, [type, target, parameter1, parameter2, parameter3], options);
|
|
255
|
+
handleResponse(result);
|
|
256
|
+
});
|
|
257
|
+
// Edit command
|
|
258
|
+
program
|
|
259
|
+
.command('edit')
|
|
260
|
+
.description('Edit a card')
|
|
261
|
+
.argument('<cardKey>', 'Card key of card')
|
|
262
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
263
|
+
.action(async (cardKey, options) => {
|
|
264
|
+
const result = await commandHandler.command(Cmd.edit, [cardKey], options);
|
|
265
|
+
handleResponse(result);
|
|
266
|
+
});
|
|
267
|
+
// Export command
|
|
268
|
+
program
|
|
269
|
+
.command('export')
|
|
270
|
+
.description('Export a project or a card')
|
|
271
|
+
.addArgument(new Argument('<format>', 'Export format').choices(Object.values(ExportFormats)))
|
|
272
|
+
.argument('<output>', 'Output path')
|
|
273
|
+
.argument('[cardKey]', 'Path to a card. If defined will export only that card and its children instead of whole project.')
|
|
274
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
275
|
+
.action(async (format, output, cardKey, options) => {
|
|
276
|
+
const result = await commandHandler.command(Cmd.export, [format, output, cardKey], options);
|
|
277
|
+
handleResponse(result);
|
|
278
|
+
});
|
|
279
|
+
const importCmd = program.command('import');
|
|
280
|
+
// Import module
|
|
281
|
+
importCmd
|
|
282
|
+
.command('module')
|
|
283
|
+
.description('Imports another project to this project as a module. Source can be local relative file path, or git HTTPS URL.')
|
|
284
|
+
.argument('<source>', 'Path to import from')
|
|
285
|
+
.argument('[branch]', 'When using git URL defines the branch. Default: main')
|
|
286
|
+
.argument('[useCredentials]', 'When using git URL uses credentials for cloning. Default: false')
|
|
287
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
288
|
+
.action(async (source, branch, useCredentials, options) => {
|
|
289
|
+
const result = await commandHandler.command(Cmd.import, ['module', source, branch, String(useCredentials)], options);
|
|
290
|
+
handleResponse(result);
|
|
291
|
+
});
|
|
292
|
+
// import csv
|
|
293
|
+
importCmd
|
|
294
|
+
.command('csv')
|
|
295
|
+
.description('Imports cards from a csv file')
|
|
296
|
+
.argument('<csvFile>', 'File to import from')
|
|
297
|
+
.argument('[cardKey]', 'Card key of the parent. If defined, cards are created as children of this card')
|
|
298
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
299
|
+
.action(async (csvFile, cardKey, options) => {
|
|
300
|
+
const result = await commandHandler.command(Cmd.import, ['csv', csvFile, cardKey], options);
|
|
301
|
+
handleResponse(result);
|
|
302
|
+
});
|
|
303
|
+
// Move command
|
|
304
|
+
program
|
|
305
|
+
.command('move')
|
|
306
|
+
.description('Moves a card from root to under another card, from under another card to root, or from under a one card to another.')
|
|
307
|
+
.argument('[source]', 'Source Card key that needs to be moved')
|
|
308
|
+
.argument('[destination]', 'Destination Card key where "source" is moved to. If moving to root, use "root"')
|
|
309
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
310
|
+
.action(async (source, destination, options) => {
|
|
311
|
+
const result = await commandHandler.command(Cmd.move, [source, destination], options);
|
|
312
|
+
handleResponse(result);
|
|
313
|
+
});
|
|
314
|
+
const rank = program.command('rank');
|
|
315
|
+
rank
|
|
316
|
+
.command('card')
|
|
317
|
+
.description('Set the rank of a card. Ranks define the order in which cards are shown.')
|
|
318
|
+
.argument('<cardKey>', 'Card key of the card to be moved')
|
|
319
|
+
.argument('<afterCardKey>', 'Card key of the card that the card should be after. Use "first" to rank the card first.')
|
|
320
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
321
|
+
.action(async (cardKey, afterCardKey, options) => {
|
|
322
|
+
const result = await commandHandler.command(Cmd.rank, ['card', cardKey, afterCardKey], options);
|
|
323
|
+
handleResponse(result);
|
|
324
|
+
});
|
|
325
|
+
rank
|
|
326
|
+
.command('rebalance')
|
|
327
|
+
.description('Rebalance the rank of all cards in the project. Can be also used, if ranks do not exist')
|
|
328
|
+
.argument('[parentCardKey]', 'if null, rebalance the whole project, otherwise rebalance only the direct children of the card key')
|
|
329
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
330
|
+
.action(async (cardKey, options) => {
|
|
331
|
+
const result = await commandHandler.command(Cmd.rank, ['rebalance', cardKey], options);
|
|
332
|
+
handleResponse(result);
|
|
333
|
+
});
|
|
334
|
+
// Remove command
|
|
335
|
+
program
|
|
336
|
+
.command('remove')
|
|
337
|
+
.argument('<type>', `removable types: '${Parser.listTargets('remove').join("', '")}', or resource name (e.g. <prefix>/<type>/<identifier>)`, Parser.parseRemoveTypes)
|
|
338
|
+
.argument('[parameter1]', 'Depends on context; see below for specific remove operation')
|
|
339
|
+
.argument('[parameter2]', 'Depends on context; see below for specific remove operation')
|
|
340
|
+
.argument('[parameter3]', 'Depends on context; see below for specific remove operation')
|
|
341
|
+
.addHelpText('after', additionalHelpForRemove)
|
|
342
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
343
|
+
.action(async (type, parameter1, parameter2, parameter3, options) => {
|
|
344
|
+
if (type) {
|
|
345
|
+
if (!parameter1) {
|
|
346
|
+
if (type === 'attachment' || type === 'card' || type === 'label') {
|
|
347
|
+
program.error('error: missing argument <cardKey>');
|
|
348
|
+
}
|
|
349
|
+
else if (type === 'link') {
|
|
350
|
+
program.error('error: missing argument <source>');
|
|
351
|
+
}
|
|
352
|
+
else if (type === 'module') {
|
|
353
|
+
program.error('error: missing argument <moduleName>');
|
|
354
|
+
}
|
|
355
|
+
else {
|
|
356
|
+
if (Parser.listTargets('remove').includes(type)) {
|
|
357
|
+
program.error('error: missing argument <resourceName>');
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
if (!parameter2 && type === 'attachment') {
|
|
362
|
+
program.error('error: missing argument <filename>');
|
|
363
|
+
}
|
|
364
|
+
if (!parameter2 && type === 'link') {
|
|
365
|
+
program.error('error: missing argument <destination>');
|
|
366
|
+
}
|
|
367
|
+
if (!parameter3 && type === 'link') {
|
|
368
|
+
program.error('error: missing argument <linkType>');
|
|
369
|
+
}
|
|
370
|
+
const result = await commandHandler.command(Cmd.remove, [type, parameter1, parameter2, parameter3], options);
|
|
371
|
+
handleResponse(result);
|
|
372
|
+
}
|
|
373
|
+
});
|
|
374
|
+
// Rename command
|
|
375
|
+
program
|
|
376
|
+
.command('rename')
|
|
377
|
+
.description('Change project prefix and rename all the content with the new prefix')
|
|
378
|
+
.argument('<to>', 'New project prefix')
|
|
379
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
380
|
+
.action(async (to, options) => {
|
|
381
|
+
const result = await commandHandler.command(Cmd.rename, [to], options);
|
|
382
|
+
handleResponse(result);
|
|
383
|
+
});
|
|
384
|
+
// Report command
|
|
385
|
+
program
|
|
386
|
+
.command('report')
|
|
387
|
+
.description('Runs a report')
|
|
388
|
+
.argument('<parameters>', 'Path to parameters file. This file defines which report to run and what parameters to use.')
|
|
389
|
+
.argument('[output]', 'Optional output file; if omitted output will be directed to stdout')
|
|
390
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
391
|
+
.action(async (parameters, output, options) => {
|
|
392
|
+
const result = await commandHandler.command(Cmd.report, [parameters, output], options);
|
|
393
|
+
handleResponse(result);
|
|
394
|
+
});
|
|
395
|
+
// Show command
|
|
396
|
+
program
|
|
397
|
+
.command('show')
|
|
398
|
+
.description('Shows details from a project')
|
|
399
|
+
.argument('<type>', `details can be seen from: ${Parser.listTargets('show').join(', ')}`, Parser.parseShowTypes)
|
|
400
|
+
.argument('[typeDetail]', 'additional information about the requested type; for example a card key')
|
|
401
|
+
.option('-d --details', 'Certain types (such as cards) can have additional details')
|
|
402
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
403
|
+
.option('-u --show-use', 'Show where resource is used. Only used with resources, otherwise will be ignored.')
|
|
404
|
+
.action(async (type, typeDetail, options) => {
|
|
405
|
+
if (type !== '') {
|
|
406
|
+
const result = await commandHandler.command(Cmd.show, [type, typeDetail], options);
|
|
407
|
+
handleResponse(result);
|
|
408
|
+
}
|
|
409
|
+
});
|
|
410
|
+
// Transition command
|
|
411
|
+
program
|
|
412
|
+
.command('transition')
|
|
413
|
+
.description('Transition a card to the specified state')
|
|
414
|
+
.argument('<cardKey>', 'card key of a card')
|
|
415
|
+
.argument('<transition>', 'Workflow state transition that is done.\nYou can list the workflows in a project with "show workflows" command.\nYou can see the available transitions with "show workflow <name>" command.')
|
|
416
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
417
|
+
.action(async (cardKey, transition, options) => {
|
|
418
|
+
const result = await commandHandler.command(Cmd.transition, [cardKey, transition], options);
|
|
419
|
+
handleResponse(result);
|
|
420
|
+
});
|
|
421
|
+
// Update command
|
|
422
|
+
program
|
|
423
|
+
.command('update')
|
|
424
|
+
.description('Update resource details')
|
|
425
|
+
.argument('<resourceName>', 'Resource name')
|
|
426
|
+
.argument('<operation>', 'Type of change, either "add", "change", "rank" or "remove" ')
|
|
427
|
+
.argument('<key>', 'Detail to be changed')
|
|
428
|
+
.argument('<value>', 'Value for a detail')
|
|
429
|
+
.argument('[newValue]', 'When using "change" define new value for detail.\nWhen using "remove" provide optional replacement value for removed value')
|
|
430
|
+
.action(async (resourceName, key, operation, value, newValue, options) => {
|
|
431
|
+
const result = await commandHandler.command(Cmd.update, [resourceName, key, operation, value, newValue], options);
|
|
432
|
+
handleResponse(result);
|
|
433
|
+
});
|
|
434
|
+
// Updates all modules in the project.
|
|
435
|
+
program
|
|
436
|
+
.command('update-modules')
|
|
437
|
+
.description('Updates all imported modules with latest versions')
|
|
438
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
439
|
+
.action(async (options) => {
|
|
440
|
+
const result = await commandHandler.command(Cmd.updateModules, [], options);
|
|
441
|
+
handleResponse(result);
|
|
442
|
+
});
|
|
443
|
+
// Validate command
|
|
444
|
+
program
|
|
445
|
+
.command('validate')
|
|
446
|
+
.description('Validate project structure')
|
|
447
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
448
|
+
.action(async (options) => {
|
|
449
|
+
const result = await commandHandler.command(Cmd.validate, [], options);
|
|
450
|
+
handleResponse(result);
|
|
451
|
+
});
|
|
452
|
+
// Start app command.
|
|
453
|
+
// If there are validation errors, user is prompted to continue or not.
|
|
454
|
+
// There is 10 sec timeout on the prompt. If user does not reply, then
|
|
455
|
+
// it is assumed that validation errors do not matter and application
|
|
456
|
+
// start is resumed.
|
|
457
|
+
program
|
|
458
|
+
.command('app')
|
|
459
|
+
.description('Starts the cyberismo app, accessible with a web browser at http://localhost:3000')
|
|
460
|
+
.option('-p, --project-path [path]', `${pathGuideline}`)
|
|
461
|
+
.action(async (options) => {
|
|
462
|
+
// validate project
|
|
463
|
+
const result = await commandHandler.command(Cmd.validate, [], options);
|
|
464
|
+
if (!result.message) {
|
|
465
|
+
program.error('Expected validation result, but got none');
|
|
466
|
+
return;
|
|
467
|
+
}
|
|
468
|
+
if (result.message !== 'Project structure validated') {
|
|
469
|
+
truncateMessage(result.message).forEach((item) => console.error(item));
|
|
470
|
+
console.error('\n'); // The output looks nicer with one extra row.
|
|
471
|
+
result.message = '';
|
|
472
|
+
const userConfirmation = await confirm({
|
|
473
|
+
message: 'There are validation errors. Do you want to continue?',
|
|
474
|
+
}, { signal: AbortSignal.timeout(10000), clearPromptOnDone: true }).catch((error) => {
|
|
475
|
+
return error.name === 'AbortPromptError';
|
|
476
|
+
});
|
|
477
|
+
if (!userConfirmation) {
|
|
478
|
+
handleResponse(result);
|
|
479
|
+
return;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
startServer(await commandHandler.getProjectPath(options.projectPath));
|
|
483
|
+
});
|
|
484
|
+
export default program;
|
|
485
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;EAWE;AAEF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,EAEL,GAAG,EACH,QAAQ,EAC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AC,IAAI,CAAC,CAAC,CAAC,6CAA6C;QAClE,MAAM,CAAC,OAAO,GAAG,EAAE,CAAC;QACpB,MAAM,gBAAgB,GAAG,MAAM,OAAO,CACpC;YACE,OAAO,EAAE,uDAAuD;SACjE,EACD,EAAE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAChE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAChB,OAAO,KAAK,CAAC,IAAI,KAAK,kBAAkB,CAAC;QAC3C,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,cAAc,CAAC,MAAM,CAAC,CAAC;YACvB,OAAO;QACT,CAAC;IACH,CAAC;IACD,WAAW,CAAC,MAAM,cAAc,CAAC,cAAc,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;AACxE,CAAC,CAAC,CAAC;AAEL,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
Cyberismo
|
|
3
|
+
Copyright © Cyberismo Ltd and contributors 2024
|
|
4
|
+
|
|
5
|
+
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License version 3 as published by the Free Software Foundation.
|
|
6
|
+
|
|
7
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
|
|
8
|
+
|
|
9
|
+
You should have received a copy of the GNU Affero General Public
|
|
10
|
+
License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
11
|
+
*/
|
|
12
|
+
export declare class ResourceTypeParser {
|
|
13
|
+
private static parseTypes;
|
|
14
|
+
private static command;
|
|
15
|
+
private static parseCommandTypes;
|
|
16
|
+
/**
|
|
17
|
+
* Returns type targets related to 'command'.
|
|
18
|
+
* @param command command that targets need to be fetched to ('create', 'show', ...)
|
|
19
|
+
* @returns Array of type targets related to 'command'.
|
|
20
|
+
*/
|
|
21
|
+
static listTargets(command: string): string[];
|
|
22
|
+
/**
|
|
23
|
+
* Parses remove command.
|
|
24
|
+
* @param type Argument 'type' from a command.
|
|
25
|
+
* @returns 'type' if it is a valid value. Throws if not.
|
|
26
|
+
*/
|
|
27
|
+
static parseRemoveTypes(type: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Parses create command.
|
|
30
|
+
* @param type Argument 'type' from a command.
|
|
31
|
+
* @returns 'type' if it is a valid value. Throws if not.
|
|
32
|
+
*/
|
|
33
|
+
static parseCreateTypes(type: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Parses show command.
|
|
36
|
+
* @param type Argument 'type' from a command.
|
|
37
|
+
* @returns 'type' if it is a valid value. Throws if not.
|
|
38
|
+
*/
|
|
39
|
+
static parseShowTypes(type: string): string;
|
|
40
|
+
}
|