@shortcut-cli/shortcut-cli 3.6.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 +149 -18
- package/build/_virtual/rolldown_runtime.js +10 -6
- package/build/bin/short-api.js +7 -8
- package/build/bin/short-create.js +3 -2
- 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-epics.js +5 -4
- package/build/bin/short-install.js +6 -5
- package/build/bin/short-members.js +4 -2
- package/build/bin/short-projects.js +4 -2
- package/build/bin/short-search.js +2 -1
- package/build/bin/short-story.js +19 -13
- package/build/bin/short-workflows.js +4 -2
- package/build/bin/short-workspace.js +4 -5
- package/build/bin/short.js +3 -2
- package/build/lib/client.js +2 -3
- package/build/lib/configure.js +22 -8
- package/build/lib/spinner.js +1 -1
- package/build/lib/stories.js +9 -9
- package/build/package.js +1 -1
- package/package.json +8 -8
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
|
|
|
@@ -52,6 +53,20 @@ You may also provide a Shortcut API token via environment variable `SHORTCUT_API
|
|
|
52
53
|
SHORTCUT_API_TOKEN=foobar short story 3300
|
|
53
54
|
```
|
|
54
55
|
|
|
56
|
+
To skip `short install` entirely, set the additional environment variables used for URL and mention-name substitutions:
|
|
57
|
+
|
|
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`
|
|
60
|
+
|
|
61
|
+
With these env vars in place you can run commands directly:
|
|
62
|
+
|
|
63
|
+
```sh
|
|
64
|
+
SHORTCUT_API_TOKEN=foobar \
|
|
65
|
+
SHORTCUT_URL_SLUG=acme-co \
|
|
66
|
+
SHORTCUT_MENTION_NAME=mike \
|
|
67
|
+
short story 3300
|
|
68
|
+
```
|
|
69
|
+
|
|
55
70
|
```
|
|
56
71
|
Usage: short [options] [command]
|
|
57
72
|
|
|
@@ -73,6 +88,8 @@ SHORTCUT_API_TOKEN=foobar short story 3300
|
|
|
73
88
|
create create a story
|
|
74
89
|
workflows list workflows and their states
|
|
75
90
|
epics list epics and their states
|
|
91
|
+
docs list and search docs
|
|
92
|
+
doc view, create, update, or delete a doc
|
|
76
93
|
projects list or search projects
|
|
77
94
|
workspace list stories matching saved workspace query
|
|
78
95
|
api make a request to the Shortcut API
|
|
@@ -306,6 +323,29 @@ Comment: This is a comment
|
|
|
306
323
|
-h, --help output usage information
|
|
307
324
|
```
|
|
308
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
|
+
|
|
309
349
|
#### Epic Output Formatting
|
|
310
350
|
|
|
311
351
|
Templating variables:
|
|
@@ -326,6 +366,97 @@ Templating variables:
|
|
|
326
366
|
%co Print completed status of epic
|
|
327
367
|
```
|
|
328
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
|
+
|
|
329
460
|
### Workflows
|
|
330
461
|
|
|
331
462
|
```
|
|
@@ -395,11 +526,11 @@ npm start -- story 1234
|
|
|
395
526
|
|
|
396
527
|
## Acknowledgments
|
|
397
528
|
|
|
398
|
-
-
|
|
399
|
-
-
|
|
400
|
-
-
|
|
401
|
-
-
|
|
402
|
-
-
|
|
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
|
|
403
534
|
|
|
404
535
|
## Contributors
|
|
405
536
|
|
|
@@ -6,12 +6,16 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
8
|
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
15
19
|
}
|
|
16
20
|
return to;
|
|
17
21
|
};
|
package/build/bin/short-api.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
2
2
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
3
3
|
const require_lib_client = require('../lib/client.js');
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
let commander = require("commander");
|
|
5
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
6
|
+
let debug = require("debug");
|
|
7
|
+
debug = require_rolldown_runtime.__toESM(debug);
|
|
6
8
|
|
|
7
9
|
//#region src/bin/short-api.ts
|
|
8
10
|
const debug$1 = (0, debug.default)("short-api");
|
|
@@ -11,9 +13,7 @@ const logError = console.error;
|
|
|
11
13
|
const spin = require_lib_spinner.default();
|
|
12
14
|
const parseKeyVal = (input, separator = "=") => {
|
|
13
15
|
const parts = input.split(separator);
|
|
14
|
-
|
|
15
|
-
const value = parts.join(separator);
|
|
16
|
-
return [key, value];
|
|
16
|
+
return [parts.shift(), parts.join(separator)];
|
|
17
17
|
};
|
|
18
18
|
const collect = (val, memo) => {
|
|
19
19
|
memo.push(val);
|
|
@@ -52,12 +52,11 @@ const main = async () => {
|
|
|
52
52
|
method,
|
|
53
53
|
headers
|
|
54
54
|
};
|
|
55
|
-
|
|
55
|
+
if ([
|
|
56
56
|
"POST",
|
|
57
57
|
"PUT",
|
|
58
58
|
"PATCH"
|
|
59
|
-
]
|
|
60
|
-
if (bodyMethods.includes(method)) {
|
|
59
|
+
].includes(method)) {
|
|
61
60
|
requestOptions.body = params;
|
|
62
61
|
if (!headers["Content-Type"]) headers["Content-Type"] = "application/json";
|
|
63
62
|
} else requestOptions.query = params;
|
|
@@ -4,8 +4,9 @@ const require_lib_spinner = require('../lib/spinner.js');
|
|
|
4
4
|
const require_lib_configure = require('../lib/configure.js');
|
|
5
5
|
const require_lib_client = require('../lib/client.js');
|
|
6
6
|
const require_lib_stories = require('../lib/stories.js');
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
let commander = require("commander");
|
|
8
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
9
|
+
let child_process = require("child_process");
|
|
9
10
|
|
|
10
11
|
//#region src/bin/short-create.ts
|
|
11
12
|
const config = require_lib_configure.loadConfig();
|
|
@@ -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-epics.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
4
|
const require_lib_client = require('../lib/client.js');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let chalk = require("chalk");
|
|
8
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
7
9
|
|
|
8
10
|
//#region src/bin/short-epics.ts
|
|
9
11
|
const log = console.log;
|
|
@@ -28,8 +30,7 @@ const printItem = (epic) => {
|
|
|
28
30
|
if (epic.started) defaultFormat += `Started:\t%st\n`;
|
|
29
31
|
if (epic.completed) defaultFormat += `Completed:\t%co\n`;
|
|
30
32
|
if (program.detailed) defaultFormat += `Description:\t%d\n`;
|
|
31
|
-
|
|
32
|
-
log(format.replace(/%id/, chalk.default.bold(`${epic.id}`)).replace(/%t/, chalk.default.blue(`${epic.name}`)).replace(/%m/, `${epic.milestone_id || "_"}`).replace(/%s/, `${epic.state}`).replace(/%dl/, `${epic.deadline || "_"}`).replace(/%d/, `${epic.description}`).replace(/%p/, `${epic.stats.num_points}`).replace(/%ps/, `${epic.stats.num_points_started}`).replace(/%pd/, `${epic.stats.num_points_done}`).replace(/%c/, `${Math.round(epic.stats.num_points_done / (epic.stats.num_points || 1) * 100)}%`).replace(/%a/, `${epic.archived}`).replace(/%st/, `${epic.started_at}`).replace(/%co/, `${epic.completed_at}`));
|
|
33
|
+
log((program.format || defaultFormat).replace(/%id/, chalk.default.bold(`${epic.id}`)).replace(/%t/, chalk.default.blue(`${epic.name}`)).replace(/%m/, `${epic.milestone_id || "_"}`).replace(/%s/, `${epic.state}`).replace(/%dl/, `${epic.deadline || "_"}`).replace(/%d/, `${epic.description}`).replace(/%p/, `${epic.stats.num_points}`).replace(/%ps/, `${epic.stats.num_points_started}`).replace(/%pd/, `${epic.stats.num_points_done}`).replace(/%c/, `${Math.round(epic.stats.num_points_done / (epic.stats.num_points || 1) * 100)}%`).replace(/%a/, `${epic.archived}`).replace(/%st/, `${epic.started_at}`).replace(/%co/, `${epic.completed_at}`));
|
|
33
34
|
};
|
|
34
35
|
main();
|
|
35
36
|
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_configure = require('../lib/configure.js');
|
|
4
4
|
const require_package = require('../package.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let __shortcut_client = require("@shortcut/client");
|
|
8
|
+
let prompt = require("prompt");
|
|
9
|
+
prompt = require_rolldown_runtime.__toESM(prompt);
|
|
8
10
|
|
|
9
11
|
//#region src/bin/short-install.ts
|
|
10
12
|
const extant = require_lib_configure.loadCachedConfig();
|
|
@@ -31,8 +33,7 @@ const main = async () => {
|
|
|
31
33
|
if (err) return log(err);
|
|
32
34
|
const config = await enrichConfigWithMemberDetails(result);
|
|
33
35
|
log("Saving config...");
|
|
34
|
-
|
|
35
|
-
if (success) log("Saved config");
|
|
36
|
+
if (require_lib_configure.updateConfig(config)) log("Saved config");
|
|
36
37
|
else log("Error saving config");
|
|
37
38
|
});
|
|
38
39
|
} else if (extant.token) log("A configuration/token is already saved. To override, re-run with --force");
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
4
|
const require_lib_client = require('../lib/client.js');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let chalk = require("chalk");
|
|
8
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
7
9
|
|
|
8
10
|
//#region src/bin/short-members.ts
|
|
9
11
|
const spin = require_lib_spinner.default("Loading... %s ");
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
4
|
const require_lib_client = require('../lib/client.js');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let chalk = require("chalk");
|
|
8
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
7
9
|
|
|
8
10
|
//#region src/bin/short-projects.ts
|
|
9
11
|
const spin = require_lib_spinner.default();
|
|
@@ -3,7 +3,8 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
|
3
3
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
4
|
const require_lib_configure = require('../lib/configure.js');
|
|
5
5
|
const require_lib_stories = require('../lib/stories.js');
|
|
6
|
-
|
|
6
|
+
let commander = require("commander");
|
|
7
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
8
|
|
|
8
9
|
//#region src/bin/short-search.ts
|
|
9
10
|
var _process$argv$;
|
package/build/bin/short-story.js
CHANGED
|
@@ -4,14 +4,21 @@ const require_lib_spinner = require('../lib/spinner.js');
|
|
|
4
4
|
const require_lib_configure = require('../lib/configure.js');
|
|
5
5
|
const require_lib_client = require('../lib/client.js');
|
|
6
6
|
const require_lib_stories = require('../lib/stories.js');
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
let commander = require("commander");
|
|
8
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
9
|
+
let debug = require("debug");
|
|
10
|
+
debug = require_rolldown_runtime.__toESM(debug);
|
|
11
|
+
let path = require("path");
|
|
12
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
13
|
+
let fs = require("fs");
|
|
14
|
+
fs = require_rolldown_runtime.__toESM(fs);
|
|
15
|
+
let os = require("os");
|
|
16
|
+
os = require_rolldown_runtime.__toESM(os);
|
|
17
|
+
let child_process = require("child_process");
|
|
18
|
+
let chalk = require("chalk");
|
|
19
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
20
|
+
let https = require("https");
|
|
21
|
+
https = require_rolldown_runtime.__toESM(https);
|
|
15
22
|
|
|
16
23
|
//#region src/bin/short-story.ts
|
|
17
24
|
const config = require_lib_configure.loadConfig();
|
|
@@ -19,7 +26,7 @@ const spin = require_lib_spinner.default();
|
|
|
19
26
|
const log = console.log;
|
|
20
27
|
const logError = console.error;
|
|
21
28
|
const debug$1 = (0, debug.default)("short");
|
|
22
|
-
const program = commander.default.usage("[options] <id>").description("Update and/or display story details").option("-a, --archived", "Update story as archived").option("-c, --comment [text]", "Add comment to story", "").option("-d, --description [text]", "Update description of story", "").option("-D, --download", "Download all attached files", "").option("--download-dir [path]", "Directory to download files to", ".").option("-e, --estimate [number]", "Update estimate of story", "").option("--epic [id|name]", "Set epic of story").option("-i, --iteration [id|name]", "Set iteration of story").option("-f, --format [template]", "Format the story output by template", "").option("--from-git", "Fetch story parsed by ID from current git branch").option("--git-branch", "Checkout git branch from story slug <mention-name>/ch<id>/<type>-<title>\n as required by the Git integration: https://bit.ly/2RKO1FF").option("--git-branch-short", "Checkout git branch from story slug <mention-name>/ch<id>/<title>").option("-I, --idonly", "Print only ID of story results", "").option("-l, --label [id|name]", "Stories with label id/name, by regex", "").option("--move-after [id]", "Move story to position below story ID").option("--move-before [id]", "Move story to position above story ID").option("--move-down [n]", "Move story position downward by n stories").option("--move-up [n]", "Move story position upward by n stories").option("-o, --owners [id|name]", "Update owners of story, comma-separated", "").option("-O, --open", "Open story in browser").option("--oe, --open-epic", "Open story's epic in browser").option("--oi, --open-iteration", "Open story's iteration in browser").option("--op, --open-project", "Open story's project in browser").option("-q, --quiet", "Print only story output, no loading dialog", "").option("-s, --state [id|name]", "Update workflow state of story", "").option("-t, --title [text]", "Update title/name of story", "").option("--task [text]", "Create new task on story").option("--task-complete [text]", "Toggle completion of task on story matching text").option("-y, --type [name]", "Update type of story", "").parse(process.argv);
|
|
29
|
+
const program = commander.default.usage("[options] <id>").description("Update and/or display story details").option("-a, --archived", "Update story as archived").option("-c, --comment [text]", "Add comment to story", "").option("-d, --description [text]", "Update description of story", "").option("-D, --download", "Download all attached files", "").option("--download-dir [path]", "Directory to download files to", ".").option("-e, --estimate [number]", "Update estimate of story", "").option("--epic [id|name]", "Set epic of story").option("-i, --iteration [id|name]", "Set iteration of story").option("-f, --format [template]", "Format the story output by template", "").option("--from-git", "Fetch story parsed by ID from current git branch").option("--git-branch", "Checkout git branch from story slug <mention-name>/ch<id>/<type>-<title>\n as required by the Git integration: https://bit.ly/2RKO1FF").option("--git-branch-short", "Checkout git branch from story slug <mention-name>/ch<id>/<title>").option("-I, --idonly", "Print only ID of story results", "").option("-l, --label [id|name]", "Stories with label id/name, by regex", "").option("--move-after [id]", "Move story to position below story ID").option("--move-before [id]", "Move story to position above story ID").option("--move-down [n]", "Move story position downward by n stories").option("--move-up [n]", "Move story position upward by n stories").option("-o, --owners [id|name]", "Update owners of story, comma-separated", "").option("-O, --open", "Open story in browser").option("--oe, --open-epic", "Open story's epic in browser").option("--oi, --open-iteration", "Open story's iteration in browser").option("--op, --open-project", "Open story's project in browser").option("-q, --quiet", "Print only story output, no loading dialog", "").option("-s, --state [id|name]", "Update workflow state of story", "").option("-t, --title [text]", "Update title/name of story", "").option("-T, --team [id|name]", "Update team/group of story", "").option("--task [text]", "Create new task on story").option("--task-complete [text]", "Toggle completion of task on story matching text").option("-y, --type [name]", "Update type of story", "").parse(process.argv);
|
|
23
30
|
const main = async () => {
|
|
24
31
|
const entities = await require_lib_stories.default.fetchEntities();
|
|
25
32
|
if (!(program.idonly || program.quiet)) spin.start();
|
|
@@ -42,6 +49,7 @@ const main = async () => {
|
|
|
42
49
|
if (program.epic) update.epic_id = (require_lib_stories.default.findEpic(entities, program.epic) || {}).id;
|
|
43
50
|
if (program.iteration) update.iteration_id = (require_lib_stories.default.findIteration(entities, program.iteration) || {}).id;
|
|
44
51
|
if (program.label) update.labels = require_lib_stories.default.findLabelNames(entities, program.label);
|
|
52
|
+
if (program.team) update.group_id = (require_lib_stories.default.findGroup(entities, program.team) || {}).id;
|
|
45
53
|
const hasPositionUpdate = program.moveAfter !== void 0 || program.moveBefore !== void 0 || program.moveDown !== void 0 || program.moveUp !== void 0;
|
|
46
54
|
const hasUpdate = Object.keys(update).length > 0 || hasPositionUpdate;
|
|
47
55
|
debug$1("constructed story update", update);
|
|
@@ -65,8 +73,7 @@ const main = async () => {
|
|
|
65
73
|
process.exit(2);
|
|
66
74
|
}
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
argIDs.concat(gitID).map(async (_id) => {
|
|
76
|
+
program.args.map((a) => (a.match(/\d+/) || [])[0]).concat(gitID).map(async (_id) => {
|
|
70
77
|
const id = parseInt(_id, 10);
|
|
71
78
|
let story;
|
|
72
79
|
try {
|
|
@@ -181,8 +188,7 @@ const main = async () => {
|
|
|
181
188
|
stopSpinner();
|
|
182
189
|
};
|
|
183
190
|
const openURL = (url) => {
|
|
184
|
-
|
|
185
|
-
(0, child_process.execSync)(`${open} '${url}'`);
|
|
191
|
+
(0, child_process.execSync)(`${os.default.platform() === "darwin" ? "open" : "xdg-open"} '${url}'`);
|
|
186
192
|
};
|
|
187
193
|
const stopSpinner = () => {
|
|
188
194
|
if (!(program.idonly || program.quiet)) spin.stop(true);
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_spinner = require('../lib/spinner.js');
|
|
4
4
|
const require_lib_client = require('../lib/client.js');
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
let commander = require("commander");
|
|
6
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
|
+
let chalk = require("chalk");
|
|
8
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
7
9
|
|
|
8
10
|
//#region src/bin/short-workflows.ts
|
|
9
11
|
const spin = require_lib_spinner.default();
|
|
@@ -3,7 +3,8 @@ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
|
3
3
|
const require_lib_configure = require('../lib/configure.js');
|
|
4
4
|
const require_lib_stories = require('../lib/stories.js');
|
|
5
5
|
const require_bin_short_search = require('./short-search.js');
|
|
6
|
-
|
|
6
|
+
let commander = require("commander");
|
|
7
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
7
8
|
|
|
8
9
|
//#region src/bin/short-workspace.ts
|
|
9
10
|
const config = require_lib_configure.default.loadConfig();
|
|
@@ -27,8 +28,7 @@ const main = async () => {
|
|
|
27
28
|
});
|
|
28
29
|
return;
|
|
29
30
|
} else if (program$1.unset) {
|
|
30
|
-
|
|
31
|
-
if (success) log("Successfully removed %s workspace", program$1.unset);
|
|
31
|
+
if (require_lib_configure.default.removeWorkspace(program$1.unset)) log("Successfully removed %s workspace", program$1.unset);
|
|
32
32
|
else log("Failed to remove %s workspace", program$1.unset);
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
@@ -42,8 +42,7 @@ const main = async () => {
|
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
44
|
const found = require_bin_short_search.program.parse(process.argv);
|
|
45
|
-
const
|
|
46
|
-
const additionalArgs = findOpts.reduce((acc, val) => {
|
|
45
|
+
const additionalArgs = found.options.map((o) => o.name()).reduce((acc, val) => {
|
|
47
46
|
acc[val] = found[val] || acc[val] || found[val];
|
|
48
47
|
return acc;
|
|
49
48
|
}, workspace);
|
package/build/bin/short.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_package = require('../package.js');
|
|
4
|
-
|
|
4
|
+
let commander = require("commander");
|
|
5
|
+
commander = require_rolldown_runtime.__toESM(commander);
|
|
5
6
|
|
|
6
7
|
//#region src/bin/short.ts
|
|
7
8
|
process.on("unhandledRejection", console.log);
|
|
8
|
-
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);
|
|
9
10
|
|
|
10
11
|
//#endregion
|
package/build/lib/client.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_configure = require('./configure.js');
|
|
4
|
-
|
|
4
|
+
let __shortcut_client = require("@shortcut/client");
|
|
5
5
|
|
|
6
6
|
//#region src/lib/client.ts
|
|
7
|
-
const
|
|
8
|
-
const client = new __shortcut_client.ShortcutClient(config.token);
|
|
7
|
+
const client = new __shortcut_client.ShortcutClient(require_lib_configure.loadConfig().token);
|
|
9
8
|
var client_default = client;
|
|
10
9
|
|
|
11
10
|
//#endregion
|
package/build/lib/configure.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
let path = require("path");
|
|
4
|
+
path = require_rolldown_runtime.__toESM(path);
|
|
5
|
+
let fs = require("fs");
|
|
6
|
+
fs = require_rolldown_runtime.__toESM(fs);
|
|
7
|
+
let os = require("os");
|
|
8
|
+
os = require_rolldown_runtime.__toESM(os);
|
|
6
9
|
|
|
7
10
|
//#region src/lib/configure.ts
|
|
8
11
|
function getConfigDir(suffix) {
|
|
@@ -19,13 +22,23 @@ let CONFIG_CACHE = null;
|
|
|
19
22
|
const loadConfig = () => {
|
|
20
23
|
const config = loadCachedConfig();
|
|
21
24
|
if (!config || config === {} || !config.token) {
|
|
22
|
-
console.error("Please run 'short install' to configure Shortcut API access.");
|
|
25
|
+
console.error("Please run 'short install' to configure Shortcut API access or set SHORTCUT_API_TOKEN.");
|
|
23
26
|
process.exit(11);
|
|
24
27
|
}
|
|
28
|
+
const envUrlSlug = process.env.SHORTCUT_URL_SLUG || process.env.CLUBHOUSE_URL_SLUG;
|
|
29
|
+
if (!config.urlSlug && envUrlSlug) config.urlSlug = envUrlSlug;
|
|
30
|
+
const envMentionName = process.env.SHORTCUT_MENTION_NAME || process.env.CLUBHOUSE_MENTION_NAME;
|
|
31
|
+
if (!config.mentionName && envMentionName) config.mentionName = envMentionName;
|
|
25
32
|
if (!config.urlSlug) {
|
|
26
|
-
console.
|
|
27
|
-
|
|
33
|
+
console.warn("shortcut-cli: URL slug not configured. Set SHORTCUT_URL_SLUG or run 'short install --refresh' for full functionality.");
|
|
34
|
+
config.urlSlug = "";
|
|
28
35
|
}
|
|
36
|
+
if (!config.mentionName) {
|
|
37
|
+
console.warn("shortcut-cli: Mention name not configured. Set SHORTCUT_MENTION_NAME or run 'short install --refresh' for full functionality.");
|
|
38
|
+
config.mentionName = "";
|
|
39
|
+
}
|
|
40
|
+
if (!config.workspaces) config.workspaces = {};
|
|
41
|
+
CONFIG_CACHE = { ...config };
|
|
29
42
|
return config;
|
|
30
43
|
};
|
|
31
44
|
/**
|
|
@@ -48,9 +61,10 @@ const loadCachedConfig = () => {
|
|
|
48
61
|
process.exit(10);
|
|
49
62
|
}
|
|
50
63
|
if (token) config = {
|
|
51
|
-
|
|
52
|
-
|
|
64
|
+
...config,
|
|
65
|
+
token
|
|
53
66
|
};
|
|
67
|
+
if (!config.workspaces) config.workspaces = {};
|
|
54
68
|
CONFIG_CACHE = { ...config };
|
|
55
69
|
return config;
|
|
56
70
|
};
|
package/build/lib/spinner.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
|
-
|
|
3
|
+
let cli_spinner = require("cli-spinner");
|
|
4
4
|
|
|
5
5
|
//#region src/lib/spinner.ts
|
|
6
6
|
const spinner = (text = "") => {
|
package/build/lib/stories.js
CHANGED
|
@@ -2,9 +2,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2
2
|
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.js');
|
|
3
3
|
const require_lib_configure = require('./configure.js');
|
|
4
4
|
const require_lib_client = require('./client.js');
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
let debug = require("debug");
|
|
6
|
+
debug = require_rolldown_runtime.__toESM(debug);
|
|
7
|
+
let child_process = require("child_process");
|
|
8
|
+
let chalk = require("chalk");
|
|
9
|
+
chalk = require_rolldown_runtime.__toESM(chalk);
|
|
8
10
|
|
|
9
11
|
//#region src/lib/stories.ts
|
|
10
12
|
const debug$1 = (0, debug.default)("club");
|
|
@@ -139,10 +141,9 @@ const filterStories = (program, stories, entities) => {
|
|
|
139
141
|
if (!(s.epic_id + " " + (s.epic || {}).name).match(regexEpic)) return false;
|
|
140
142
|
if (!(s.iteration_id + " " + (s.iteration || {}).name).match(regexIteration)) return false;
|
|
141
143
|
if (program.owner) {
|
|
142
|
-
|
|
144
|
+
if (!(s.owners.filter((o) => {
|
|
143
145
|
return !!`${o.profile.name} ${o.profile.mention_name}`.match(regexOwner);
|
|
144
|
-
}).length > 0;
|
|
145
|
-
if (!owned) return false;
|
|
146
|
+
}).length > 0)) return false;
|
|
146
147
|
}
|
|
147
148
|
if (!s.name.match(regexText)) return false;
|
|
148
149
|
if (!s.story_type.match(regexType)) return false;
|
|
@@ -177,7 +178,7 @@ const sortStories = (program) => {
|
|
|
177
178
|
const printFormattedStory = (program) => {
|
|
178
179
|
return (story) => {
|
|
179
180
|
var _story$group;
|
|
180
|
-
const
|
|
181
|
+
const format = program.format || `#%id %t
|
|
181
182
|
\tType: %y/%e
|
|
182
183
|
\tTeam: %T
|
|
183
184
|
\tProject: %p
|
|
@@ -192,10 +193,9 @@ const printFormattedStory = (program) => {
|
|
|
192
193
|
\tUpdated: %updated
|
|
193
194
|
\tArchived: %a
|
|
194
195
|
`;
|
|
195
|
-
const format = program.format || defaultFormat;
|
|
196
196
|
const labels = story.labels.map((l) => `${l.name} (#${l.id})`);
|
|
197
197
|
const owners = story.owners.map((o) => `${o.profile.name} (${o.profile.mention_name})`);
|
|
198
|
-
const url =
|
|
198
|
+
const url = storyURL(story);
|
|
199
199
|
const project = story.project ? `${story.project.name} (#${story.project.id})` : "None";
|
|
200
200
|
log(format.replace(/%j/, JSON.stringify({
|
|
201
201
|
...story,
|
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",
|
|
@@ -48,22 +48,22 @@
|
|
|
48
48
|
"prompt": "^1.3.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@eslint/js": "^9.
|
|
51
|
+
"@eslint/js": "^9.39.1",
|
|
52
52
|
"@total-typescript/tsconfig": "^1.0.4",
|
|
53
53
|
"@types/chalk": "2.2.4",
|
|
54
54
|
"@types/cli-spinner": "0.2.3",
|
|
55
55
|
"@types/debug": "4.1.12",
|
|
56
|
-
"@types/node": "
|
|
56
|
+
"@types/node": "24.10.1",
|
|
57
57
|
"@types/node-fetch": "3.0.3",
|
|
58
58
|
"@types/prompt": "^1.1.9",
|
|
59
|
-
"eslint": "^9.
|
|
59
|
+
"eslint": "^9.39.1",
|
|
60
60
|
"eslint-plugin-import": "^2.32.0",
|
|
61
61
|
"glob": "^11.0.3",
|
|
62
|
-
"globals": "^16.
|
|
62
|
+
"globals": "^16.5.0",
|
|
63
63
|
"prettier": "3.6.2",
|
|
64
64
|
"source-map-support": "0.5.21",
|
|
65
65
|
"tsdown": "^0.12.9",
|
|
66
|
-
"typescript": "5.
|
|
67
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript": "5.9.3",
|
|
67
|
+
"typescript-eslint": "^8.47.0"
|
|
68
68
|
}
|
|
69
69
|
}
|