@shortcut-cli/shortcut-cli 3.7.0 → 3.8.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 +137 -20
- package/build/bin/short-doc.js +155 -0
- package/build/bin/short-docs.js +51 -0
- package/build/bin/short-epic.js +75 -0
- package/build/bin/short.js +1 -1
- package/build/package.js +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,19 +8,20 @@ This is a community-driven command line interface for [Shortcut](https://shortcu
|
|
|
8
8
|
|
|
9
9
|
## Table of Contents
|
|
10
10
|
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
11
|
+
- [Usage & Commands](#usage)
|
|
12
|
+
- [Install](#install)
|
|
13
|
+
- [Search](#search)
|
|
14
|
+
- [Story](#story)
|
|
15
|
+
- [Story Creation](#story-creation)
|
|
16
|
+
- [Workspace](#workspace)
|
|
17
|
+
- [Members](#members)
|
|
18
|
+
- [Epics](#epics)
|
|
19
|
+
- [Docs](#docs)
|
|
20
|
+
- [Workflows](#workflows)
|
|
21
|
+
- [Projects](#projects)
|
|
22
|
+
- [API](#api)
|
|
23
|
+
- [Development](#development)
|
|
24
|
+
- [Acknowledgments](#acknowledgments)
|
|
24
25
|
|
|
25
26
|
## Usage
|
|
26
27
|
|
|
@@ -54,8 +55,8 @@ SHORTCUT_API_TOKEN=foobar short story 3300
|
|
|
54
55
|
|
|
55
56
|
To skip `short install` entirely, set the additional environment variables used for URL and mention-name substitutions:
|
|
56
57
|
|
|
57
|
-
-
|
|
58
|
-
-
|
|
58
|
+
- `SHORTCUT_URL_SLUG` – your workspace slug, e.g. `acme-co`
|
|
59
|
+
- `SHORTCUT_MENTION_NAME` – your personal mention name used in branches, e.g. `mike`
|
|
59
60
|
|
|
60
61
|
With these env vars in place you can run commands directly:
|
|
61
62
|
|
|
@@ -87,6 +88,8 @@ short story 3300
|
|
|
87
88
|
create create a story
|
|
88
89
|
workflows list workflows and their states
|
|
89
90
|
epics list epics and their states
|
|
91
|
+
docs list and search docs
|
|
92
|
+
doc view, create, update, or delete a doc
|
|
90
93
|
projects list or search projects
|
|
91
94
|
workspace list stories matching saved workspace query
|
|
92
95
|
api make a request to the Shortcut API
|
|
@@ -320,6 +323,29 @@ Comment: This is a comment
|
|
|
320
323
|
-h, --help output usage information
|
|
321
324
|
```
|
|
322
325
|
|
|
326
|
+
#### Epic Creation
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
Usage: short epic create [options]
|
|
330
|
+
|
|
331
|
+
create a new epic
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
Options:
|
|
335
|
+
|
|
336
|
+
-n, --name [text] Set name of epic, required
|
|
337
|
+
-d, --description [text] Set description of epic
|
|
338
|
+
-s, --state [name] Set state of epic (to do, in progress, done)
|
|
339
|
+
--deadline [date] Set deadline for epic (YYYY-MM-DD)
|
|
340
|
+
--planned-start [date] Set planned start date (YYYY-MM-DD)
|
|
341
|
+
-o, --owners [id|name] Set owners of epic, comma-separated
|
|
342
|
+
-T, --team [id|name] Set team of epic
|
|
343
|
+
-l, --label [id|name] Set labels of epic, comma-separated
|
|
344
|
+
-I, --idonly Print only ID of epic result
|
|
345
|
+
-O, --open Open epic in browser
|
|
346
|
+
-h, --help output usage information
|
|
347
|
+
```
|
|
348
|
+
|
|
323
349
|
#### Epic Output Formatting
|
|
324
350
|
|
|
325
351
|
Templating variables:
|
|
@@ -340,6 +366,97 @@ Templating variables:
|
|
|
340
366
|
%co Print completed status of epic
|
|
341
367
|
```
|
|
342
368
|
|
|
369
|
+
### Docs
|
|
370
|
+
|
|
371
|
+
```
|
|
372
|
+
Usage: short docs [options]
|
|
373
|
+
|
|
374
|
+
List and search Shortcut Docs. By default, lists all docs you have access to.
|
|
375
|
+
Use --title to search docs by title.
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
Options:
|
|
379
|
+
|
|
380
|
+
-a, --archived Search for archived docs (requires --title)
|
|
381
|
+
-m, --mine Search for docs created by me (requires --title)
|
|
382
|
+
-f, --following Search for docs I am following (requires --title)
|
|
383
|
+
-t, --title [text] Search docs by title (required for search filters)
|
|
384
|
+
-q, --quiet Print only doc output, no loading dialog
|
|
385
|
+
-I, --idonly Print only IDs of doc results
|
|
386
|
+
-h, --help output usage information
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
#### Doc View, Create, Update, Delete
|
|
390
|
+
|
|
391
|
+
```
|
|
392
|
+
Usage: short doc [command] [options]
|
|
393
|
+
|
|
394
|
+
view, create, or update a doc
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
Commands:
|
|
398
|
+
|
|
399
|
+
view [options] <id> view a doc by ID
|
|
400
|
+
create [options] create a new doc
|
|
401
|
+
update [options] <id> update an existing doc
|
|
402
|
+
delete [options] <id> delete a doc
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
View a doc:
|
|
406
|
+
|
|
407
|
+
```
|
|
408
|
+
Usage: short doc view <id> [options]
|
|
409
|
+
|
|
410
|
+
Options:
|
|
411
|
+
|
|
412
|
+
--html Include HTML content in output
|
|
413
|
+
-O, --open Open doc in browser
|
|
414
|
+
-q, --quiet Print only doc content, no metadata
|
|
415
|
+
-h, --help output usage information
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
You can also view a doc directly by ID: `short doc <uuid>`
|
|
419
|
+
|
|
420
|
+
Create a doc:
|
|
421
|
+
|
|
422
|
+
```
|
|
423
|
+
Usage: short doc create [options]
|
|
424
|
+
|
|
425
|
+
Options:
|
|
426
|
+
|
|
427
|
+
-t, --title <text> Set title of doc (required)
|
|
428
|
+
-c, --content <text> Set content of doc (required)
|
|
429
|
+
--markdown Treat content as markdown (default is HTML)
|
|
430
|
+
-I, --idonly Print only ID of doc result
|
|
431
|
+
-O, --open Open doc in browser
|
|
432
|
+
-h, --help output usage information
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Update a doc:
|
|
436
|
+
|
|
437
|
+
```
|
|
438
|
+
Usage: short doc update <id> [options]
|
|
439
|
+
|
|
440
|
+
Options:
|
|
441
|
+
|
|
442
|
+
-t, --title <text> Update title of doc
|
|
443
|
+
-c, --content <text> Update content of doc
|
|
444
|
+
--markdown Treat content as markdown (default is HTML)
|
|
445
|
+
-O, --open Open doc in browser
|
|
446
|
+
-h, --help output usage information
|
|
447
|
+
```
|
|
448
|
+
|
|
449
|
+
Delete a doc:
|
|
450
|
+
|
|
451
|
+
```
|
|
452
|
+
Usage: short doc delete <id> [options]
|
|
453
|
+
|
|
454
|
+
Options:
|
|
455
|
+
|
|
456
|
+
--confirm Confirm deletion (required)
|
|
457
|
+
-h, --help output usage information
|
|
458
|
+
```
|
|
459
|
+
|
|
343
460
|
### Workflows
|
|
344
461
|
|
|
345
462
|
```
|
|
@@ -409,11 +526,11 @@ npm start -- story 1234
|
|
|
409
526
|
|
|
410
527
|
## Acknowledgments
|
|
411
528
|
|
|
412
|
-
-
|
|
413
|
-
-
|
|
414
|
-
-
|
|
415
|
-
-
|
|
416
|
-
-
|
|
529
|
+
- [Repository for this code](https://github.com/shortcut-cli/shortcut-cli)
|
|
530
|
+
- [NPM registry for this code](https://www.npmjs.com/package/@shortcut-cli/shortcut-cli)
|
|
531
|
+
- [Shortcut API](https://shortcut.com/api/rest/v3)
|
|
532
|
+
- Official [@shortcut/client](https://github.com/useshortcut/shortcut-client-js)
|
|
533
|
+
- [joshbeckman](https://github.com/joshbeckman), [j-martin](https://github.com/j-martin), [joshmfrankel](https://github.com/joshmfrankel), and [ohe](https://github.com/ohe) who created and contributed to this project
|
|
417
534
|
|
|
418
535
|
## Contributors
|
|
419
536
|
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_client = require('../lib/client.js');
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let os = require("os");
|
|
8
|
+
os = require_rolldown_runtime.__toESM(os);
|
|
9
|
+
let child_process = require("child_process");
|
|
10
|
+
let chalk = require("chalk");
|
|
11
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
12
|
+
|
|
13
|
+
//#region src/bin/short-doc.ts
|
|
14
|
+
const spin = require_lib_spinner.default();
|
|
15
|
+
const log = console.log;
|
|
16
|
+
const program = commander.default.usage("[command] [options]").description("view, create, or update a doc");
|
|
17
|
+
program.command("view <id>").description("view a doc by ID").option("--html", "Include HTML content in output").option("-O, --open", "Open doc in browser").option("-q, --quiet", "Print only doc content, no metadata").action(viewDoc);
|
|
18
|
+
program.command("create").description("create a new doc").option("-t, --title <text>", "Set title of doc (required)").option("-c, --content <text>", "Set content of doc (required)").option("--markdown", "Treat content as markdown (default is HTML)").option("-I, --idonly", "Print only ID of doc result").option("-O, --open", "Open doc in browser").action(createDoc);
|
|
19
|
+
program.command("update <id>").description("update an existing doc").option("-t, --title <text>", "Update title of doc").option("-c, --content <text>", "Update content of doc").option("--markdown", "Treat content as markdown (default is HTML)").option("-O, --open", "Open doc in browser").action(updateDoc);
|
|
20
|
+
program.command("delete <id>").description("delete a doc").option("--confirm", "Confirm deletion without prompting").action(deleteDoc);
|
|
21
|
+
const args = process.argv.slice(2);
|
|
22
|
+
if (args.length > 0 && isUUID(args[0])) process.argv.splice(2, 0, "view");
|
|
23
|
+
program.parse(process.argv);
|
|
24
|
+
if (args.length === 0) {
|
|
25
|
+
program.outputHelp();
|
|
26
|
+
process.exit(1);
|
|
27
|
+
} else if (args.length > 0 && !isUUID(args[0])) {
|
|
28
|
+
if (![
|
|
29
|
+
"view",
|
|
30
|
+
"create",
|
|
31
|
+
"update",
|
|
32
|
+
"delete"
|
|
33
|
+
].includes(args[0]) && !args[0].startsWith("-")) {
|
|
34
|
+
console.error(`Error: Unknown command or invalid doc ID: ${args[0]}`);
|
|
35
|
+
console.error("Run \"short doc --help\" for usage information.");
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function isUUID(str) {
|
|
40
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(str);
|
|
41
|
+
}
|
|
42
|
+
async function viewDoc(id, options) {
|
|
43
|
+
if (!options.quiet) spin.start();
|
|
44
|
+
let doc;
|
|
45
|
+
try {
|
|
46
|
+
const params = {};
|
|
47
|
+
if (options.html) params.content_format = "html";
|
|
48
|
+
doc = await require_lib_client.default.getDoc(id, params).then((r) => r.data);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
if (!options.quiet) spin.stop(true);
|
|
51
|
+
log("Error fetching doc:", e.message || e);
|
|
52
|
+
process.exit(1);
|
|
53
|
+
}
|
|
54
|
+
if (!options.quiet) spin.stop(true);
|
|
55
|
+
if (options.quiet) log(doc.content_markdown || doc.content_html || "(No content)");
|
|
56
|
+
else printDoc(doc, options.html);
|
|
57
|
+
if (options.open) openURL(doc.app_url);
|
|
58
|
+
}
|
|
59
|
+
async function createDoc(options) {
|
|
60
|
+
if (!options.title) {
|
|
61
|
+
log("Must provide --title");
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
if (!options.content) {
|
|
65
|
+
log("Must provide --content");
|
|
66
|
+
process.exit(1);
|
|
67
|
+
}
|
|
68
|
+
if (!options.idonly) spin.start();
|
|
69
|
+
const docData = {
|
|
70
|
+
title: options.title,
|
|
71
|
+
content: options.content,
|
|
72
|
+
content_format: options.markdown ? "markdown" : "html"
|
|
73
|
+
};
|
|
74
|
+
let doc;
|
|
75
|
+
try {
|
|
76
|
+
const result = await require_lib_client.default.createDoc(docData);
|
|
77
|
+
doc = await require_lib_client.default.getDoc(result.data.id).then((r) => r.data);
|
|
78
|
+
} catch (e) {
|
|
79
|
+
if (!options.idonly) spin.stop(true);
|
|
80
|
+
log("Error creating doc:", e.message || e);
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
if (!options.idonly) spin.stop(true);
|
|
84
|
+
if (options.idonly) log(doc.id);
|
|
85
|
+
else {
|
|
86
|
+
log(chalk.default.green("Doc created successfully!"));
|
|
87
|
+
printDoc(doc);
|
|
88
|
+
}
|
|
89
|
+
if (options.open) openURL(doc.app_url);
|
|
90
|
+
}
|
|
91
|
+
async function updateDoc(id, options) {
|
|
92
|
+
if (!options.title && !options.content) {
|
|
93
|
+
log("Must provide --title and/or --content to update");
|
|
94
|
+
process.exit(1);
|
|
95
|
+
}
|
|
96
|
+
spin.start();
|
|
97
|
+
const docData = {};
|
|
98
|
+
if (options.title) docData.title = options.title;
|
|
99
|
+
if (options.content) {
|
|
100
|
+
docData.content = options.content;
|
|
101
|
+
docData.content_format = options.markdown ? "markdown" : "html";
|
|
102
|
+
}
|
|
103
|
+
let doc;
|
|
104
|
+
try {
|
|
105
|
+
doc = await require_lib_client.default.updateDoc(id, docData).then((r) => r.data);
|
|
106
|
+
} catch (e) {
|
|
107
|
+
spin.stop(true);
|
|
108
|
+
log("Error updating doc:", e.message || e);
|
|
109
|
+
process.exit(1);
|
|
110
|
+
}
|
|
111
|
+
spin.stop(true);
|
|
112
|
+
log(chalk.default.green("Doc updated successfully!"));
|
|
113
|
+
printDoc(doc);
|
|
114
|
+
if (options.open) openURL(doc.app_url);
|
|
115
|
+
}
|
|
116
|
+
async function deleteDoc(id, options) {
|
|
117
|
+
if (!options.confirm) {
|
|
118
|
+
log("Deletion requires --confirm flag");
|
|
119
|
+
log("Usage: short doc delete <id> --confirm");
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
spin.start();
|
|
123
|
+
try {
|
|
124
|
+
await require_lib_client.default.deleteDoc(id, {});
|
|
125
|
+
} catch (e) {
|
|
126
|
+
spin.stop(true);
|
|
127
|
+
log("Error deleting doc:", e.message || e);
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
spin.stop(true);
|
|
131
|
+
log(chalk.default.green(`Doc ${id} deleted successfully.`));
|
|
132
|
+
}
|
|
133
|
+
function printDoc(doc, includeHtml = false) {
|
|
134
|
+
log(chalk.default.blue.bold(doc.title || "(Untitled)"));
|
|
135
|
+
log(chalk.default.bold("ID:") + ` ${doc.id}`);
|
|
136
|
+
log(chalk.default.bold("URL:") + ` ${doc.app_url}`);
|
|
137
|
+
log(chalk.default.bold("Created:") + ` ${doc.created_at}`);
|
|
138
|
+
if (doc.created_at !== doc.updated_at) log(chalk.default.bold("Updated:") + ` ${doc.updated_at}`);
|
|
139
|
+
if (doc.archived) log(chalk.default.bold("Archived:") + ` ${doc.archived}`);
|
|
140
|
+
log();
|
|
141
|
+
if (doc.content_markdown) {
|
|
142
|
+
log(chalk.default.bold("Content (Markdown):"));
|
|
143
|
+
log(doc.content_markdown);
|
|
144
|
+
}
|
|
145
|
+
if (includeHtml && doc.content_html) {
|
|
146
|
+
log();
|
|
147
|
+
log(chalk.default.bold("Content (HTML):"));
|
|
148
|
+
log(doc.content_html);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
function openURL(url) {
|
|
152
|
+
(0, child_process.exec)(`${os.default.platform() === "darwin" ? "open" : "xdg-open"} '${url}'`);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
//#endregion
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_client = require('../lib/client.js');
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
|
|
8
|
+
//#region src/bin/short-docs.ts
|
|
9
|
+
const spin = require_lib_spinner.default("Loading docs... %s ");
|
|
10
|
+
const log = console.log;
|
|
11
|
+
const program = commander.default.description(`List and search Shortcut Docs. By default, lists all docs you have access to.
|
|
12
|
+
Use --title to search docs by title.`).usage("[options]").option("-a, --archived", "Search for archived docs (requires --title)").option("-m, --mine", "Search for docs created by me (requires --title)").option("-f, --following", "Search for docs I am following (requires --title)").option("-t, --title [text]", "Search docs by title (required for search filters)").option("-q, --quiet", "Print only doc output, no loading dialog").option("-I, --idonly", "Print only IDs of doc results").parse(process.argv);
|
|
13
|
+
const main = async () => {
|
|
14
|
+
if (!program.quiet) spin.start();
|
|
15
|
+
let docs = [];
|
|
16
|
+
try {
|
|
17
|
+
if (program.title) {
|
|
18
|
+
const searchParams = { title: program.title };
|
|
19
|
+
if (program.archived !== void 0) searchParams.archived = !!program.archived;
|
|
20
|
+
if (program.mine) searchParams.created_by_me = true;
|
|
21
|
+
if (program.following) searchParams.followed_by_me = true;
|
|
22
|
+
docs = (await require_lib_client.default.searchDocuments(searchParams)).data.data;
|
|
23
|
+
} else {
|
|
24
|
+
if (program.archived || program.mine || program.following) {
|
|
25
|
+
if (!program.quiet) spin.stop(true);
|
|
26
|
+
log("Note: --archived, --mine, and --following require --title for searching.");
|
|
27
|
+
log("Listing all docs instead...");
|
|
28
|
+
if (!program.quiet) spin.start();
|
|
29
|
+
}
|
|
30
|
+
docs = (await require_lib_client.default.listDocs()).data;
|
|
31
|
+
}
|
|
32
|
+
} catch (e) {
|
|
33
|
+
if (!program.quiet) spin.stop(true);
|
|
34
|
+
log("Error fetching docs:", e.message || e);
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
if (!program.quiet) spin.stop(true);
|
|
38
|
+
if (docs.length === 0) {
|
|
39
|
+
log("No docs found.");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
docs.forEach((doc) => printDoc(doc));
|
|
43
|
+
};
|
|
44
|
+
const printDoc = (doc) => {
|
|
45
|
+
if (program.idonly) return log(doc.id);
|
|
46
|
+
log(`${doc.id} ${doc.title || "(Untitled)"}`);
|
|
47
|
+
log(`\tURL: ${doc.app_url}`);
|
|
48
|
+
};
|
|
49
|
+
main();
|
|
50
|
+
|
|
51
|
+
//#endregion
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
+
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
|
+
const require_lib_configure = require('../lib/configure.js');
|
|
5
|
+
const require_lib_client = require('../lib/client.js');
|
|
6
|
+
const require_lib_stories = require('../lib/stories.js');
|
|
7
|
+
let commander = require("commander");
|
|
8
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
9
|
+
let child_process = require("child_process");
|
|
10
|
+
|
|
11
|
+
//#region src/bin/short-epic.ts
|
|
12
|
+
const config = require_lib_configure.loadConfig();
|
|
13
|
+
const spin = require_lib_spinner.default();
|
|
14
|
+
const log = console.log;
|
|
15
|
+
const program = commander.default.usage("[command] [options]").description("create or view epics");
|
|
16
|
+
program.command("create").description("create a new epic").option("-n, --name [text]", "Set name of epic, required", "").option("-d, --description [text]", "Set description of epic", "").option("-s, --state [name]", "Set state of epic (to do, in progress, done)", "").option("--deadline [date]", "Set deadline for epic (YYYY-MM-DD)", "").option("--planned-start [date]", "Set planned start date (YYYY-MM-DD)", "").option("-o, --owners [id|name]", "Set owners of epic, comma-separated", "").option("-T, --team [id|name]", "Set team of epic", "").option("-l, --label [id|name]", "Set labels of epic, comma-separated", "").option("-M, --milestone [id]", "Set milestone of epic (deprecated, use objectives)", "").option("-I, --idonly", "Print only ID of epic result").option("-O, --open", "Open epic in browser").action(createEpic);
|
|
17
|
+
program.parse(process.argv);
|
|
18
|
+
async function createEpic(options) {
|
|
19
|
+
const entities = await require_lib_stories.default.fetchEntities();
|
|
20
|
+
if (!options.idonly) spin.start();
|
|
21
|
+
const epicData = { name: options.name };
|
|
22
|
+
if (options.description) epicData.description = options.description;
|
|
23
|
+
if (options.state) {
|
|
24
|
+
const stateMap = {
|
|
25
|
+
todo: "to do",
|
|
26
|
+
"to do": "to do",
|
|
27
|
+
inprogress: "in progress",
|
|
28
|
+
"in progress": "in progress",
|
|
29
|
+
done: "done"
|
|
30
|
+
};
|
|
31
|
+
const mappedState = stateMap[options.state.toLowerCase().replace(/[^a-z]/g, "")] || stateMap[options.state.toLowerCase()];
|
|
32
|
+
if (mappedState) epicData.state = mappedState;
|
|
33
|
+
}
|
|
34
|
+
if (options.deadline) epicData.deadline = new Date(options.deadline).toISOString();
|
|
35
|
+
if (options.plannedStart) epicData.planned_start_date = new Date(options.plannedStart).toISOString();
|
|
36
|
+
if (options.owners) epicData.owner_ids = require_lib_stories.default.findOwnerIds(entities, options.owners);
|
|
37
|
+
if (options.team) {
|
|
38
|
+
const group = require_lib_stories.default.findGroup(entities, options.team);
|
|
39
|
+
if (group === null || group === void 0 ? void 0 : group.id) epicData.group_ids = [group.id];
|
|
40
|
+
}
|
|
41
|
+
if (options.label) epicData.labels = require_lib_stories.default.findLabelNames(entities, options.label);
|
|
42
|
+
if (options.milestone) epicData.milestone_id = parseInt(options.milestone, 10);
|
|
43
|
+
let epic;
|
|
44
|
+
if (!epicData.name) {
|
|
45
|
+
if (!options.idonly) spin.stop(true);
|
|
46
|
+
log("Must provide --name");
|
|
47
|
+
process.exit(1);
|
|
48
|
+
} else try {
|
|
49
|
+
epic = await require_lib_client.default.createEpic(epicData).then((r) => r.data);
|
|
50
|
+
} catch (e) {
|
|
51
|
+
if (!options.idonly) spin.stop(true);
|
|
52
|
+
log("Error creating epic:", e.message || e);
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
55
|
+
if (!options.idonly) spin.stop(true);
|
|
56
|
+
if (epic) if (options.idonly) log(epic.id);
|
|
57
|
+
else {
|
|
58
|
+
printEpic(epic);
|
|
59
|
+
if (options.open) (0, child_process.exec)(`open https://app.shortcut.com/${config.urlSlug}/epic/${epic.id}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function printEpic(epic) {
|
|
63
|
+
log(`#${epic.id} ${epic.name}`);
|
|
64
|
+
if (epic.description) log(`Description:\t${epic.description}`);
|
|
65
|
+
log(`State:\t\t${epic.state}`);
|
|
66
|
+
if (epic.milestone_id) log(`Milestone:\t${epic.milestone_id}`);
|
|
67
|
+
if (epic.deadline) log(`Deadline:\t${epic.deadline}`);
|
|
68
|
+
if (epic.planned_start_date) log(`Planned Start:\t${epic.planned_start_date}`);
|
|
69
|
+
if (epic.owner_ids && epic.owner_ids.length > 0) log(`Owners:\t\t${epic.owner_ids.join(", ")}`);
|
|
70
|
+
if (epic.group_ids && epic.group_ids.length > 0) log(`Teams:\t\t${epic.group_ids.join(", ")}`);
|
|
71
|
+
if (epic.labels && epic.labels.length > 0) log(`Labels:\t\t${epic.labels.map((l) => l.name).join(", ")}`);
|
|
72
|
+
log(`URL:\t\t${epic.app_url}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
//#endregion
|
package/build/bin/short.js
CHANGED
|
@@ -6,6 +6,6 @@ commander = require_rolldown_runtime.__toESM(commander);
|
|
|
6
6
|
|
|
7
7
|
//#region src/bin/short.ts
|
|
8
8
|
process.on("unhandledRejection", console.log);
|
|
9
|
-
commander.default.version(require_package.version).description(require_package.description).command("install [options]", "install and configure API access").command("search [options] [SEARCH OPERATORS]", "search stories with optional query").alias("s").command("find [options] [SEARCH OPERATORS]", "[DEPRECATED] search stories with optional query").command("story ID [options]", "view or manipulate stories").alias("st").command("create [options]", "create a story").alias("c").command("members [options]", "list members").alias("m").command("workflows [options]", "list workflows and their states").alias("wf").command("epics [options]", "list epics and their states").alias("e").command("projects [options]", "list projects and their states").alias("p").command("workspace [NAME] [options]", "list stories matching saved workspace query", { isDefault: true }).alias("w").command("api <path> [options]", "make a request to the Shortcut API").parse(process.argv);
|
|
9
|
+
commander.default.version(require_package.version).description(require_package.description).command("install [options]", "install and configure API access").command("search [options] [SEARCH OPERATORS]", "search stories with optional query").alias("s").command("find [options] [SEARCH OPERATORS]", "[DEPRECATED] search stories with optional query").command("story ID [options]", "view or manipulate stories").alias("st").command("create [options]", "create a story").alias("c").command("members [options]", "list members").alias("m").command("workflows [options]", "list workflows and their states").alias("wf").command("epics [options]", "list epics and their states").alias("e").command("epic [command] [options]", "create or view an epic").command("docs [options]", "list and search docs").alias("d").command("doc [command] [options]", "view, create, or update a doc").command("projects [options]", "list projects and their states").alias("p").command("workspace [NAME] [options]", "list stories matching saved workspace query", { isDefault: true }).alias("w").command("api <path> [options]", "make a request to the Shortcut API").parse(process.argv);
|
|
10
10
|
|
|
11
11
|
//#endregion
|
package/build/package.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shortcut-cli/shortcut-cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.8.0",
|
|
4
4
|
"description": "A community-driven command line tool for viewing, creating, and updating shortcut.com stories",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=16"
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
},
|
|
41
41
|
"homepage": "https://github.com/shortcut-cli/shortcut-cli",
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@shortcut/client": "^
|
|
43
|
+
"@shortcut/client": "^3.1.0",
|
|
44
44
|
"chalk": "^2.2.0",
|
|
45
45
|
"cli-spinner": "^0.2.10",
|
|
46
46
|
"commander": "^2.12.0",
|