@shortcut-cli/shortcut-cli 3.4.0 → 3.5.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 +25 -0
- package/build/_virtual/rolldown_runtime.js +25 -0
- package/build/bin/short-api.js +78 -0
- package/build/bin/short-create.js +52 -573
- package/build/bin/short-epics.js +31 -160
- package/build/bin/short-find.js +4 -588
- package/build/bin/short-install.js +37 -135
- package/build/bin/short-members.js +28 -134
- package/build/bin/short-projects.js +28 -136
- package/build/bin/short-search.js +46 -597
- package/build/bin/short-story.js +201 -737
- package/build/bin/short-workflows.js +27 -133
- package/build/bin/short-workspace.js +62 -648
- package/build/bin/short.js +7 -33
- package/build/lib/client.js +10 -103
- package/build/lib/configure.js +93 -126
- package/build/lib/spinner.js +14 -31
- package/build/lib/stories.js +295 -462
- package/build/package.js +18 -0
- package/package.json +15 -15
package/build/bin/short-epics.js
CHANGED
|
@@ -1,165 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
18
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
19
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
20
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
21
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
-
mod
|
|
23
|
-
));
|
|
24
|
-
|
|
25
|
-
// src/bin/short-epics.ts
|
|
26
|
-
var import_commander = __toESM(require("commander"));
|
|
27
|
-
var import_chalk = __toESM(require("chalk"));
|
|
28
|
-
|
|
29
|
-
// src/lib/client.ts
|
|
30
|
-
var import_client = require("@shortcut/client");
|
|
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
|
+
const commander = require_rolldown_runtime.__toESM(require("commander"));
|
|
6
|
+
const chalk = require_rolldown_runtime.__toESM(require("chalk"));
|
|
31
7
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
import_path.default.resolve(import_os.default.homedir(), ".clubhouse-cli")
|
|
45
|
-
];
|
|
46
|
-
var CONFIG_CACHE = null;
|
|
47
|
-
var loadConfig = () => {
|
|
48
|
-
const config2 = loadCachedConfig();
|
|
49
|
-
if (!config2 || config2 === {} || !config2.token) {
|
|
50
|
-
console.error("Please run 'short install' to configure Shortcut API access.");
|
|
51
|
-
process.exit(11);
|
|
52
|
-
}
|
|
53
|
-
if (!config2.urlSlug) {
|
|
54
|
-
console.error(
|
|
55
|
-
"Your config must be updated with data from Shortcut. Please run 'short install --refresh'."
|
|
56
|
-
);
|
|
57
|
-
process.exit(12);
|
|
58
|
-
}
|
|
59
|
-
return config2;
|
|
8
|
+
//#region src/bin/short-epics.ts
|
|
9
|
+
const log = console.log;
|
|
10
|
+
const spin = require_lib_spinner.default();
|
|
11
|
+
const program = commander.default.description("Display epics available for stories").option("-a, --archived", "List only epics including archived", "").option("-c, --completed", "List only epics that have been completed", "").option("-d, --detailed", "List more details for each epic", "").option("-f, --format [template]", "Format each epic output by template", "").option("-M, --milestone [ID]", "List epics in milestone matching id", "").option("-t, --title [query]", "List epics with name/title containing query", "").option("-s, --started", "List epics that have been started", "").parse(process.argv);
|
|
12
|
+
const main = async () => {
|
|
13
|
+
spin.start();
|
|
14
|
+
const epics = await require_lib_client.default.listEpics(null).then((r) => r.data);
|
|
15
|
+
spin.stop(true);
|
|
16
|
+
const textMatch = new RegExp(program.title, "i");
|
|
17
|
+
epics.filter((epic) => {
|
|
18
|
+
return !!`${epic.name} ${epic.name}`.match(textMatch) && !!(program.milestone ? epic.milestone_id == program.milestone : true);
|
|
19
|
+
}).map(printItem);
|
|
60
20
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
if (import_fs.default.existsSync(configFile)) {
|
|
74
|
-
try {
|
|
75
|
-
config2 = JSON.parse(import_fs.default.readFileSync(configFile, "utf8"));
|
|
76
|
-
} catch (e) {
|
|
77
|
-
console.error(e);
|
|
78
|
-
process.exit(10);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
if (token) {
|
|
82
|
-
config2 = { token, ...config2 };
|
|
83
|
-
}
|
|
84
|
-
CONFIG_CACHE = { ...config2 };
|
|
85
|
-
return config2;
|
|
86
|
-
};
|
|
87
|
-
var createConfigDir = () => {
|
|
88
|
-
const dir = import_path.default.dirname(configDir);
|
|
89
|
-
if (!import_fs.default.existsSync(dir)) {
|
|
90
|
-
import_fs.default.mkdirSync(dir);
|
|
91
|
-
}
|
|
92
|
-
if (!import_fs.default.existsSync(configDir)) {
|
|
93
|
-
import_fs.default.mkdirSync(configDir);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
// src/lib/client.ts
|
|
98
|
-
var config = loadConfig();
|
|
99
|
-
var client = new import_client.ShortcutClient(config.token);
|
|
100
|
-
var client_default = client;
|
|
101
|
-
|
|
102
|
-
// src/lib/spinner.ts
|
|
103
|
-
var import_cli_spinner = require("cli-spinner");
|
|
104
|
-
var spinner = (text = "") => {
|
|
105
|
-
const spin2 = new import_cli_spinner.Spinner({
|
|
106
|
-
text: text ? text : "Loading... %s ",
|
|
107
|
-
stream: process.stderr
|
|
108
|
-
});
|
|
109
|
-
spin2.setSpinnerString(27);
|
|
110
|
-
return spin2;
|
|
111
|
-
};
|
|
112
|
-
var spinner_default = spinner;
|
|
113
|
-
|
|
114
|
-
// src/bin/short-epics.ts
|
|
115
|
-
var log = console.log;
|
|
116
|
-
var spin = spinner_default();
|
|
117
|
-
var program = import_commander.default.description("Display epics available for stories").option("-a, --archived", "List only epics including archived", "").option("-c, --completed", "List only epics that have been completed", "").option("-d, --detailed", "List more details for each epic", "").option("-f, --format [template]", "Format each epic output by template", "").option("-M, --milestone [ID]", "List epics in milestone matching id", "").option("-t, --title [query]", "List epics with name/title containing query", "").option("-s, --started", "List epics that have been started", "").parse(process.argv);
|
|
118
|
-
var main = async () => {
|
|
119
|
-
spin.start();
|
|
120
|
-
const epics = await client_default.listEpics(null).then((r) => r.data);
|
|
121
|
-
spin.stop(true);
|
|
122
|
-
const textMatch = new RegExp(program.title, "i");
|
|
123
|
-
epics.filter((epic) => {
|
|
124
|
-
return !!`${epic.name} ${epic.name}`.match(textMatch) && !!(program.milestone ? epic.milestone_id == program.milestone : true);
|
|
125
|
-
}).map(printItem);
|
|
126
|
-
};
|
|
127
|
-
var printItem = (epic) => {
|
|
128
|
-
if (epic.archived && !program.archived) return;
|
|
129
|
-
if (!epic.started && program.started) return;
|
|
130
|
-
if (!epic.completed && program.completed) return;
|
|
131
|
-
let defaultFormat = `#%id %t
|
|
132
|
-
Milestone: %m
|
|
133
|
-
State: %s
|
|
134
|
-
Deadline: %dl
|
|
135
|
-
`;
|
|
136
|
-
defaultFormat += `Points: %p
|
|
137
|
-
Points Started: %ps
|
|
138
|
-
Points Done: %pd
|
|
139
|
-
Completion: %c
|
|
140
|
-
`;
|
|
141
|
-
if (epic.archived) {
|
|
142
|
-
defaultFormat += `Archived: %ar
|
|
143
|
-
`;
|
|
144
|
-
}
|
|
145
|
-
if (epic.started) {
|
|
146
|
-
defaultFormat += `Started: %st
|
|
147
|
-
`;
|
|
148
|
-
}
|
|
149
|
-
if (epic.completed) {
|
|
150
|
-
defaultFormat += `Completed: %co
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
if (program.detailed) {
|
|
154
|
-
defaultFormat += `Description: %d
|
|
155
|
-
`;
|
|
156
|
-
}
|
|
157
|
-
const format = program.format || defaultFormat;
|
|
158
|
-
log(
|
|
159
|
-
format.replace(/%id/, import_chalk.default.bold(`${epic.id}`)).replace(/%t/, import_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(
|
|
160
|
-
/%c/,
|
|
161
|
-
`${Math.round(epic.stats.num_points_done / (epic.stats.num_points || 1) * 100)}%`
|
|
162
|
-
).replace(/%a/, `${epic.archived}`).replace(/%st/, `${epic.started_at}`).replace(/%co/, `${epic.completed_at}`)
|
|
163
|
-
);
|
|
21
|
+
const printItem = (epic) => {
|
|
22
|
+
if (epic.archived && !program.archived) return;
|
|
23
|
+
if (!epic.started && program.started) return;
|
|
24
|
+
if (!epic.completed && program.completed) return;
|
|
25
|
+
let defaultFormat = `#%id %t\nMilestone:\t%m\nState:\t\t%s\nDeadline:\t%dl\n`;
|
|
26
|
+
defaultFormat += `Points:\t\t%p\nPoints Started: %ps\nPoints Done:\t%pd\nCompletion:\t%c\n`;
|
|
27
|
+
if (epic.archived) defaultFormat += `Archived:\t%ar\n`;
|
|
28
|
+
if (epic.started) defaultFormat += `Started:\t%st\n`;
|
|
29
|
+
if (epic.completed) defaultFormat += `Completed:\t%co\n`;
|
|
30
|
+
if (program.detailed) defaultFormat += `Description:\t%d\n`;
|
|
31
|
+
const format = program.format || defaultFormat;
|
|
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}`));
|
|
164
33
|
};
|
|
165
34
|
main();
|
|
35
|
+
|
|
36
|
+
//#endregion
|