@bifos/dooray-cli 0.18.0 → 0.19.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 +41 -3
- package/dist/index.js +1027 -381
- package/package.json +4 -1
- package/skills/dooray-cli/SKILL.md +13 -5
- package/skills/dooray-cli/references/common.md +10 -1
- package/skills/dooray-cli/references/post.md +4 -2
- package/skills/dooray-cli/references/wiki.md +78 -7
package/dist/index.js
CHANGED
|
@@ -24,7 +24,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
24
24
|
));
|
|
25
25
|
|
|
26
26
|
// src/index.ts
|
|
27
|
-
var
|
|
27
|
+
var import_commander71 = require("commander");
|
|
28
28
|
var import_chalk9 = __toESM(require("chalk"));
|
|
29
29
|
|
|
30
30
|
// src/commands/config.ts
|
|
@@ -51,6 +51,7 @@ var EXIT_API_ERROR = 1;
|
|
|
51
51
|
var EXIT_AUTH_ERROR = 2;
|
|
52
52
|
var EXIT_PARAM_ERROR = 3;
|
|
53
53
|
var EXIT_CONFIG_ERROR = 4;
|
|
54
|
+
var EXIT_IO_ERROR = 5;
|
|
54
55
|
|
|
55
56
|
// src/config/types.ts
|
|
56
57
|
var API_ENDPOINTS = {
|
|
@@ -74,27 +75,96 @@ var CONFIG_PATH = (0, import_node_path.join)(DOORAY_DIR, "config.json");
|
|
|
74
75
|
async function ensureDir() {
|
|
75
76
|
await (0, import_promises.mkdir)(DOORAY_DIR, { recursive: true });
|
|
76
77
|
}
|
|
78
|
+
function reasonOf(err) {
|
|
79
|
+
return err instanceof Error ? err.message : String(err);
|
|
80
|
+
}
|
|
81
|
+
function isNodeError(err) {
|
|
82
|
+
return err instanceof Error && "code" in err;
|
|
83
|
+
}
|
|
84
|
+
function invalidConfigReason(value) {
|
|
85
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
86
|
+
return "\uC124\uC815 \uD30C\uC77C\uC740 \uAC1D\uCCB4\uC5EC\uC57C \uD569\uB2C8\uB2E4.";
|
|
87
|
+
}
|
|
88
|
+
const config = value;
|
|
89
|
+
if (config.version !== 1) return "version \uD544\uB4DC\uB294 1\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.";
|
|
90
|
+
if (typeof config.apiKey !== "string") {
|
|
91
|
+
return "apiKey \uD544\uB4DC\uB294 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.";
|
|
92
|
+
}
|
|
93
|
+
if (typeof config.baseUrl !== "string") {
|
|
94
|
+
return "baseUrl \uD544\uB4DC\uB294 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.";
|
|
95
|
+
}
|
|
96
|
+
const optionalStringFields = [
|
|
97
|
+
"tenantName",
|
|
98
|
+
"imapHost",
|
|
99
|
+
"imapUsername",
|
|
100
|
+
"imapPassword",
|
|
101
|
+
"smtpHost"
|
|
102
|
+
];
|
|
103
|
+
for (const field of optionalStringFields) {
|
|
104
|
+
if (config[field] !== void 0 && typeof config[field] !== "string") {
|
|
105
|
+
return `${field} \uD544\uB4DC\uB294 \uBB38\uC790\uC5F4\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.`;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
for (const field of ["imapPort", "smtpPort"]) {
|
|
109
|
+
if (config[field] !== void 0 && typeof config[field] !== "number") {
|
|
110
|
+
return `${field} \uD544\uB4DC\uB294 \uC22B\uC790\uC5EC\uC57C \uD569\uB2C8\uB2E4.`;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (config.trackLastRun !== void 0 && typeof config.trackLastRun !== "boolean") {
|
|
114
|
+
return "trackLastRun \uD544\uB4DC\uB294 boolean\uC774\uC5B4\uC57C \uD569\uB2C8\uB2E4.";
|
|
115
|
+
}
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
function isConfig(value) {
|
|
119
|
+
return invalidConfigReason(value) === null;
|
|
120
|
+
}
|
|
121
|
+
function configReadErrorMessage(result) {
|
|
122
|
+
if (result.state === "invalid") {
|
|
123
|
+
return `\uC124\uC815 \uD30C\uC77C\uC774 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4: ${CONFIG_PATH}
|
|
124
|
+
\uC774\uC720: ${result.reason}`;
|
|
125
|
+
}
|
|
126
|
+
return `\uC124\uC815 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${CONFIG_PATH}
|
|
127
|
+
\uC774\uC720: ${result.reason}
|
|
128
|
+
\uD30C\uC77C \uAD8C\uD55C\uC744 \uD655\uC778\uD558\uC138\uC694.`;
|
|
129
|
+
}
|
|
77
130
|
async function getConfig() {
|
|
78
131
|
try {
|
|
79
132
|
const raw = await (0, import_promises.readFile)(CONFIG_PATH, "utf-8");
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
133
|
+
try {
|
|
134
|
+
const parsed = JSON.parse(raw);
|
|
135
|
+
if (!isConfig(parsed)) {
|
|
136
|
+
const invalidReason = invalidConfigReason(parsed) ?? "\uC124\uC815 \uD30C\uC77C \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4.";
|
|
137
|
+
return { state: "invalid", reason: invalidReason };
|
|
138
|
+
}
|
|
139
|
+
return { state: "ok", config: parsed };
|
|
140
|
+
} catch (err) {
|
|
141
|
+
return { state: "invalid", reason: reasonOf(err) };
|
|
142
|
+
}
|
|
143
|
+
} catch (err) {
|
|
144
|
+
if (isNodeError(err) && err.code === "ENOENT") return { state: "absent" };
|
|
145
|
+
return { state: "unreadable", reason: reasonOf(err) };
|
|
83
146
|
}
|
|
84
147
|
}
|
|
85
148
|
async function getConfigOrThrow() {
|
|
86
|
-
const
|
|
87
|
-
if (
|
|
149
|
+
const result = await getConfig();
|
|
150
|
+
if (result.state === "invalid" || result.state === "unreadable") {
|
|
151
|
+
throw new DoorayCliError(configReadErrorMessage(result), EXIT_CONFIG_ERROR);
|
|
152
|
+
}
|
|
153
|
+
if (result.state === "absent" || !result.config.apiKey || !result.config.baseUrl) {
|
|
88
154
|
throw new DoorayCliError(
|
|
89
155
|
"\uC124\uC815\uC774 \uC644\uB8CC\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uBA3C\uC800 \uCD08\uAE30 \uC124\uC815\uC744 \uC9C4\uD589\uD558\uC138\uC694:\n dooray setup",
|
|
90
156
|
EXIT_CONFIG_ERROR
|
|
91
157
|
);
|
|
92
158
|
}
|
|
93
|
-
return config;
|
|
159
|
+
return result.config;
|
|
94
160
|
}
|
|
95
161
|
async function setConfigValue(key, value) {
|
|
96
162
|
await ensureDir();
|
|
97
|
-
const
|
|
163
|
+
const result = await getConfig();
|
|
164
|
+
if (result.state === "invalid" || result.state === "unreadable") {
|
|
165
|
+
throw new DoorayCliError(configReadErrorMessage(result), EXIT_CONFIG_ERROR);
|
|
166
|
+
}
|
|
167
|
+
const config = result.state === "ok" ? result.config : {
|
|
98
168
|
version: 1,
|
|
99
169
|
apiKey: "",
|
|
100
170
|
baseUrl: DEFAULTS.baseUrl
|
|
@@ -150,109 +220,18 @@ function removeMailCredentials(config) {
|
|
|
150
220
|
return next;
|
|
151
221
|
}
|
|
152
222
|
async function clearMailCredentials() {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
return hadCredentials;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// src/utils/body-input.ts
|
|
161
|
-
var import_promises2 = require("fs/promises");
|
|
162
|
-
async function readBodyInput(opts) {
|
|
163
|
-
if (opts.body != null && opts.bodyFile != null) {
|
|
164
|
-
throw new DoorayCliError(
|
|
165
|
-
"--body\uC640 --body-file\uC740 \uD568\uAED8 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
166
|
-
EXIT_PARAM_ERROR
|
|
167
|
-
);
|
|
168
|
-
}
|
|
169
|
-
if (opts.bodyFile) {
|
|
170
|
-
if (opts.bodyFile === "-") return readStdin();
|
|
171
|
-
return (0, import_promises2.readFile)(opts.bodyFile, "utf-8");
|
|
172
|
-
}
|
|
173
|
-
if (opts.body === "-") return readStdin();
|
|
174
|
-
return opts.body ?? "";
|
|
175
|
-
}
|
|
176
|
-
async function readBodyInputOrNull(opts) {
|
|
177
|
-
if (opts.body == null && opts.bodyFile == null) return null;
|
|
178
|
-
return readBodyInput(opts);
|
|
179
|
-
}
|
|
180
|
-
async function readStdin() {
|
|
181
|
-
if (process.stdin.isTTY) {
|
|
182
|
-
throw new DoorayCliError(
|
|
183
|
-
"stdin\uC5D0\uC11C \uC77D\uC73C\uB824\uBA74 \uD30C\uC774\uD504\uB85C \uB370\uC774\uD130\uB97C \uC804\uB2EC\uD574\uC8FC\uC138\uC694.",
|
|
184
|
-
EXIT_PARAM_ERROR
|
|
185
|
-
);
|
|
223
|
+
const result = await getConfig();
|
|
224
|
+
if (result.state === "absent") return { state: "absent" };
|
|
225
|
+
if (result.state === "invalid" || result.state === "unreadable") {
|
|
226
|
+
return { state: "failed", reason: configReadErrorMessage(result) };
|
|
186
227
|
}
|
|
187
|
-
const
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
return Buffer.concat(chunks).toString("utf-8");
|
|
228
|
+
const hadCredentials = !!(result.config.imapUsername || result.config.imapPassword);
|
|
229
|
+
await saveConfig(removeMailCredentials(result.config));
|
|
230
|
+
return { state: "cleared", hadCredentials };
|
|
192
231
|
}
|
|
193
232
|
|
|
194
|
-
// src/utils/config-value.ts
|
|
195
|
-
async function resolveConfigValue(raw, read = readStdin) {
|
|
196
|
-
if (raw !== "-") return raw;
|
|
197
|
-
const value = (await read()).trim();
|
|
198
|
-
if (value === "") {
|
|
199
|
-
throw new DoorayCliError(
|
|
200
|
-
"stdin \uC73C\uB85C \uBC1B\uC740 \uAC12\uC774 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
201
|
-
EXIT_PARAM_ERROR
|
|
202
|
-
);
|
|
203
|
-
}
|
|
204
|
-
return value;
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
// src/commands/config.ts
|
|
208
|
-
function maskApiKey(key) {
|
|
209
|
-
if (key.length <= 8) return "****";
|
|
210
|
-
return key.slice(0, 4) + "****" + key.slice(-4);
|
|
211
|
-
}
|
|
212
|
-
var configCommand = new import_commander.Command("config").description("CLI \uC124\uC815 \uAD00\uB9AC");
|
|
213
|
-
configCommand.command("set").description("\uC124\uC815 \uAC12 \uC800\uC7A5").argument("<key>", "\uC124\uC815 \uD0A4 (api-key, base-url)").argument("<value>", "\uC124\uC815 \uAC12 (`-` \uC774\uBA74 stdin \uC5D0\uC11C \uC77D\uC74C)").action(async (key, value) => {
|
|
214
|
-
try {
|
|
215
|
-
await setConfigValue(key, await resolveConfigValue(value));
|
|
216
|
-
console.log(import_chalk.default.green(`\u2713 ${key} \uC124\uC815 \uC644\uB8CC`));
|
|
217
|
-
} catch (err) {
|
|
218
|
-
if (err instanceof DoorayCliError) {
|
|
219
|
-
console.error(import_chalk.default.red(err.message));
|
|
220
|
-
process.exit(err.exitCode);
|
|
221
|
-
}
|
|
222
|
-
throw err;
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
configCommand.command("get").description("\uC124\uC815 \uAC12 \uC870\uD68C").argument("[key]", "\uC124\uC815 \uD0A4 (\uC0DD\uB7B5 \uC2DC \uC804\uCCB4 \uCD9C\uB825)").action(async (key) => {
|
|
226
|
-
const config = await getConfig();
|
|
227
|
-
if (!config) {
|
|
228
|
-
console.error(import_chalk.default.red("\uC124\uC815 \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. dooray config set \uC73C\uB85C \uC124\uC815\uD558\uC138\uC694."));
|
|
229
|
-
process.exit(EXIT_CONFIG_ERROR);
|
|
230
|
-
}
|
|
231
|
-
const display = {
|
|
232
|
-
"api-key": config.apiKey ? maskApiKey(config.apiKey) : "(\uBBF8\uC124\uC815)",
|
|
233
|
-
"base-url": config.baseUrl || "(\uBBF8\uC124\uC815)"
|
|
234
|
-
};
|
|
235
|
-
if (key) {
|
|
236
|
-
const val = display[key];
|
|
237
|
-
if (val === void 0) {
|
|
238
|
-
console.error(import_chalk.default.red(`\uC54C \uC218 \uC5C6\uB294 \uC124\uC815 \uD0A4: ${key}
|
|
239
|
-
\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uD0A4: api-key, base-url`));
|
|
240
|
-
process.exit(EXIT_CONFIG_ERROR);
|
|
241
|
-
}
|
|
242
|
-
console.log(`${key}: ${val}`);
|
|
243
|
-
} else {
|
|
244
|
-
for (const [k, v] of Object.entries(display)) {
|
|
245
|
-
console.log(`${k}: ${v}`);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
|
|
250
|
-
// src/commands/cache.ts
|
|
251
|
-
var import_commander2 = require("commander");
|
|
252
|
-
var import_chalk2 = __toESM(require("chalk"));
|
|
253
|
-
|
|
254
233
|
// src/cache/store.ts
|
|
255
|
-
var
|
|
234
|
+
var import_promises2 = require("fs/promises");
|
|
256
235
|
var import_node_path2 = require("path");
|
|
257
236
|
var import_node_os2 = require("os");
|
|
258
237
|
var CACHE_DIR = (0, import_node_path2.join)((0, import_node_os2.homedir)(), ".dooray", "cache");
|
|
@@ -267,11 +246,11 @@ var MEMBER_GROUPS_DIR = (0, import_node_path2.join)(CACHE_DIR, "member-groups");
|
|
|
267
246
|
var WIKIS_PATH = (0, import_node_path2.join)(CACHE_DIR, "wikis.json");
|
|
268
247
|
var TEMPLATES_DIR = (0, import_node_path2.join)(CACHE_DIR, "templates");
|
|
269
248
|
async function ensureDir2(dir) {
|
|
270
|
-
await (0,
|
|
249
|
+
await (0, import_promises2.mkdir)(dir, { recursive: true });
|
|
271
250
|
}
|
|
272
251
|
async function readJson(path6) {
|
|
273
252
|
try {
|
|
274
|
-
const raw = await (0,
|
|
253
|
+
const raw = await (0, import_promises2.readFile)(path6, "utf-8");
|
|
275
254
|
return JSON.parse(raw);
|
|
276
255
|
} catch {
|
|
277
256
|
return null;
|
|
@@ -280,7 +259,7 @@ async function readJson(path6) {
|
|
|
280
259
|
async function writeJson(path6, data) {
|
|
281
260
|
const dir = (0, import_node_path2.dirname)(path6);
|
|
282
261
|
await ensureDir2(dir);
|
|
283
|
-
await (0,
|
|
262
|
+
await (0, import_promises2.writeFile)(path6, JSON.stringify(data, null, 2) + "\n");
|
|
284
263
|
}
|
|
285
264
|
function isExpired(updatedAt, ttlMs) {
|
|
286
265
|
if (!updatedAt) return true;
|
|
@@ -334,6 +313,9 @@ async function getTags(projectId) {
|
|
|
334
313
|
async function setTags(projectId, items) {
|
|
335
314
|
await writeJson(tagsPath(projectId), { updatedAt: now(), data: items });
|
|
336
315
|
}
|
|
316
|
+
async function clearTags(projectId) {
|
|
317
|
+
await (0, import_promises2.rm)(tagsPath(projectId), { force: true });
|
|
318
|
+
}
|
|
337
319
|
function milestonesPath(projectId) {
|
|
338
320
|
return (0, import_node_path2.join)(MILESTONES_DIR, `${projectId}.json`);
|
|
339
321
|
}
|
|
@@ -368,9 +350,17 @@ async function setWikis(items) {
|
|
|
368
350
|
await writeJson(WIKIS_PATH, { updatedAt: now(), data: items });
|
|
369
351
|
}
|
|
370
352
|
async function clearCache() {
|
|
353
|
+
const existed = await cacheDirExists();
|
|
354
|
+
await (0, import_promises2.rm)(CACHE_DIR, { recursive: true, force: true });
|
|
355
|
+
return existed;
|
|
356
|
+
}
|
|
357
|
+
async function cacheDirExists() {
|
|
371
358
|
try {
|
|
372
|
-
await (0,
|
|
373
|
-
|
|
359
|
+
await (0, import_promises2.stat)(CACHE_DIR);
|
|
360
|
+
return true;
|
|
361
|
+
} catch (e) {
|
|
362
|
+
if (e.code === "ENOENT") return false;
|
|
363
|
+
throw e;
|
|
374
364
|
}
|
|
375
365
|
}
|
|
376
366
|
async function getCacheStats() {
|
|
@@ -378,31 +368,31 @@ async function getCacheStats() {
|
|
|
378
368
|
const projectCount = projects?.data.length ?? 0;
|
|
379
369
|
let memberProjectCount = 0;
|
|
380
370
|
try {
|
|
381
|
-
const files = await (0,
|
|
371
|
+
const files = await (0, import_promises2.readdir)(MEMBERS_DIR);
|
|
382
372
|
memberProjectCount = files.filter((f) => f.endsWith(".json")).length;
|
|
383
373
|
} catch {
|
|
384
374
|
}
|
|
385
375
|
let workflowProjectCount = 0;
|
|
386
376
|
try {
|
|
387
|
-
const files = await (0,
|
|
377
|
+
const files = await (0, import_promises2.readdir)(WORKFLOWS_DIR);
|
|
388
378
|
workflowProjectCount = files.filter((f) => f.endsWith(".json")).length;
|
|
389
379
|
} catch {
|
|
390
380
|
}
|
|
391
381
|
let tagProjectCount = 0;
|
|
392
382
|
try {
|
|
393
|
-
const files = await (0,
|
|
383
|
+
const files = await (0, import_promises2.readdir)(TAGS_DIR);
|
|
394
384
|
tagProjectCount = files.filter((f) => f.endsWith(".json")).length;
|
|
395
385
|
} catch {
|
|
396
386
|
}
|
|
397
387
|
let milestoneProjectCount = 0;
|
|
398
388
|
try {
|
|
399
|
-
const files = await (0,
|
|
389
|
+
const files = await (0, import_promises2.readdir)(MILESTONES_DIR);
|
|
400
390
|
milestoneProjectCount = files.filter((f) => f.endsWith(".json")).length;
|
|
401
391
|
} catch {
|
|
402
392
|
}
|
|
403
393
|
let memberGroupProjectCount = 0;
|
|
404
394
|
try {
|
|
405
|
-
const files = await (0,
|
|
395
|
+
const files = await (0, import_promises2.readdir)(MEMBER_GROUPS_DIR);
|
|
406
396
|
memberGroupProjectCount = files.filter((f) => f.endsWith(".json")).length;
|
|
407
397
|
} catch {
|
|
408
398
|
}
|
|
@@ -410,15 +400,194 @@ async function getCacheStats() {
|
|
|
410
400
|
return { projectCount, memberProjectCount, workflowProjectCount, tagProjectCount, milestoneProjectCount, memberGroupProjectCount, me: me?.data ?? null };
|
|
411
401
|
}
|
|
412
402
|
|
|
403
|
+
// src/services/config.ts
|
|
404
|
+
function shouldInvalidateCache(prev, next) {
|
|
405
|
+
if (prev === null) return false;
|
|
406
|
+
return prev.apiKey !== next.apiKey || prev.baseUrl !== next.baseUrl;
|
|
407
|
+
}
|
|
408
|
+
async function invalidateAllCache() {
|
|
409
|
+
try {
|
|
410
|
+
return await clearCache();
|
|
411
|
+
} catch (e) {
|
|
412
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
413
|
+
process.stderr.write(
|
|
414
|
+
`\u26A0 \uCE90\uC2DC \uC0AD\uC81C \uC2E4\uD328 (\uC124\uC815 \uBCC0\uACBD\uC740 \uBC18\uC601\uB428): ${msg}
|
|
415
|
+
\uC774\uC804 \uACC4\uC815\xB7\uD658\uACBD\uC758 \uB370\uC774\uD130\uAC00 \uB0A8\uC544 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4: dooray cache clear
|
|
416
|
+
`
|
|
417
|
+
);
|
|
418
|
+
return false;
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
async function invalidateCacheForUnknownPreviousConfig(prev) {
|
|
422
|
+
process.stderr.write(
|
|
423
|
+
`\u26A0 \uC774\uC804 \uC124\uC815\uC744 \uC77D\uC9C0 \uBABB\uD574 \uCE90\uC2DC\uB97C \uBE44\uC6C1\uB2C8\uB2E4: ${prev.reason}
|
|
424
|
+
\uC774\uC804 \uACC4\uC815\xB7\uD658\uACBD\uC758 \uB370\uC774\uD130\uAC00 \uB0A8\uC544 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4.
|
|
425
|
+
`
|
|
426
|
+
);
|
|
427
|
+
return invalidateAllCache();
|
|
428
|
+
}
|
|
429
|
+
async function updateConfigValue(key, value) {
|
|
430
|
+
const prev = await getConfig();
|
|
431
|
+
await setConfigValue(key, value);
|
|
432
|
+
const next = await getConfig();
|
|
433
|
+
if (next.state !== "ok") {
|
|
434
|
+
process.stderr.write(
|
|
435
|
+
"\u26A0 \uC800\uC7A5\uD55C \uC124\uC815\uC744 \uB418\uC77D\uC9C0 \uBABB\uD574 \uCE90\uC2DC \uBB34\uD6A8\uD654 \uD310\uC815\uC744 \uAC74\uB108\uB701\uB2C8\uB2E4.\n \uC774\uC804 \uACC4\uC815\xB7\uD658\uACBD\uC758 \uB370\uC774\uD130\uAC00 \uB0A8\uC544 \uC788\uC744 \uC218 \uC788\uC2B5\uB2C8\uB2E4: dooray cache clear\n"
|
|
436
|
+
);
|
|
437
|
+
return { cacheCleared: false };
|
|
438
|
+
}
|
|
439
|
+
if (prev.state === "absent") return { cacheCleared: false };
|
|
440
|
+
if (prev.state === "invalid" || prev.state === "unreadable") {
|
|
441
|
+
return {
|
|
442
|
+
cacheCleared: await invalidateCacheForUnknownPreviousConfig(prev)
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
if (!shouldInvalidateCache(prev.config, next.config)) {
|
|
446
|
+
return { cacheCleared: false };
|
|
447
|
+
}
|
|
448
|
+
return { cacheCleared: await invalidateAllCache() };
|
|
449
|
+
}
|
|
450
|
+
async function replaceConfig(next) {
|
|
451
|
+
const prev = await getConfig();
|
|
452
|
+
await saveConfig(next);
|
|
453
|
+
if (prev.state === "absent") return { cacheCleared: false };
|
|
454
|
+
if (prev.state === "invalid" || prev.state === "unreadable") {
|
|
455
|
+
return {
|
|
456
|
+
cacheCleared: await invalidateCacheForUnknownPreviousConfig(prev)
|
|
457
|
+
};
|
|
458
|
+
}
|
|
459
|
+
if (!shouldInvalidateCache(prev.config, next)) return { cacheCleared: false };
|
|
460
|
+
return { cacheCleared: await invalidateAllCache() };
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
// src/utils/body-input.ts
|
|
464
|
+
var import_promises3 = require("fs/promises");
|
|
465
|
+
async function readBodyInput(opts) {
|
|
466
|
+
if (opts.body != null && opts.bodyFile != null) {
|
|
467
|
+
throw new DoorayCliError(
|
|
468
|
+
"--body\uC640 --body-file\uC740 \uD568\uAED8 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
469
|
+
EXIT_PARAM_ERROR
|
|
470
|
+
);
|
|
471
|
+
}
|
|
472
|
+
if (opts.bodyFile) {
|
|
473
|
+
if (opts.bodyFile === "-") return readStdin();
|
|
474
|
+
return (0, import_promises3.readFile)(opts.bodyFile, "utf-8");
|
|
475
|
+
}
|
|
476
|
+
if (opts.body === "-") return readStdin();
|
|
477
|
+
return opts.body ?? "";
|
|
478
|
+
}
|
|
479
|
+
async function readBodyInputOrNull(opts) {
|
|
480
|
+
if (opts.body == null && opts.bodyFile == null) return null;
|
|
481
|
+
return readBodyInput(opts);
|
|
482
|
+
}
|
|
483
|
+
async function readStdin() {
|
|
484
|
+
if (process.stdin.isTTY) {
|
|
485
|
+
throw new DoorayCliError(
|
|
486
|
+
"stdin\uC5D0\uC11C \uC77D\uC73C\uB824\uBA74 \uD30C\uC774\uD504\uB85C \uB370\uC774\uD130\uB97C \uC804\uB2EC\uD574\uC8FC\uC138\uC694.",
|
|
487
|
+
EXIT_PARAM_ERROR
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
const chunks = [];
|
|
491
|
+
for await (const chunk of process.stdin) {
|
|
492
|
+
chunks.push(chunk);
|
|
493
|
+
}
|
|
494
|
+
return Buffer.concat(chunks).toString("utf-8");
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
// src/utils/config-value.ts
|
|
498
|
+
async function resolveConfigValue(raw, read = readStdin) {
|
|
499
|
+
if (raw !== "-") return raw;
|
|
500
|
+
const value = (await read()).trim();
|
|
501
|
+
if (value === "") {
|
|
502
|
+
throw new DoorayCliError(
|
|
503
|
+
"stdin \uC73C\uB85C \uBC1B\uC740 \uAC12\uC774 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4.",
|
|
504
|
+
EXIT_PARAM_ERROR
|
|
505
|
+
);
|
|
506
|
+
}
|
|
507
|
+
return value;
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
// src/commands/config.ts
|
|
511
|
+
function cacheClearedNotice(key) {
|
|
512
|
+
const reason = key === "api-key" ? "\uACC4\uC815\uC774 \uBC14\uB00C\uC5C8\uC744 \uC218 \uC788\uC5B4" : "\uC811\uC18D \uD658\uACBD\uC774 \uBC14\uB00C\uC5C8\uC744 \uC218 \uC788\uC5B4";
|
|
513
|
+
return ` ${reason} \uCE90\uC2DC\uB97C \uBE44\uC6E0\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uC870\uD68C\uAC00 API \uB97C \uB2E4\uC2DC \uD638\uCD9C\uD569\uB2C8\uB2E4.`;
|
|
514
|
+
}
|
|
515
|
+
function maskApiKey(key) {
|
|
516
|
+
if (key.length <= 8) return "****";
|
|
517
|
+
return key.slice(0, 4) + "****" + key.slice(-4);
|
|
518
|
+
}
|
|
519
|
+
var configCommand = new import_commander.Command("config").description("CLI \uC124\uC815 \uAD00\uB9AC");
|
|
520
|
+
configCommand.command("set").description("\uC124\uC815 \uAC12 \uC800\uC7A5").argument("<key>", "\uC124\uC815 \uD0A4 (api-key, base-url)").argument("<value>", "\uC124\uC815 \uAC12 (`-` \uC774\uBA74 stdin \uC5D0\uC11C \uC77D\uC74C)").action(async (key, value) => {
|
|
521
|
+
try {
|
|
522
|
+
const { cacheCleared } = await updateConfigValue(
|
|
523
|
+
key,
|
|
524
|
+
await resolveConfigValue(value)
|
|
525
|
+
);
|
|
526
|
+
console.log(import_chalk.default.green(`\u2713 ${key} \uC124\uC815 \uC644\uB8CC`));
|
|
527
|
+
if (cacheCleared) console.log(import_chalk.default.gray(cacheClearedNotice(key)));
|
|
528
|
+
} catch (err) {
|
|
529
|
+
if (err instanceof DoorayCliError) {
|
|
530
|
+
console.error(import_chalk.default.red(err.message));
|
|
531
|
+
process.exit(err.exitCode);
|
|
532
|
+
}
|
|
533
|
+
throw err;
|
|
534
|
+
}
|
|
535
|
+
});
|
|
536
|
+
configCommand.command("get").description("\uC124\uC815 \uAC12 \uC870\uD68C").argument("[key]", "\uC124\uC815 \uD0A4 (\uC0DD\uB7B5 \uC2DC \uC804\uCCB4 \uCD9C\uB825)").action(async (key) => {
|
|
537
|
+
const result = await getConfig();
|
|
538
|
+
if (result.state !== "ok") {
|
|
539
|
+
console.error(import_chalk.default.red("\uC124\uC815 \uD30C\uC77C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4. dooray config set \uC73C\uB85C \uC124\uC815\uD558\uC138\uC694."));
|
|
540
|
+
process.exit(EXIT_CONFIG_ERROR);
|
|
541
|
+
}
|
|
542
|
+
const config = result.config;
|
|
543
|
+
const display = {
|
|
544
|
+
"api-key": config.apiKey ? maskApiKey(config.apiKey) : "(\uBBF8\uC124\uC815)",
|
|
545
|
+
"base-url": config.baseUrl || "(\uBBF8\uC124\uC815)"
|
|
546
|
+
};
|
|
547
|
+
if (key) {
|
|
548
|
+
const val = display[key];
|
|
549
|
+
if (val === void 0) {
|
|
550
|
+
console.error(import_chalk.default.red(`\uC54C \uC218 \uC5C6\uB294 \uC124\uC815 \uD0A4: ${key}
|
|
551
|
+
\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uD0A4: api-key, base-url`));
|
|
552
|
+
process.exit(EXIT_CONFIG_ERROR);
|
|
553
|
+
}
|
|
554
|
+
console.log(`${key}: ${val}`);
|
|
555
|
+
} else {
|
|
556
|
+
for (const [k, v] of Object.entries(display)) {
|
|
557
|
+
console.log(`${k}: ${v}`);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
});
|
|
561
|
+
|
|
413
562
|
// src/commands/cache.ts
|
|
563
|
+
var import_commander2 = require("commander");
|
|
564
|
+
var import_chalk2 = __toESM(require("chalk"));
|
|
565
|
+
async function clearOrThrow() {
|
|
566
|
+
try {
|
|
567
|
+
return await clearCache();
|
|
568
|
+
} catch (e) {
|
|
569
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
570
|
+
throw new DoorayCliError(
|
|
571
|
+
`\uCE90\uC2DC\uB97C \uC0AD\uC81C\uD558\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4: ${msg}
|
|
572
|
+
\uACBD\uB85C: ${CACHE_DIR}`,
|
|
573
|
+
EXIT_IO_ERROR
|
|
574
|
+
);
|
|
575
|
+
}
|
|
576
|
+
}
|
|
414
577
|
var cacheCommand = new import_commander2.Command("cache").description("\uCE90\uC2DC \uAD00\uB9AC");
|
|
415
578
|
cacheCommand.command("clear").description("\uCE90\uC2DC \uC804\uCCB4 \uC0AD\uC81C").action(async () => {
|
|
416
|
-
await
|
|
417
|
-
console.log(
|
|
579
|
+
const cleared = await clearOrThrow();
|
|
580
|
+
console.log(
|
|
581
|
+
cleared ? import_chalk2.default.green("\u2713 \uCE90\uC2DC\uAC00 \uC0AD\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.") : import_chalk2.default.gray("\uC9C0\uC6B8 \uCE90\uC2DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.")
|
|
582
|
+
);
|
|
418
583
|
});
|
|
419
584
|
cacheCommand.command("refresh").description("\uCE90\uC2DC \uAC31\uC2E0 (API \uD074\uB77C\uC774\uC5B8\uD2B8 \uC5F0\uB3D9 \uD6C4 \uC9C0\uC6D0 \uC608\uC815)").action(async () => {
|
|
420
|
-
await
|
|
421
|
-
console.log(
|
|
585
|
+
const cleared = await clearOrThrow();
|
|
586
|
+
console.log(
|
|
587
|
+
import_chalk2.default.yellow(
|
|
588
|
+
cleared ? "\uCE90\uC2DC\uB97C \uC0AD\uC81C\uD588\uC2B5\uB2C8\uB2E4. API \uD074\uB77C\uC774\uC5B8\uD2B8 \uC5F0\uB3D9 \uD6C4 \uC790\uB3D9 \uAC31\uC2E0\uC774 \uC9C0\uC6D0\uB429\uB2C8\uB2E4." : "\uC9C0\uC6B8 \uCE90\uC2DC\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. API \uD074\uB77C\uC774\uC5B8\uD2B8 \uC5F0\uB3D9 \uD6C4 \uC790\uB3D9 \uAC31\uC2E0\uC774 \uC9C0\uC6D0\uB429\uB2C8\uB2E4."
|
|
589
|
+
)
|
|
590
|
+
);
|
|
422
591
|
});
|
|
423
592
|
|
|
424
593
|
// src/commands/doctor.ts
|
|
@@ -432,7 +601,7 @@ var import_node_path3 = __toESM(require("path"));
|
|
|
432
601
|
var import_node_os3 = require("os");
|
|
433
602
|
|
|
434
603
|
// src/version.ts
|
|
435
|
-
var CLI_VERSION = true ? "0.
|
|
604
|
+
var CLI_VERSION = true ? "0.19.0" : "0.0.0-dev";
|
|
436
605
|
|
|
437
606
|
// src/skill/context.ts
|
|
438
607
|
function resolveSkillDataRoot(homeDir, xdgDataHome = process.env.XDG_DATA_HOME) {
|
|
@@ -512,8 +681,8 @@ function compareCodePoint(left, right) {
|
|
|
512
681
|
return leftPoints.length - rightPoints.length;
|
|
513
682
|
}
|
|
514
683
|
async function assertRegularFile(filePath) {
|
|
515
|
-
const
|
|
516
|
-
if (!
|
|
684
|
+
const stat4 = await fs.lstat(filePath);
|
|
685
|
+
if (!stat4.isFile()) {
|
|
517
686
|
throw new DoorayCliError(
|
|
518
687
|
`\uC2A4\uD0AC \uCF58\uD150\uCE20\uB294 \uC815\uADDC \uD30C\uC77C\uB9CC \uD3EC\uD568\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4: ${filePath}`,
|
|
519
688
|
EXIT_PARAM_ERROR
|
|
@@ -609,7 +778,7 @@ function statusOf(context, status, overrides = {}) {
|
|
|
609
778
|
managed: overrides.managed ?? false
|
|
610
779
|
};
|
|
611
780
|
}
|
|
612
|
-
function
|
|
781
|
+
function isNodeError2(error, code) {
|
|
613
782
|
return error instanceof Error && "code" in error && error.code === code;
|
|
614
783
|
}
|
|
615
784
|
function isPackageMetadata(value) {
|
|
@@ -742,8 +911,8 @@ async function prepareStore(context, options) {
|
|
|
742
911
|
const storeRoot = getStoreRoot(context);
|
|
743
912
|
const storePath = getStorePath(context, sourceDigest);
|
|
744
913
|
await fs2.mkdir(storeRoot, { recursive: true });
|
|
745
|
-
const existing = await fs2.lstat(storePath).then((
|
|
746
|
-
if (
|
|
914
|
+
const existing = await fs2.lstat(storePath).then((stat4) => stat4).catch((error) => {
|
|
915
|
+
if (isNodeError2(error, "ENOENT")) {
|
|
747
916
|
return null;
|
|
748
917
|
}
|
|
749
918
|
throw error;
|
|
@@ -820,16 +989,16 @@ async function renameWithRollback(from, to, backupPath) {
|
|
|
820
989
|
async function inspectSkill(context) {
|
|
821
990
|
const destination = getDestination(context);
|
|
822
991
|
const source = getSource(context);
|
|
823
|
-
let
|
|
992
|
+
let stat4;
|
|
824
993
|
try {
|
|
825
|
-
|
|
994
|
+
stat4 = await fs2.lstat(destination);
|
|
826
995
|
} catch (error) {
|
|
827
|
-
if (
|
|
996
|
+
if (isNodeError2(error, "ENOENT")) {
|
|
828
997
|
return statusOf(context, "missing", { managed: true });
|
|
829
998
|
}
|
|
830
999
|
throw error;
|
|
831
1000
|
}
|
|
832
|
-
if (!
|
|
1001
|
+
if (!stat4.isSymbolicLink()) {
|
|
833
1002
|
return statusOf(context, "unmanaged");
|
|
834
1003
|
}
|
|
835
1004
|
const linkTarget = await fs2.readlink(destination);
|
|
@@ -837,7 +1006,7 @@ async function inspectSkill(context) {
|
|
|
837
1006
|
try {
|
|
838
1007
|
await fs2.stat(absoluteTarget);
|
|
839
1008
|
} catch (error) {
|
|
840
|
-
if (!
|
|
1009
|
+
if (!isNodeError2(error, "ENOENT")) {
|
|
841
1010
|
throw error;
|
|
842
1011
|
}
|
|
843
1012
|
return statusOf(context, "broken", {
|
|
@@ -1341,6 +1510,20 @@ var DoorayApiClient = class {
|
|
|
1341
1510
|
throw await toDoorayCliError(e);
|
|
1342
1511
|
}
|
|
1343
1512
|
}
|
|
1513
|
+
async createProjectTag(projectId, body) {
|
|
1514
|
+
try {
|
|
1515
|
+
return await this.api.post(`project/v1/projects/${projectId}/tags`, { json: body }).json();
|
|
1516
|
+
} catch (e) {
|
|
1517
|
+
throw await toDoorayCliError(e);
|
|
1518
|
+
}
|
|
1519
|
+
}
|
|
1520
|
+
async updateProjectTagGroup(projectId, tagGroupId, body) {
|
|
1521
|
+
try {
|
|
1522
|
+
return await this.api.put(`project/v1/projects/${projectId}/tag-groups/${tagGroupId}`, { json: body }).json();
|
|
1523
|
+
} catch (e) {
|
|
1524
|
+
throw await toDoorayCliError(e);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1344
1527
|
// ─── Member Groups ──────────────────────────────────
|
|
1345
1528
|
async getProjectMemberGroups(projectId, params) {
|
|
1346
1529
|
try {
|
|
@@ -1419,6 +1602,13 @@ var DoorayApiClient = class {
|
|
|
1419
1602
|
throw await toDoorayCliError(e);
|
|
1420
1603
|
}
|
|
1421
1604
|
}
|
|
1605
|
+
async getWikiPageStandalone(pageId) {
|
|
1606
|
+
try {
|
|
1607
|
+
return await this.api.get(`wiki/v1/pages/${pageId}`).json();
|
|
1608
|
+
} catch (e) {
|
|
1609
|
+
throw await toDoorayCliError(e);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1422
1612
|
async createWikiPage(wikiId, body) {
|
|
1423
1613
|
try {
|
|
1424
1614
|
return await this.api.post(`wiki/v1/wikis/${wikiId}/pages`, { json: body }).json();
|
|
@@ -1447,7 +1637,7 @@ var DoorayApiClient = class {
|
|
|
1447
1637
|
throw await toDoorayCliError(e);
|
|
1448
1638
|
}
|
|
1449
1639
|
}
|
|
1450
|
-
//
|
|
1640
|
+
// Dooray 공식 API 문서에 있는 endpoint 다 (ADR-032)
|
|
1451
1641
|
async deleteWikiPage(wikiId, pageId) {
|
|
1452
1642
|
try {
|
|
1453
1643
|
return await this.api.delete(`wiki/v1/wikis/${wikiId}/pages/${pageId}`).json();
|
|
@@ -1455,6 +1645,13 @@ var DoorayApiClient = class {
|
|
|
1455
1645
|
throw await toDoorayCliError(e);
|
|
1456
1646
|
}
|
|
1457
1647
|
}
|
|
1648
|
+
async moveWikiPage(wikiId, pageId, body) {
|
|
1649
|
+
try {
|
|
1650
|
+
return await this.api.post(`wiki/v1/wikis/${wikiId}/pages/${pageId}/move`, { json: body }).json();
|
|
1651
|
+
} catch (e) {
|
|
1652
|
+
throw await toDoorayCliError(e);
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1458
1655
|
// ─── Post Files ─────────────────────────────────────
|
|
1459
1656
|
async getPostFiles(projectId, postId) {
|
|
1460
1657
|
try {
|
|
@@ -1779,22 +1976,56 @@ function formatSkillStatus(status) {
|
|
|
1779
1976
|
return import_chalk3.default.yellow("\u26A0\uFE0F \uC218\uC815\uB428 \u2014 dooray skill update --force");
|
|
1780
1977
|
}
|
|
1781
1978
|
}
|
|
1782
|
-
|
|
1783
|
-
|
|
1979
|
+
async function probeApiConnection() {
|
|
1980
|
+
try {
|
|
1981
|
+
const validConfig = await getConfigOrThrow();
|
|
1982
|
+
const client = new DoorayApiClient(validConfig.apiKey, validConfig.baseUrl);
|
|
1983
|
+
await client.getProjects({ page: 0, size: 1 });
|
|
1984
|
+
await ensureMe(client);
|
|
1985
|
+
return "ok";
|
|
1986
|
+
} catch {
|
|
1987
|
+
return "failed";
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
var doctorCommand = new import_commander3.Command("doctor").description("\uC124\uC815 \uBC0F \uD658\uACBD \uC9C4\uB2E8").option("--json", "JSON \uD615\uC2DD\uC73C\uB85C \uCD9C\uB825").action(async (opts, command) => {
|
|
1784
1991
|
const config = await getConfig();
|
|
1785
|
-
const apiKeyOk = !!config
|
|
1786
|
-
const baseUrlOk = !!config
|
|
1787
|
-
|
|
1788
|
-
|
|
1992
|
+
const apiKeyOk = config.state === "ok" && !!config.config.apiKey;
|
|
1993
|
+
const baseUrlOk = config.state === "ok" && !!config.config.baseUrl;
|
|
1994
|
+
const json = opts.json || !!command.parent?.opts().json;
|
|
1995
|
+
if (json) {
|
|
1996
|
+
const payload = {
|
|
1997
|
+
configState: config.state,
|
|
1998
|
+
apiKeyOk,
|
|
1999
|
+
baseUrlOk
|
|
2000
|
+
};
|
|
2001
|
+
if (config.state === "invalid" || config.state === "unreadable") {
|
|
2002
|
+
payload.reason = config.reason;
|
|
2003
|
+
}
|
|
2004
|
+
payload.apiConnection = apiKeyOk && baseUrlOk ? await probeApiConnection() : "skipped";
|
|
2005
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
2006
|
+
return;
|
|
2007
|
+
}
|
|
2008
|
+
console.log(import_chalk3.default.bold("\n\u{1F50D} Dooray CLI \uC9C4\uB2E8\n"));
|
|
2009
|
+
if (config.state === "invalid") {
|
|
2010
|
+
console.log(` \uC124\uC815 \uD30C\uC77C: ${import_chalk3.default.red("\u274C \uC190\uC0C1")}`);
|
|
2011
|
+
console.log(` \uC774\uC720: ${config.reason}`);
|
|
2012
|
+
} else if (config.state === "unreadable") {
|
|
2013
|
+
console.log(` \uC124\uC815 \uD30C\uC77C: ${import_chalk3.default.red("\u274C \uC77D\uAE30 \uC2E4\uD328")}`);
|
|
2014
|
+
console.log(` \uC774\uC720: ${config.reason}`);
|
|
2015
|
+
console.log(" \uD30C\uC77C \uAD8C\uD55C\uC744 \uD655\uC778\uD558\uC138\uC694.");
|
|
2016
|
+
} else {
|
|
2017
|
+
const okConfig = config.state === "ok" ? config.config : void 0;
|
|
2018
|
+
console.log(` API Key: ${apiKeyOk ? import_chalk3.default.green("\u2705 \uC124\uC815\uB428") : import_chalk3.default.red("\u274C \uBBF8\uC124\uC815")}`);
|
|
2019
|
+
console.log(` Base URL: ${okConfig?.baseUrl ? import_chalk3.default.green(`\u2705 ${okConfig.baseUrl}`) : import_chalk3.default.red("\u274C \uBBF8\uC124\uC815")}`);
|
|
2020
|
+
}
|
|
1789
2021
|
if (apiKeyOk && baseUrlOk) {
|
|
1790
2022
|
console.log(import_chalk3.default.bold("\n\u{1F310} API \uC5F0\uACB0 \uD14C\uC2A4\uD2B8\n"));
|
|
1791
|
-
|
|
2023
|
+
if (await probeApiConnection() === "ok") {
|
|
1792
2024
|
const validConfig = await getConfigOrThrow();
|
|
1793
2025
|
const client = new DoorayApiClient(validConfig.apiKey, validConfig.baseUrl);
|
|
1794
|
-
await client.getProjects({ page: 0, size: 1 });
|
|
1795
2026
|
const me = await ensureMe(client);
|
|
1796
2027
|
console.log(` \uC5F0\uACB0: ${import_chalk3.default.green("\u2705 \uC131\uACF5")} (${me.name})`);
|
|
1797
|
-
}
|
|
2028
|
+
} else {
|
|
1798
2029
|
console.log(` \uC5F0\uACB0: ${import_chalk3.default.red("\u274C \uC2E4\uD328 \u2014 API \uD0A4 \uB610\uB294 URL\uC744 \uD655\uC778\uD558\uC138\uC694")}`);
|
|
1799
2030
|
}
|
|
1800
2031
|
}
|
|
@@ -1822,6 +2053,10 @@ var doctorCommand = new import_commander3.Command("doctor").description("\uC124\
|
|
|
1822
2053
|
console.log();
|
|
1823
2054
|
if (apiKeyOk && baseUrlOk) {
|
|
1824
2055
|
console.log(import_chalk3.default.green("\u2713 \uAE30\uBCF8 \uC124\uC815\uC774 \uC644\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4."));
|
|
2056
|
+
} else if (config.state === "invalid") {
|
|
2057
|
+
console.log(import_chalk3.default.yellow("\u26A0 \uC124\uC815 \uD30C\uC77C\uC774 \uC190\uC0C1\uB418\uC5C8\uC2B5\uB2C8\uB2E4."));
|
|
2058
|
+
} else if (config.state === "unreadable") {
|
|
2059
|
+
console.log(import_chalk3.default.yellow("\u26A0 \uC124\uC815 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4."));
|
|
1825
2060
|
} else {
|
|
1826
2061
|
console.log(import_chalk3.default.yellow("\u26A0 \uC124\uC815\uC774 \uD544\uC694\uD569\uB2C8\uB2E4:"));
|
|
1827
2062
|
console.log(import_chalk3.default.yellow(" dooray setup"));
|
|
@@ -1836,7 +2071,21 @@ var import_path2 = __toESM(require("path"));
|
|
|
1836
2071
|
var import_promises6 = __toESM(require("fs/promises"));
|
|
1837
2072
|
var setupCommand = new import_commander4.Command("setup").description("\uB300\uD654\uD615 \uCD08\uAE30 \uC124\uC815 \uB9C8\uBC95\uC0AC").action(async () => {
|
|
1838
2073
|
const { input: input2, select, password, confirm: confirm2 } = await import("@inquirer/prompts");
|
|
1839
|
-
const
|
|
2074
|
+
const existingResult = await getConfig();
|
|
2075
|
+
const existing = existingResult.state === "ok" ? existingResult.config : void 0;
|
|
2076
|
+
if (existingResult.state === "unreadable") {
|
|
2077
|
+
console.log(
|
|
2078
|
+
import_chalk4.default.yellow(
|
|
2079
|
+
` \u26A0 \uAE30\uC874 \uC124\uC815 \uD30C\uC77C\uC744 \uC77D\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4. \uC800\uC7A5\uB3C4 \uC2E4\uD328\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4: ${existingResult.reason}`
|
|
2080
|
+
)
|
|
2081
|
+
);
|
|
2082
|
+
} else if (existingResult.state === "invalid") {
|
|
2083
|
+
console.log(
|
|
2084
|
+
import_chalk4.default.yellow(
|
|
2085
|
+
` \u26A0 \uAE30\uC874 \uC124\uC815 \uD30C\uC77C\uC774 \uC190\uC0C1\uB418\uC5B4 \uAE30\uBCF8\uAC12\uC73C\uB85C \uC4F0\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: ${existingResult.reason}`
|
|
2086
|
+
)
|
|
2087
|
+
);
|
|
2088
|
+
}
|
|
1840
2089
|
try {
|
|
1841
2090
|
const tenantName = await input2({
|
|
1842
2091
|
message: "\uD14C\uB10C\uD2B8\uBA85\uC744 \uC785\uB825\uD558\uC138\uC694",
|
|
@@ -1959,12 +2208,19 @@ var setupCommand = new import_commander4.Command("setup").description("\uB300\uD
|
|
|
1959
2208
|
smtpPort: useMail ? DEFAULTS.smtpPort : existing?.smtpPort
|
|
1960
2209
|
};
|
|
1961
2210
|
config.trackLastRun = trackLastRun;
|
|
1962
|
-
await
|
|
2211
|
+
const { cacheCleared } = await replaceConfig(config);
|
|
1963
2212
|
console.log(
|
|
1964
2213
|
import_chalk4.default.green(
|
|
1965
2214
|
"\n\u2713 \uC124\uC815 \uC644\uB8CC. dooray doctor\uB85C \uC0C1\uD0DC\uB97C \uD655\uC778\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4."
|
|
1966
2215
|
)
|
|
1967
2216
|
);
|
|
2217
|
+
if (cacheCleared) {
|
|
2218
|
+
console.log(
|
|
2219
|
+
import_chalk4.default.gray(
|
|
2220
|
+
" \uACC4\uC815\uC774\uB098 \uC811\uC18D \uD658\uACBD\uC774 \uBC14\uB00C\uC5B4 \uCE90\uC2DC\uB97C \uBE44\uC6E0\uC2B5\uB2C8\uB2E4. \uB2E4\uC74C \uC870\uD68C\uAC00 API \uB97C \uB2E4\uC2DC \uD638\uCD9C\uD569\uB2C8\uB2E4."
|
|
2221
|
+
)
|
|
2222
|
+
);
|
|
2223
|
+
}
|
|
1968
2224
|
} catch (err) {
|
|
1969
2225
|
if (err != null && typeof err === "object" && "name" in err && err.name === "ExitPromptError") {
|
|
1970
2226
|
console.log(import_chalk4.default.yellow("\n\uC124\uC815\uC774 \uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4."));
|
|
@@ -2092,6 +2348,20 @@ async function ensurePrivateProjects(client) {
|
|
|
2092
2348
|
await setPrivateProjects(items);
|
|
2093
2349
|
return items;
|
|
2094
2350
|
}
|
|
2351
|
+
async function buildProjectCodeMap(client) {
|
|
2352
|
+
const map = /* @__PURE__ */ new Map();
|
|
2353
|
+
const projects = await ensureProjects(client);
|
|
2354
|
+
for (const p of projects) {
|
|
2355
|
+
map.set(p.id, p.code);
|
|
2356
|
+
}
|
|
2357
|
+
const privateCached = await getPrivateProjects();
|
|
2358
|
+
if (privateCached && !isExpired(privateCached.updatedAt, PROJECTS_TTL_MS)) {
|
|
2359
|
+
for (const p of privateCached.data) {
|
|
2360
|
+
map.set(p.id, p.code);
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
return map;
|
|
2364
|
+
}
|
|
2095
2365
|
async function resolveProject(client, input2) {
|
|
2096
2366
|
if (PROJECT_ID_RE.test(input2)) {
|
|
2097
2367
|
return input2;
|
|
@@ -2106,8 +2376,8 @@ async function resolveProject(client, input2) {
|
|
|
2106
2376
|
}
|
|
2107
2377
|
throw new DoorayCliError(
|
|
2108
2378
|
`\uD504\uB85C\uC81D\uD2B8\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4: ${input2}
|
|
2109
|
-
\uAC1C\uC778 \uD504\uB85C\uC81D\uD2B8\uB77C\uBA74
|
|
2110
|
-
|
|
2379
|
+
\uAC1C\uC778 \uD504\uB85C\uC81D\uD2B8\uB77C\uBA74 \uCE90\uC2DC\uB97C \uAC31\uC2E0\uD558\uC138\uC694: dooray project list --type private
|
|
2380
|
+
\uBAA9\uB85D\uC5D0 \uC5C6\uB294 \uD504\uB85C\uC81D\uD2B8\uB294 projectId \uB97C \uC9C1\uC811 \uB123\uC73C\uBA74 \uB429\uB2C8\uB2E4 (15\uC790\uB9AC \uC774\uC0C1 \uC22B\uC790)`,
|
|
2111
2381
|
EXIT_PARAM_ERROR
|
|
2112
2382
|
);
|
|
2113
2383
|
}
|
|
@@ -2452,8 +2722,8 @@ async function resolveMemberGroup(client, projectId, input2) {
|
|
|
2452
2722
|
const skipped = groups.length - valid.length;
|
|
2453
2723
|
if (skipped > 0) {
|
|
2454
2724
|
process.stderr.write(
|
|
2455
|
-
//
|
|
2456
|
-
`\u26A0 ${skipped}\uAC1C \uADF8\uB8F9\uC5D0 code \uAC00 \uC5C6\uC5B4 \uB9E4\uCE6D\uC5D0\uC11C \uC81C\uC678\uD588\uC2B5\uB2C8\uB2E4
|
|
2725
|
+
// code 누락 그룹 제외 근거는 ADR-028 이다.
|
|
2726
|
+
`\u26A0 ${skipped}\uAC1C \uADF8\uB8F9\uC5D0 code \uAC00 \uC5C6\uC5B4 \uB9E4\uCE6D\uC5D0\uC11C \uC81C\uC678\uD588\uC2B5\uB2C8\uB2E4.
|
|
2457
2727
|
id \uC9C1\uC811 \uC785\uB825 (15+\uC790\uB9AC numeric) \uB610\uB294 UI \uC218\uB3D9 cc / \`--cc <member>\` \uC6B0\uD68C \uAC00\uB2A5.
|
|
2458
2728
|
`
|
|
2459
2729
|
);
|
|
@@ -2650,17 +2920,50 @@ async function validateMandatoryCoverage(client, projectId, selectedTagIds) {
|
|
|
2650
2920
|
);
|
|
2651
2921
|
}
|
|
2652
2922
|
}
|
|
2923
|
+
async function resolveTagGroup(client, projectId, input2) {
|
|
2924
|
+
const name = input2.trim();
|
|
2925
|
+
if (!name) {
|
|
2926
|
+
throw new DoorayCliError("\uD0DC\uADF8 \uADF8\uB8F9 \uC774\uB984\uC774 \uBE44\uC5B4 \uC788\uC2B5\uB2C8\uB2E4", EXIT_PARAM_ERROR);
|
|
2927
|
+
}
|
|
2928
|
+
const tags = await ensureTags(client, projectId);
|
|
2929
|
+
const groups = [];
|
|
2930
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2931
|
+
for (const t of tags) {
|
|
2932
|
+
if (!t.groupId || seen.has(t.groupId)) continue;
|
|
2933
|
+
seen.add(t.groupId);
|
|
2934
|
+
groups.push({
|
|
2935
|
+
id: t.groupId,
|
|
2936
|
+
name: t.groupName ?? "",
|
|
2937
|
+
mandatory: t.groupMandatory,
|
|
2938
|
+
selectOne: t.groupSelectOne
|
|
2939
|
+
});
|
|
2940
|
+
}
|
|
2941
|
+
if (groups.length === 0) {
|
|
2942
|
+
throw new DoorayCliError(
|
|
2943
|
+
`\uC774 \uD504\uB85C\uC81D\uD2B8\uC5D0\uB294 \uD0DC\uADF8 \uADF8\uB8F9\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
|
|
2944
|
+
\uADF8\uB8F9\uC740 \uD0DC\uADF8 \uBAA9\uB85D\uC5D0\uC11C \uD30C\uC0DD\uD558\uBBC0\uB85C \uD0DC\uADF8\uAC00 \uD558\uB098\uB3C4 \uC5C6\uC73C\uBA74 \uC54C \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
|
|
2945
|
+
\uBA3C\uC800 \uD0DC\uADF8\uB97C \uB9CC\uB4DC\uC138\uC694: dooray project tags create <project> --name "${name}:<\uD0DC\uADF8>"`,
|
|
2946
|
+
EXIT_PARAM_ERROR
|
|
2947
|
+
);
|
|
2948
|
+
}
|
|
2949
|
+
return matchByName(groups, name, "\uD0DC\uADF8 \uADF8\uB8F9", (g) => `${g.name} (${g.id})`);
|
|
2950
|
+
}
|
|
2653
2951
|
|
|
2654
2952
|
// src/commands/project/tags.ts
|
|
2655
|
-
|
|
2656
|
-
const globalOpts = projectTagsCommand.optsWithGlobals();
|
|
2953
|
+
async function runTagsList(project, opts) {
|
|
2657
2954
|
const config = await getConfigOrThrow();
|
|
2658
2955
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
2659
2956
|
startSpinner("\uD0DC\uADF8 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
2660
|
-
|
|
2661
|
-
|
|
2957
|
+
let tags;
|
|
2958
|
+
try {
|
|
2959
|
+
const projectId = await resolveProject(client, project);
|
|
2960
|
+
tags = await ensureTags(client, projectId);
|
|
2961
|
+
} catch (e) {
|
|
2962
|
+
stopSpinner(false, "\uD0DC\uADF8 \uBAA9\uB85D \uC870\uD68C \uC2E4\uD328");
|
|
2963
|
+
throw e;
|
|
2964
|
+
}
|
|
2662
2965
|
stopSpinner(true, "\uD0DC\uADF8 \uBAA9\uB85D \uC870\uD68C \uC644\uB8CC");
|
|
2663
|
-
output(
|
|
2966
|
+
output(opts, {
|
|
2664
2967
|
headers: ["ID", "Color", "Name", "Group", "Mandatory"],
|
|
2665
2968
|
rows: tags.map((t) => [
|
|
2666
2969
|
t.id,
|
|
@@ -2672,11 +2975,136 @@ var projectTagsCommand = new import_commander10.Command("tags").description("\uD
|
|
|
2672
2975
|
raw: tags,
|
|
2673
2976
|
ids: tags.map((t) => t.id)
|
|
2674
2977
|
});
|
|
2978
|
+
}
|
|
2979
|
+
var projectTagsCommand = new import_commander10.Command("tags").description("\uD504\uB85C\uC81D\uD2B8 \uD0DC\uADF8 \uC870\uD68C\xB7\uC0DD\uC131\xB7\uADF8\uB8F9 \uBCC0\uACBD").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID (\uC0DD\uB7B5\uD558\uBA74 \uB3C4\uC6C0\uB9D0)").action(async (project) => {
|
|
2980
|
+
if (!project) {
|
|
2981
|
+
projectTagsCommand.help({ error: true });
|
|
2982
|
+
return;
|
|
2983
|
+
}
|
|
2984
|
+
await runTagsList(project, projectTagsCommand.optsWithGlobals());
|
|
2985
|
+
});
|
|
2986
|
+
var projectTagsListCommand = new import_commander10.Command("list").description("\uD504\uB85C\uC81D\uD2B8 \uD0DC\uADF8 \uBAA9\uB85D \uC870\uD68C").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").action(async (project) => {
|
|
2987
|
+
await runTagsList(project, projectTagsListCommand.optsWithGlobals());
|
|
2675
2988
|
});
|
|
2676
2989
|
|
|
2677
|
-
// src/commands/project/
|
|
2990
|
+
// src/commands/project/tags-create.ts
|
|
2678
2991
|
var import_commander11 = require("commander");
|
|
2679
2992
|
|
|
2993
|
+
// src/services/tag.ts
|
|
2994
|
+
async function invalidateTags(projectId) {
|
|
2995
|
+
try {
|
|
2996
|
+
await clearTags(projectId);
|
|
2997
|
+
} catch (e) {
|
|
2998
|
+
const msg = e instanceof Error ? e.message : String(e);
|
|
2999
|
+
process.stderr.write(
|
|
3000
|
+
`\u26A0 \uD0DC\uADF8 \uCE90\uC2DC \uC0AD\uC81C \uC2E4\uD328 (\uBCC0\uACBD\uC740 \uBC18\uC601\uB428): ${msg}
|
|
3001
|
+
\uCD5C\uC2E0 \uD0DC\uADF8\uAC00 \uC548 \uBCF4\uC774\uBA74: dooray cache clear
|
|
3002
|
+
`
|
|
3003
|
+
);
|
|
3004
|
+
}
|
|
3005
|
+
}
|
|
3006
|
+
async function createTag(client, projectId, body) {
|
|
3007
|
+
const res = await client.createProjectTag(projectId, body);
|
|
3008
|
+
await invalidateTags(projectId);
|
|
3009
|
+
return res.result.id;
|
|
3010
|
+
}
|
|
3011
|
+
async function updateTagGroup(client, projectId, tagGroupId, body) {
|
|
3012
|
+
await client.updateProjectTagGroup(projectId, tagGroupId, body);
|
|
3013
|
+
await invalidateTags(projectId);
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
// src/commands/project/tags-create.ts
|
|
3017
|
+
var DEFAULT_TAG_COLOR = "e0e0e0";
|
|
3018
|
+
function normalizeTagColor(input2) {
|
|
3019
|
+
if (input2 === void 0) return DEFAULT_TAG_COLOR;
|
|
3020
|
+
const trimmed = input2.trim();
|
|
3021
|
+
if (!trimmed) return DEFAULT_TAG_COLOR;
|
|
3022
|
+
const stripped = trimmed.startsWith("#") ? trimmed.slice(1) : trimmed;
|
|
3023
|
+
if (!/^[0-9a-fA-F]{6}$/.test(stripped)) {
|
|
3024
|
+
throw new DoorayCliError(
|
|
3025
|
+
`\uC0C9\uC0C1 \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: "${input2}"
|
|
3026
|
+
6\uC790\uB9AC hex \uB97C \uC9C0\uC815\uD558\uC138\uC694 (\uC608: c6eab3 \uB610\uB294 #c6eab3)`,
|
|
3027
|
+
EXIT_PARAM_ERROR
|
|
3028
|
+
);
|
|
3029
|
+
}
|
|
3030
|
+
return stripped.toLowerCase();
|
|
3031
|
+
}
|
|
3032
|
+
var projectTagsCreateCommand = new import_commander11.Command("create").description("\uD504\uB85C\uC81D\uD2B8 \uD0DC\uADF8 \uC0DD\uC131").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").option("--name <name>", '\uD0DC\uADF8 \uC774\uB984 ("<\uADF8\uB8F9>:<\uD0DC\uADF8>" \uD615\uC2DD, \uADF8\uB8F9 \uC0DD\uB7B5 \uAC00\uB2A5) \u2014 \uD544\uC218').option("--color <hex>", `\uD0DC\uADF8 \uC0C9\uC0C1 (6\uC790\uB9AC hex, \uAE30\uBCF8\uAC12 ${DEFAULT_TAG_COLOR})`).action(async (project) => {
|
|
3033
|
+
const opts = projectTagsCreateCommand.opts();
|
|
3034
|
+
const globalOpts = projectTagsCreateCommand.optsWithGlobals();
|
|
3035
|
+
const name = (opts.name ?? "").trim();
|
|
3036
|
+
if (!name) {
|
|
3037
|
+
throw new DoorayCliError(
|
|
3038
|
+
'--name \uC774 \uD544\uC694\uD569\uB2C8\uB2E4 (\uC608: --name "\uBC30\uD3EC\uD658\uACBD:staging")',
|
|
3039
|
+
EXIT_PARAM_ERROR
|
|
3040
|
+
);
|
|
3041
|
+
}
|
|
3042
|
+
const color = normalizeTagColor(opts.color);
|
|
3043
|
+
const config = await getConfigOrThrow();
|
|
3044
|
+
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
3045
|
+
startSpinner("\uD0DC\uADF8 \uC0DD\uC131 \uC911...");
|
|
3046
|
+
let tagId;
|
|
3047
|
+
try {
|
|
3048
|
+
const projectId = await resolveProject(client, project);
|
|
3049
|
+
tagId = await createTag(client, projectId, { name, color });
|
|
3050
|
+
} catch (e) {
|
|
3051
|
+
stopSpinner(false, "\uD0DC\uADF8 \uC0DD\uC131 \uC2E4\uD328");
|
|
3052
|
+
throw e;
|
|
3053
|
+
}
|
|
3054
|
+
stopSpinner(true, "\uD0DC\uADF8 \uC0DD\uC131 \uC644\uB8CC");
|
|
3055
|
+
if (globalOpts.json) {
|
|
3056
|
+
printJson({ id: tagId, name, color });
|
|
3057
|
+
} else if (globalOpts.quiet) {
|
|
3058
|
+
printQuiet([tagId]);
|
|
3059
|
+
} else {
|
|
3060
|
+
process.stdout.write(`\uD0DC\uADF8\uAC00 \uC0DD\uC131\uB418\uC5C8\uC2B5\uB2C8\uB2E4: ${name} (${tagId})
|
|
3061
|
+
`);
|
|
3062
|
+
}
|
|
3063
|
+
});
|
|
3064
|
+
|
|
3065
|
+
// src/commands/project/tags-group.ts
|
|
3066
|
+
var import_commander12 = require("commander");
|
|
3067
|
+
var projectTagsGroupCommand = new import_commander12.Command("group").description("\uD0DC\uADF8 \uADF8\uB8F9 \uC18D\uC131 \uBCC0\uACBD").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").argument("<group>", "\uD0DC\uADF8 \uADF8\uB8F9 \uC774\uB984").option("--mandatory", "\uC774 \uADF8\uB8F9\uC5D0\uC11C \uD0DC\uADF8\uB97C \uBC18\uB4DC\uC2DC \uD558\uB098 \uACE0\uB974\uAC8C \uD55C\uB2E4").option("--no-mandatory", "\uD544\uC218 \uC9C0\uC815\uC744 \uD574\uC81C\uD55C\uB2E4").option("--select-one", "\uC774 \uADF8\uB8F9\uC5D0\uC11C \uD0DC\uADF8\uB97C \uD558\uB098\uB9CC \uACE0\uB974\uAC8C \uD55C\uB2E4").option("--no-select-one", "\uB2E8\uC77C \uC120\uD0DD\uC744 \uD574\uC81C\uD55C\uB2E4").action(async (project, group) => {
|
|
3068
|
+
const opts = projectTagsGroupCommand.opts();
|
|
3069
|
+
const globalOpts = projectTagsGroupCommand.optsWithGlobals();
|
|
3070
|
+
if (opts.mandatory === void 0 && opts.selectOne === void 0) {
|
|
3071
|
+
throw new DoorayCliError(
|
|
3072
|
+
"\uBC14\uAFC0 \uC18D\uC131\uC744 \uC9C0\uC815\uD558\uC138\uC694: --mandatory / --no-mandatory / --select-one / --no-select-one",
|
|
3073
|
+
EXIT_PARAM_ERROR
|
|
3074
|
+
);
|
|
3075
|
+
}
|
|
3076
|
+
const config = await getConfigOrThrow();
|
|
3077
|
+
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
3078
|
+
startSpinner("\uD0DC\uADF8 \uADF8\uB8F9 \uBCC0\uACBD \uC911...");
|
|
3079
|
+
let resolved;
|
|
3080
|
+
let mandatory;
|
|
3081
|
+
let selectOne;
|
|
3082
|
+
try {
|
|
3083
|
+
const projectId = await resolveProject(client, project);
|
|
3084
|
+
resolved = await resolveTagGroup(client, projectId, group);
|
|
3085
|
+
mandatory = opts.mandatory ?? resolved.mandatory;
|
|
3086
|
+
selectOne = opts.selectOne ?? resolved.selectOne;
|
|
3087
|
+
await updateTagGroup(client, projectId, resolved.id, { mandatory, selectOne });
|
|
3088
|
+
} catch (e) {
|
|
3089
|
+
stopSpinner(false, "\uD0DC\uADF8 \uADF8\uB8F9 \uBCC0\uACBD \uC2E4\uD328");
|
|
3090
|
+
throw e;
|
|
3091
|
+
}
|
|
3092
|
+
stopSpinner(true, "\uD0DC\uADF8 \uADF8\uB8F9 \uBCC0\uACBD \uC644\uB8CC");
|
|
3093
|
+
if (globalOpts.json) {
|
|
3094
|
+
printJson({ id: resolved.id, name: resolved.name, mandatory, selectOne });
|
|
3095
|
+
} else if (globalOpts.quiet) {
|
|
3096
|
+
printQuiet([resolved.id]);
|
|
3097
|
+
} else {
|
|
3098
|
+
process.stdout.write(
|
|
3099
|
+
`\uD0DC\uADF8 \uADF8\uB8F9\uC774 \uBCC0\uACBD\uB418\uC5C8\uC2B5\uB2C8\uB2E4: ${resolved.name} (\uD544\uC218 ${mandatory ? "Y" : "N"}, \uB2E8\uC77C \uC120\uD0DD ${selectOne ? "Y" : "N"})
|
|
3100
|
+
`
|
|
3101
|
+
);
|
|
3102
|
+
}
|
|
3103
|
+
});
|
|
3104
|
+
|
|
3105
|
+
// src/commands/project/templates.ts
|
|
3106
|
+
var import_commander13 = require("commander");
|
|
3107
|
+
|
|
2680
3108
|
// src/resolvers/template.ts
|
|
2681
3109
|
var TEMPLATE_ID_RE = /^\d{15,}$/;
|
|
2682
3110
|
async function fetchAllTemplates(client, projectId) {
|
|
@@ -2714,7 +3142,7 @@ async function resolveTemplate(client, projectId, input2) {
|
|
|
2714
3142
|
}
|
|
2715
3143
|
|
|
2716
3144
|
// src/commands/project/templates.ts
|
|
2717
|
-
var projectTemplatesCommand = new
|
|
3145
|
+
var projectTemplatesCommand = new import_commander13.Command("templates").description("\uD504\uB85C\uC81D\uD2B8 \uD15C\uD50C\uB9BF \uBAA9\uB85D \uC870\uD68C").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").action(async (project) => {
|
|
2718
3146
|
const globalOpts = projectTemplatesCommand.optsWithGlobals();
|
|
2719
3147
|
const config = await getConfigOrThrow();
|
|
2720
3148
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -2736,7 +3164,7 @@ var projectTemplatesCommand = new import_commander11.Command("templates").descri
|
|
|
2736
3164
|
});
|
|
2737
3165
|
|
|
2738
3166
|
// src/commands/post/list.ts
|
|
2739
|
-
var
|
|
3167
|
+
var import_commander14 = require("commander");
|
|
2740
3168
|
|
|
2741
3169
|
// src/formatters/post.ts
|
|
2742
3170
|
function formatPostList(posts, opts) {
|
|
@@ -2787,7 +3215,7 @@ function formatCommentList(comments, opts) {
|
|
|
2787
3215
|
}
|
|
2788
3216
|
|
|
2789
3217
|
// src/commands/post/list.ts
|
|
2790
|
-
var postListCommand = new
|
|
3218
|
+
var postListCommand = new import_commander14.Command("list").description("\uC5C5\uBB34 \uBAA9\uB85D \uC870\uD68C").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").option("--subject <keyword>", "\uC81C\uBAA9 \uD0A4\uC6CC\uB4DC \uD544\uD130\uB9C1").option("--all", "\uC804\uCCB4 \uD398\uC774\uC9C0\uB124\uC774\uC158 (\uBAA8\uB4E0 \uACB0\uACFC \uC870\uD68C)").option("--page <number>", "\uD398\uC774\uC9C0 \uBC88\uD638", "0").option("--size <number>", "\uD398\uC774\uC9C0 \uD06C\uAE30", "20").action(async (project, opts) => {
|
|
2791
3219
|
const globalOpts = postListCommand.optsWithGlobals();
|
|
2792
3220
|
const config = await getConfigOrThrow();
|
|
2793
3221
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -2821,8 +3249,8 @@ var postListCommand = new import_commander12.Command("list").description("\uC5C5
|
|
|
2821
3249
|
});
|
|
2822
3250
|
|
|
2823
3251
|
// src/commands/post/search.ts
|
|
2824
|
-
var
|
|
2825
|
-
var postSearchCommand = new
|
|
3252
|
+
var import_commander15 = require("commander");
|
|
3253
|
+
var postSearchCommand = new import_commander15.Command("search").description("\uC5C5\uBB34 \uAC80\uC0C9 (\uC81C\uBAA9 \uD0A4\uC6CC\uB4DC)").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").argument("<keyword>", "\uAC80\uC0C9 \uD0A4\uC6CC\uB4DC").action(async (project, keyword) => {
|
|
2826
3254
|
const globalOpts = postSearchCommand.optsWithGlobals();
|
|
2827
3255
|
const config = await getConfigOrThrow();
|
|
2828
3256
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -2834,7 +3262,7 @@ var postSearchCommand = new import_commander13.Command("search").description("\u
|
|
|
2834
3262
|
});
|
|
2835
3263
|
|
|
2836
3264
|
// src/commands/post/get.ts
|
|
2837
|
-
var
|
|
3265
|
+
var import_commander16 = require("commander");
|
|
2838
3266
|
|
|
2839
3267
|
// src/resolvers/post.ts
|
|
2840
3268
|
async function resolvePost(client, projectId, postNumber) {
|
|
@@ -2873,6 +3301,38 @@ function isLikelyDoorayUrl(input2) {
|
|
|
2873
3301
|
return /^https?:\/\//.test(input2);
|
|
2874
3302
|
}
|
|
2875
3303
|
|
|
3304
|
+
// src/utils/command-hint.ts
|
|
3305
|
+
var SHELL_SAFE = /^[A-Za-z0-9._/:@=-]+$/;
|
|
3306
|
+
function shellQuote(token) {
|
|
3307
|
+
if (SHELL_SAFE.test(token)) return token;
|
|
3308
|
+
return `'${token.replace(/'/g, "'\\''")}'`;
|
|
3309
|
+
}
|
|
3310
|
+
function buildIdModeCommand(argv, positionals, postId) {
|
|
3311
|
+
const pending = [...positionals];
|
|
3312
|
+
const kept = [];
|
|
3313
|
+
for (let i = 0; i < argv.length; i++) {
|
|
3314
|
+
const token = argv[i];
|
|
3315
|
+
if (token.startsWith("--")) {
|
|
3316
|
+
kept.push(token);
|
|
3317
|
+
if (token.includes("=")) continue;
|
|
3318
|
+
const next = argv[i + 1];
|
|
3319
|
+
if (next === void 0) continue;
|
|
3320
|
+
if (next.startsWith("--") || pending.includes(next)) continue;
|
|
3321
|
+
kept.push(next);
|
|
3322
|
+
i++;
|
|
3323
|
+
continue;
|
|
3324
|
+
}
|
|
3325
|
+
const at = pending.indexOf(token);
|
|
3326
|
+
if (at >= 0) {
|
|
3327
|
+
pending.splice(at, 1);
|
|
3328
|
+
continue;
|
|
3329
|
+
}
|
|
3330
|
+
kept.push(token);
|
|
3331
|
+
}
|
|
3332
|
+
kept.push("--id", postId);
|
|
3333
|
+
return `dooray ${kept.map(shellQuote).join(" ")}`;
|
|
3334
|
+
}
|
|
3335
|
+
|
|
2876
3336
|
// src/resolvers/post-input.ts
|
|
2877
3337
|
function classifyPostInputToken(token) {
|
|
2878
3338
|
if (/^https?:\/\//.test(token)) return "url";
|
|
@@ -2897,7 +3357,7 @@ async function resolveByPostId(client, postId) {
|
|
|
2897
3357
|
};
|
|
2898
3358
|
}
|
|
2899
3359
|
async function resolvePostInput(client, args) {
|
|
2900
|
-
const { projectArg, postNumberArg, idOpt, urlOpt } = args;
|
|
3360
|
+
const { projectArg, postNumberArg, idOpt, urlOpt, argv } = args;
|
|
2901
3361
|
const hasPositional = !!projectArg || !!postNumberArg;
|
|
2902
3362
|
if (idOpt && urlOpt) {
|
|
2903
3363
|
throw new DoorayCliError(
|
|
@@ -2954,10 +3414,23 @@ ${URL_FORMAT_HINT}`,
|
|
|
2954
3414
|
if (projectArg && postNumberArg) {
|
|
2955
3415
|
const numType = classifyPostInputToken(postNumberArg);
|
|
2956
3416
|
if (numType === "postId") {
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
3417
|
+
const lead = `"${postNumberArg}" \uB294 \uB0B4\uBD80 ID(postId)\uB85C \uBCF4\uC785\uB2C8\uB2E4.
|
|
3418
|
+
`;
|
|
3419
|
+
if (!argv || argv.length === 0) {
|
|
3420
|
+
throw new DoorayCliError(
|
|
3421
|
+
lead + `\uC5C5\uBB34 \uBC88\uD638(#N)\uAC00 \uC544\uB2CC \uB0B4\uBD80 ID \uB85C \uC870\uD68C\uD558\uB824\uBA74 --id \uC635\uC158\uC744 \uC0AC\uC6A9\uD558\uC138\uC694:
|
|
2960
3422
|
dooray post get --id ${postNumberArg}`,
|
|
3423
|
+
EXIT_PARAM_ERROR
|
|
3424
|
+
);
|
|
3425
|
+
}
|
|
3426
|
+
const completed = buildIdModeCommand(
|
|
3427
|
+
argv,
|
|
3428
|
+
[projectArg, postNumberArg],
|
|
3429
|
+
postNumberArg
|
|
3430
|
+
);
|
|
3431
|
+
throw new DoorayCliError(
|
|
3432
|
+
lead + `\uC5C5\uBB34 \uBC88\uD638(#N)\uAC00 \uC544\uB2CC \uB0B4\uBD80 ID \uB85C \uC9C0\uC815\uD558\uB824\uBA74 <project> \uB97C \uBE7C\uACE0 --id \uB97C \uC501\uB2C8\uB2E4:
|
|
3433
|
+
${completed}`,
|
|
2961
3434
|
EXIT_PARAM_ERROR
|
|
2962
3435
|
);
|
|
2963
3436
|
}
|
|
@@ -2982,7 +3455,7 @@ ${URL_FORMAT_HINT}`,
|
|
|
2982
3455
|
}
|
|
2983
3456
|
|
|
2984
3457
|
// src/commands/post/get.ts
|
|
2985
|
-
var postGetCommand = new
|
|
3458
|
+
var postGetCommand = new import_commander16.Command("get").description("\uC5C5\uBB34 \uC0C1\uC138 \uC870\uD68C").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").action(async (project, postNumberStr, opts) => {
|
|
2986
3459
|
const globalOpts = postGetCommand.optsWithGlobals();
|
|
2987
3460
|
const config = await getConfigOrThrow();
|
|
2988
3461
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -2991,7 +3464,8 @@ var postGetCommand = new import_commander14.Command("get").description("\uC5C5\u
|
|
|
2991
3464
|
projectArg: project,
|
|
2992
3465
|
postNumberArg: postNumberStr,
|
|
2993
3466
|
idOpt: opts.id,
|
|
2994
|
-
urlOpt: opts.url
|
|
3467
|
+
urlOpt: opts.url,
|
|
3468
|
+
argv: process.argv.slice(2)
|
|
2995
3469
|
});
|
|
2996
3470
|
const res = await client.getPost(projectId, postId);
|
|
2997
3471
|
stopSpinner(true, "\uC5C5\uBB34 \uC870\uD68C \uC644\uB8CC");
|
|
@@ -2999,7 +3473,7 @@ var postGetCommand = new import_commander14.Command("get").description("\uC5C5\u
|
|
|
2999
3473
|
});
|
|
3000
3474
|
|
|
3001
3475
|
// src/commands/post/edit.ts
|
|
3002
|
-
var
|
|
3476
|
+
var import_commander17 = require("commander");
|
|
3003
3477
|
|
|
3004
3478
|
// src/utils/mention.ts
|
|
3005
3479
|
function buildMemberMention(m, me) {
|
|
@@ -3356,7 +3830,7 @@ async function resolveUsers(client, projectId, names) {
|
|
|
3356
3830
|
}
|
|
3357
3831
|
return users;
|
|
3358
3832
|
}
|
|
3359
|
-
var postEditCommand = new
|
|
3833
|
+
var postEditCommand = new import_commander17.Command("edit").description("\uC5C5\uBB34 \uC218\uC815 ($EDITOR \uB610\uB294 --title/--body \uC635\uC158)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--title <title>", "\uC81C\uBAA9 \uBCC0\uACBD (non-interactive)").option("--subject <subject>", "--title\uC758 deprecated alias").option("--body <text>", "\uBCF8\uBB38 \uBCC0\uACBD (- \uC785\uB825 \uC2DC stdin, non-interactive)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin, non-interactive)").option("--mention <name>", "\uBA64\uBC84 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--mention-group <code>", "\uADF8\uB8F9 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, code \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--link-task <ref>", "\uB2E4\uB978 \uC5C5\uBB34 \uB9C1\uD06C \uCD94\uAC00 (<project>/<number> \uB610\uB294 postId, \uBC18\uBCF5 \uAC00\uB2A5)", (v, prev) => [...prev, v], []).option("--cc <name>", "\uCC38\uC870\uC790(cc) \uBA64\uBC84 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--cc-group <code>", "\uCC38\uC870\uC790(cc) \uADF8\uB8F9 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uADF8\uB8F9 \uCF54\uB4DC \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--cc-clear", "\uAE30\uC874 \uCC38\uC870\uC790 \uC804\uBD80 \uC81C\uAC70 \uD6C4 \uC2E0\uADDC\uB9CC \uC801\uC6A9 (--cc/--cc-group \uC640 \uC870\uD569 \uAC00\uB2A5)").option("--to <name>", "\uB2F4\uB2F9\uC790(to) \uBA64\uBC84 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--to-group <code>", "\uB2F4\uB2F9\uC790(to) \uADF8\uB8F9 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uADF8\uB8F9 \uCF54\uB4DC \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--to-clear", "\uAE30\uC874 \uB2F4\uB2F9\uC790 \uC804\uBD80 \uC81C\uAC70 \uD6C4 \uC2E0\uADDC\uB9CC \uC801\uC6A9").option("--parent <ref>", "\uC0C1\uC704 \uC5C5\uBB34 \uBCC0\uACBD \u2014 project/number \uB610\uB294 raw postId (post create \uC640 \uB3D9\uC77C \u2014 unset \uC740 \uBBF8\uC9C0\uC6D0, \uC6F9 UI \uC5D0\uC11C \uCC98\uB9AC)").option("--tag <name>", "\uD0DC\uADF8 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uAE30\uC874 \uD0DC\uADF8 \uC720\uC9C0 + \uC2E0\uADDC \uCD94\uAC00 + dedupe)", (v, prev) => [...prev, v], []).option("--tag-clear", "\uAE30\uC874 \uD0DC\uADF8 \uC804\uBD80 \uC81C\uAC70 \uD6C4 --tag \uB9CC \uC801\uC6A9").option("--tag-remove <name>", "\uD2B9\uC815 \uD0DC\uADF8 \uC81C\uAC70 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--dry-run", "API \uD638\uCD9C \uC5C6\uC774 \uD569\uC131\uB41C \uBCF8\uBB38\uB9CC stdout \uCD9C\uB825 (mention/link-task \uC801\uC6A9 \uACB0\uACFC \uBBF8\uB9AC\uBCF4\uAE30)").option("--no-confirm", "\uB204\uB77D attachment \uACBD\uACE0 \uC2DC confirm \uC5C6\uC774 \uC9C4\uD589 (\uC790\uB3D9\uD654\uC6A9)").action(async (project, postNumberStr, opts) => {
|
|
3360
3834
|
const config = await getConfigOrThrow();
|
|
3361
3835
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
3362
3836
|
const mentionInputs = (opts.mention ?? []).filter((s) => s.length > 0);
|
|
@@ -3375,7 +3849,8 @@ var postEditCommand = new import_commander15.Command("edit").description("\uC5C5
|
|
|
3375
3849
|
projectArg: project,
|
|
3376
3850
|
postNumberArg: postNumberStr,
|
|
3377
3851
|
idOpt: opts.id,
|
|
3378
|
-
urlOpt: opts.url
|
|
3852
|
+
urlOpt: opts.url,
|
|
3853
|
+
argv: process.argv.slice(2)
|
|
3379
3854
|
});
|
|
3380
3855
|
const res = await client.getPost(projectId, postId);
|
|
3381
3856
|
const post = res.result;
|
|
@@ -3534,7 +4009,7 @@ var postEditCommand = new import_commander15.Command("edit").description("\uC5C5
|
|
|
3534
4009
|
});
|
|
3535
4010
|
|
|
3536
4011
|
// src/commands/post/create.ts
|
|
3537
|
-
var
|
|
4012
|
+
var import_commander18 = require("commander");
|
|
3538
4013
|
|
|
3539
4014
|
// src/resolvers/milestone.ts
|
|
3540
4015
|
async function fetchAllMilestones(client, projectId) {
|
|
@@ -3580,7 +4055,7 @@ function postUserToCreate(u) {
|
|
|
3580
4055
|
group: u.group
|
|
3581
4056
|
};
|
|
3582
4057
|
}
|
|
3583
|
-
var postCreateCommand = new
|
|
4058
|
+
var postCreateCommand = new import_commander18.Command("create").description("\uC5C5\uBB34 \uC0DD\uC131").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").option("--title <title>", "\uC5C5\uBB34 \uC81C\uBAA9").option("--subject <subject>", "--title\uC758 deprecated alias").option("--to <members...>", "\uB2F4\uB2F9\uC790 (\uC774\uB984 \uB610\uB294 \uC774\uBA54\uC77C, \uC5EC\uB7EC \uBA85 \uAC00\uB2A5)").option("--to-group <code>", "\uB2F4\uB2F9\uC790(to) \uADF8\uB8F9 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uADF8\uB8F9 \uCF54\uB4DC \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--cc <members...>", "\uCC38\uC870\uC790 (\uC774\uB984 \uB610\uB294 \uC774\uBA54\uC77C, \uC5EC\uB7EC \uBA85 \uAC00\uB2A5)").option("--cc-group <code>", "\uCC38\uC870\uC790(cc) \uADF8\uB8F9 \uCD94\uAC00 (\uBC18\uBCF5 \uAC00\uB2A5, \uADF8\uB8F9 \uCF54\uB4DC \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--body <text>", "\uBCF8\uBB38 \uD14D\uC2A4\uD2B8 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--priority <level>", "\uC6B0\uC120\uC21C\uC704 (highest, high, normal, low, lowest)", "normal").option("--due-date <date>", "\uB9C8\uAC10\uC77C (ISO 8601 \uD615\uC2DD)").option("--tag <name>", "\uD0DC\uADF8 \uC774\uB984 (\uBC18\uBCF5 \uAC00\uB2A5)", (value, prev) => [...prev, value], []).option("--mention <name>", "\uBA64\uBC84 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--mention-group <code>", "\uADF8\uB8F9 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, code \uBD80\uBD84\uC77C\uCE58)", (v, prev) => [...prev, v], []).option("--link-task <ref>", "\uB2E4\uB978 \uC5C5\uBB34 \uB9C1\uD06C \uCD94\uAC00 (<project>/<number> \uB610\uB294 postId, \uBC18\uBCF5 \uAC00\uB2A5)", (v, prev) => [...prev, v], []).option("--parent <ref>", "\uBD80\uBAA8 \uC5C5\uBB34 (project/number \uB610\uB294 postId)").option("--template <ref>", "\uD15C\uD50C\uB9BF \uC774\uB984 \uB610\uB294 ID \u2014 body/users/tags \uC790\uB3D9 \uCC44\uC6C0 (\uC0AC\uC6A9\uC790 \uC635\uC158 \uC6B0\uC120)").option("--workflow <name>", "\uCD08\uAE30 \uC6CC\uD06C\uD50C\uB85C\uC6B0 \uC774\uB984 \uB610\uB294 class").option("--milestone <name>", "\uB9C8\uC77C\uC2A4\uD1A4 \uC774\uB984").option("--dry-run", "API \uD638\uCD9C \uC5C6\uC774 \uD569\uC131\uB41C \uBCF8\uBB38\uB9CC stdout \uCD9C\uB825 (mention/link-task \uC801\uC6A9 \uACB0\uACFC \uBBF8\uB9AC\uBCF4\uAE30)").action(async (project, opts) => {
|
|
3584
4059
|
const globalOpts = postCreateCommand.optsWithGlobals();
|
|
3585
4060
|
const config = await getConfigOrThrow();
|
|
3586
4061
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -3717,8 +4192,8 @@ var postCreateCommand = new import_commander16.Command("create").description("\u
|
|
|
3717
4192
|
});
|
|
3718
4193
|
|
|
3719
4194
|
// src/commands/post/done.ts
|
|
3720
|
-
var
|
|
3721
|
-
var postDoneCommand = new
|
|
4195
|
+
var import_commander19 = require("commander");
|
|
4196
|
+
var postDoneCommand = new import_commander19.Command("done").description("\uC5C5\uBB34 \uC644\uB8CC \uCC98\uB9AC").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").action(async (project, postNumberStr, opts) => {
|
|
3722
4197
|
const config = await getConfigOrThrow();
|
|
3723
4198
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
3724
4199
|
startSpinner("\uC5C5\uBB34 \uC644\uB8CC \uCC98\uB9AC \uC911...");
|
|
@@ -3726,7 +4201,8 @@ var postDoneCommand = new import_commander17.Command("done").description("\uC5C5
|
|
|
3726
4201
|
projectArg: project,
|
|
3727
4202
|
postNumberArg: postNumberStr,
|
|
3728
4203
|
idOpt: opts.id,
|
|
3729
|
-
urlOpt: opts.url
|
|
4204
|
+
urlOpt: opts.url,
|
|
4205
|
+
argv: process.argv.slice(2)
|
|
3730
4206
|
});
|
|
3731
4207
|
await client.setPostDone(projectId, postId);
|
|
3732
4208
|
stopSpinner(true, "\uC5C5\uBB34 \uC644\uB8CC \uCC98\uB9AC \uC644\uB8CC");
|
|
@@ -3735,8 +4211,8 @@ var postDoneCommand = new import_commander17.Command("done").description("\uC5C5
|
|
|
3735
4211
|
});
|
|
3736
4212
|
|
|
3737
4213
|
// src/commands/post/workflow.ts
|
|
3738
|
-
var
|
|
3739
|
-
var postWorkflowCommand = new
|
|
4214
|
+
var import_commander20 = require("commander");
|
|
4215
|
+
var postWorkflowCommand = new import_commander20.Command("workflow").description("\uC5C5\uBB34 \uC6CC\uD06C\uD50C\uB85C\uC6B0 \uBCC0\uACBD").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").argument("[workflow]", "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uC774\uB984 \uB610\uB294 \uD074\uB798\uC2A4 (\uB610\uB294 --workflow \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--workflow <name>", "\uC6CC\uD06C\uD50C\uB85C\uC6B0 \uC774\uB984 (positional \uB300\uCCB4)").action(async (project, postNumber, workflowArg, opts) => {
|
|
3740
4216
|
const config = await getConfigOrThrow();
|
|
3741
4217
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
3742
4218
|
let workflowInput = opts.workflow;
|
|
@@ -3766,7 +4242,8 @@ var postWorkflowCommand = new import_commander18.Command("workflow").description
|
|
|
3766
4242
|
projectArg,
|
|
3767
4243
|
postNumberArg,
|
|
3768
4244
|
idOpt: opts.id,
|
|
3769
|
-
urlOpt: opts.url
|
|
4245
|
+
urlOpt: opts.url,
|
|
4246
|
+
argv: process.argv.slice(2)
|
|
3770
4247
|
});
|
|
3771
4248
|
const workflowId = await resolveWorkflow(client, projectId, workflowInput);
|
|
3772
4249
|
await client.setPostWorkflow(projectId, postId, workflowId);
|
|
@@ -3776,7 +4253,7 @@ var postWorkflowCommand = new import_commander18.Command("workflow").description
|
|
|
3776
4253
|
});
|
|
3777
4254
|
|
|
3778
4255
|
// src/commands/post/comment/list.ts
|
|
3779
|
-
var
|
|
4256
|
+
var import_commander21 = require("commander");
|
|
3780
4257
|
|
|
3781
4258
|
// src/utils/comment-enrich.ts
|
|
3782
4259
|
function enrichCommentCreators(comments, nameMap) {
|
|
@@ -3853,7 +4330,7 @@ async function fetchSince(client, projectId, postId, sinceDate) {
|
|
|
3853
4330
|
}
|
|
3854
4331
|
return collected;
|
|
3855
4332
|
}
|
|
3856
|
-
var commentListCommand = new
|
|
4333
|
+
var commentListCommand = new import_commander21.Command("list").description("\uB313\uAE00 \uBAA9\uB85D \uC870\uD68C").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--page <number>", "\uD398\uC774\uC9C0 \uBC88\uD638", PAGE_DEFAULT).option("--size <number>", "\uD398\uC774\uC9C0 \uD06C\uAE30", SIZE_DEFAULT).option("--sort <order>", "\uC815\uB82C (asc/desc), \uAE30\uBCF8 asc", "asc").option("--reverse", "--sort desc \uC758 alias").option("--latest <n>", "\uCD5C\uC2E0 N\uAC1C (--sort desc + size=N + page=0 \uB2E8\uCD95, \uCD5C\uB300 100)").option("--since <iso>", "\uC774 \uC2DC\uAC04 \uC774\uD6C4 \uB313\uAE00\uB9CC (ISO 8601 \uB610\uB294 YYYY-MM-DD)").option("--from-author <name>", "\uC791\uC131\uC790 \uC774\uB984\uC73C\uB85C \uD544\uD130 (\uBD80\uBD84\uC77C\uCE58)").action(async (project, postNumberStr, opts) => {
|
|
3857
4334
|
const globalOpts = commentListCommand.optsWithGlobals();
|
|
3858
4335
|
const config = await getConfigOrThrow();
|
|
3859
4336
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -3873,7 +4350,8 @@ var commentListCommand = new import_commander19.Command("list").description("\uB
|
|
|
3873
4350
|
projectArg: project,
|
|
3874
4351
|
postNumberArg: postNumberStr,
|
|
3875
4352
|
idOpt: opts.id,
|
|
3876
|
-
urlOpt: opts.url
|
|
4353
|
+
urlOpt: opts.url,
|
|
4354
|
+
argv: process.argv.slice(2)
|
|
3877
4355
|
});
|
|
3878
4356
|
const order = resolveOrder(opts);
|
|
3879
4357
|
let comments;
|
|
@@ -3915,8 +4393,8 @@ var commentListCommand = new import_commander19.Command("list").description("\uB
|
|
|
3915
4393
|
});
|
|
3916
4394
|
|
|
3917
4395
|
// src/commands/post/comment/latest.ts
|
|
3918
|
-
var
|
|
3919
|
-
var commentLatestCommand = new
|
|
4396
|
+
var import_commander22 = require("commander");
|
|
4397
|
+
var commentLatestCommand = new import_commander22.Command("latest").description("\uCD5C\uC2E0 \uB313\uAE00 1\uAC1C \uC870\uD68C (= comment list --latest 1)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("-n, --count <n>", "\uCD5C\uC2E0 N\uAC1C (\uAE30\uBCF8 1)", "1").action(async (project, postNumberStr, opts) => {
|
|
3920
4398
|
const globalOpts = commentLatestCommand.optsWithGlobals();
|
|
3921
4399
|
const config = await getConfigOrThrow();
|
|
3922
4400
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -3932,7 +4410,8 @@ var commentLatestCommand = new import_commander20.Command("latest").description(
|
|
|
3932
4410
|
projectArg: project,
|
|
3933
4411
|
postNumberArg: postNumberStr,
|
|
3934
4412
|
idOpt: opts.id,
|
|
3935
|
-
urlOpt: opts.url
|
|
4413
|
+
urlOpt: opts.url,
|
|
4414
|
+
argv: process.argv.slice(2)
|
|
3936
4415
|
});
|
|
3937
4416
|
const res = await client.getPostComments(projectId, postId, {
|
|
3938
4417
|
page: 0,
|
|
@@ -3953,8 +4432,8 @@ var commentLatestCommand = new import_commander20.Command("latest").description(
|
|
|
3953
4432
|
});
|
|
3954
4433
|
|
|
3955
4434
|
// src/commands/post/comment/add.ts
|
|
3956
|
-
var
|
|
3957
|
-
var commentAddCommand = new
|
|
4435
|
+
var import_commander23 = require("commander");
|
|
4436
|
+
var commentAddCommand = new import_commander23.Command("add").description("\uB313\uAE00 \uCD94\uAC00").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--body <text>", "\uB313\uAE00 \uBCF8\uBB38 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option(
|
|
3958
4437
|
"--mention <name>",
|
|
3959
4438
|
"\uBA64\uBC84 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)",
|
|
3960
4439
|
(value, prev) => [...prev, value],
|
|
@@ -3981,7 +4460,8 @@ var commentAddCommand = new import_commander21.Command("add").description("\uB31
|
|
|
3981
4460
|
projectArg: project,
|
|
3982
4461
|
postNumberArg: postNumberStr,
|
|
3983
4462
|
idOpt: opts.id,
|
|
3984
|
-
urlOpt: opts.url
|
|
4463
|
+
urlOpt: opts.url,
|
|
4464
|
+
argv: process.argv.slice(2)
|
|
3985
4465
|
});
|
|
3986
4466
|
const mentionInputs = (opts.mention ?? []).filter((s) => s.length > 0);
|
|
3987
4467
|
const groupInputs = (opts.mentionGroup ?? []).filter((s) => s.length > 0);
|
|
@@ -4033,8 +4513,8 @@ var commentAddCommand = new import_commander21.Command("add").description("\uB31
|
|
|
4033
4513
|
});
|
|
4034
4514
|
|
|
4035
4515
|
// src/commands/post/comment/edit.ts
|
|
4036
|
-
var
|
|
4037
|
-
var commentEditCommand = new
|
|
4516
|
+
var import_commander24 = require("commander");
|
|
4517
|
+
var commentEditCommand = new import_commander24.Command("edit").description("\uB313\uAE00 \uC218\uC815 ($EDITOR \uB610\uB294 --body \uC635\uC158)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray URL / \uB313\uAE00 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 \uB313\uAE00 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <commentId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("--body <text>", "\uB313\uAE00 \uBCF8\uBB38 \uBCC0\uACBD (- \uC785\uB825 \uC2DC stdin, non-interactive)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin, non-interactive)").option("--no-confirm", "\uB204\uB77D attachment \uACBD\uACE0 \uC2DC confirm \uC5C6\uC774 \uC9C4\uD589 (\uC790\uB3D9\uD654\uC6A9)").option(
|
|
4038
4518
|
"--mention <name>",
|
|
4039
4519
|
"\uBA64\uBC84 \uBA58\uC158 (\uBC18\uBCF5 \uAC00\uB2A5, \uC774\uB984 \uBD80\uBD84\uC77C\uCE58)",
|
|
4040
4520
|
(value, prev) => [...prev, value],
|
|
@@ -4091,7 +4571,8 @@ var commentEditCommand = new import_commander22.Command("edit").description("\uB
|
|
|
4091
4571
|
projectArg,
|
|
4092
4572
|
postNumberArg,
|
|
4093
4573
|
idOpt: opts.id,
|
|
4094
|
-
urlOpt: opts.url
|
|
4574
|
+
urlOpt: opts.url,
|
|
4575
|
+
argv: process.argv.slice(2)
|
|
4095
4576
|
});
|
|
4096
4577
|
const comments = await client.getPostComments(projectId, postId);
|
|
4097
4578
|
const comment = comments.result.find((c) => c.id === commentId);
|
|
@@ -4162,7 +4643,7 @@ var commentEditCommand = new import_commander22.Command("edit").description("\uB
|
|
|
4162
4643
|
});
|
|
4163
4644
|
|
|
4164
4645
|
// src/commands/post/comment/delete.ts
|
|
4165
|
-
var
|
|
4646
|
+
var import_commander25 = require("commander");
|
|
4166
4647
|
|
|
4167
4648
|
// src/utils/delete-confirmation.ts
|
|
4168
4649
|
async function authorizeDeletion(skipConfirmation, isTTY, confirmDeletion) {
|
|
@@ -4183,7 +4664,7 @@ async function promptDeletion(message) {
|
|
|
4183
4664
|
}
|
|
4184
4665
|
|
|
4185
4666
|
// src/commands/post/comment/delete.ts
|
|
4186
|
-
var commentDeleteCommand = new
|
|
4667
|
+
var commentDeleteCommand = new import_commander25.Command("delete").description("\uB313\uAE00 \uC0AD\uC81C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray URL / \uB313\uAE00 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 \uB313\uAE00 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <commentId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, arg3, opts) => {
|
|
4187
4668
|
const confirmed = await authorizeDeletion(
|
|
4188
4669
|
!!opts.yes,
|
|
4189
4670
|
!!process.stdin.isTTY,
|
|
@@ -4239,7 +4720,8 @@ var commentDeleteCommand = new import_commander23.Command("delete").description(
|
|
|
4239
4720
|
projectArg,
|
|
4240
4721
|
postNumberArg,
|
|
4241
4722
|
idOpt: opts.id,
|
|
4242
|
-
urlOpt: opts.url
|
|
4723
|
+
urlOpt: opts.url,
|
|
4724
|
+
argv: process.argv.slice(2)
|
|
4243
4725
|
});
|
|
4244
4726
|
await client.deletePostComment(projectId, postId, commentId);
|
|
4245
4727
|
stopSpinner(true, "\uB313\uAE00 \uC0AD\uC81C \uC644\uB8CC");
|
|
@@ -4248,7 +4730,7 @@ var commentDeleteCommand = new import_commander23.Command("delete").description(
|
|
|
4248
4730
|
});
|
|
4249
4731
|
|
|
4250
4732
|
// src/commands/post/comment/get.ts
|
|
4251
|
-
var
|
|
4733
|
+
var import_commander26 = require("commander");
|
|
4252
4734
|
|
|
4253
4735
|
// src/utils/format-size.ts
|
|
4254
4736
|
function formatSize(bytes) {
|
|
@@ -4330,7 +4812,7 @@ function parseGetArgs(arg1, arg2, arg3, opts) {
|
|
|
4330
4812
|
EXIT_PARAM_ERROR
|
|
4331
4813
|
);
|
|
4332
4814
|
}
|
|
4333
|
-
var commentGetCommand = new
|
|
4815
|
+
var commentGetCommand = new import_commander26.Command("get").description("\uB2E8\uC77C \uB313\uAE00 \uBCF8\uBB38 + \uBA54\uD0C0 + attachments \uC870\uD68C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray URL (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (positional \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (positional \uB300\uC2E0)").option("--comment-id <id>", "\uB313\uAE00 ID (arg3 \uB300\uC2E0)").action(async (arg1, arg2, arg3, opts) => {
|
|
4334
4816
|
const parsed = parseGetArgs(arg1, arg2, arg3, opts);
|
|
4335
4817
|
const config = await getConfigOrThrow();
|
|
4336
4818
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4343,7 +4825,8 @@ var commentGetCommand = new import_commander24.Command("get").description("\uB2E
|
|
|
4343
4825
|
projectArg: parsed.projectArg,
|
|
4344
4826
|
postNumberArg: parsed.postNumberArg,
|
|
4345
4827
|
idOpt: parsed.idOpt,
|
|
4346
|
-
urlOpt: parsed.urlOpt
|
|
4828
|
+
urlOpt: parsed.urlOpt,
|
|
4829
|
+
argv: process.argv.slice(2)
|
|
4347
4830
|
});
|
|
4348
4831
|
projectId = resolved.projectId;
|
|
4349
4832
|
const detail = await client.getPostComment(resolved.projectId, resolved.postId, parsed.commentId);
|
|
@@ -4365,10 +4848,10 @@ var commentGetCommand = new import_commander24.Command("get").description("\uB2E
|
|
|
4365
4848
|
});
|
|
4366
4849
|
|
|
4367
4850
|
// src/commands/post/comment/file/index.ts
|
|
4368
|
-
var
|
|
4851
|
+
var import_commander31 = require("commander");
|
|
4369
4852
|
|
|
4370
4853
|
// src/commands/post/comment/file/list.ts
|
|
4371
|
-
var
|
|
4854
|
+
var import_commander27 = require("commander");
|
|
4372
4855
|
|
|
4373
4856
|
// src/resolvers/comment-file-input.ts
|
|
4374
4857
|
var FILE_ID_SECONDARY_LABEL = {
|
|
@@ -4432,7 +4915,8 @@ async function resolveCommentFileInput(client, args) {
|
|
|
4432
4915
|
projectArg,
|
|
4433
4916
|
postNumberArg,
|
|
4434
4917
|
idOpt: args.idOpt,
|
|
4435
|
-
urlOpt: args.urlOpt
|
|
4918
|
+
urlOpt: args.urlOpt,
|
|
4919
|
+
argv: args.argv
|
|
4436
4920
|
});
|
|
4437
4921
|
return { projectId, postId, commentId, secondary };
|
|
4438
4922
|
}
|
|
@@ -4484,7 +4968,7 @@ function formatSource(source) {
|
|
|
4484
4968
|
if (source === "body-link") return "\uBCF8\uBB38 \uB9C1\uD06C";
|
|
4485
4969
|
return "\uB458 \uB2E4";
|
|
4486
4970
|
}
|
|
4487
|
-
var listCommentFileCommand = new
|
|
4971
|
+
var listCommentFileCommand = new import_commander27.Command("list").description("\uB313\uAE00 \uCCA8\uBD80 \uD30C\uC77C\uACFC \uBCF8\uBB38 \uD30C\uC77C \uB9C1\uD06C \uBAA9\uB85D \uD1B5\uD569 \uC870\uD68C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uB313\uAE00 ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 (positional \uBAA8\uB4DC)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <logId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").action(async (arg1, arg2, arg3, opts) => {
|
|
4488
4972
|
const globalOpts = listCommentFileCommand.optsWithGlobals();
|
|
4489
4973
|
const config = await getConfigOrThrow();
|
|
4490
4974
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4494,6 +4978,7 @@ var listCommentFileCommand = new import_commander25.Command("list").description(
|
|
|
4494
4978
|
arg3,
|
|
4495
4979
|
idOpt: opts.id,
|
|
4496
4980
|
urlOpt: opts.url,
|
|
4981
|
+
argv: process.argv.slice(2),
|
|
4497
4982
|
commentIdOpt: opts.commentId,
|
|
4498
4983
|
requireSecondary: false
|
|
4499
4984
|
});
|
|
@@ -4545,7 +5030,7 @@ var listCommentFileCommand = new import_commander25.Command("list").description(
|
|
|
4545
5030
|
});
|
|
4546
5031
|
|
|
4547
5032
|
// src/commands/post/comment/file/upload.ts
|
|
4548
|
-
var
|
|
5033
|
+
var import_commander28 = require("commander");
|
|
4549
5034
|
var import_node_path7 = require("path");
|
|
4550
5035
|
|
|
4551
5036
|
// src/utils/comment-files.ts
|
|
@@ -4568,7 +5053,7 @@ function removeFileReference(body, fileId) {
|
|
|
4568
5053
|
}
|
|
4569
5054
|
|
|
4570
5055
|
// src/commands/post/comment/file/upload.ts
|
|
4571
|
-
var uploadCommentFileCommand = new
|
|
5056
|
+
var uploadCommentFileCommand = new import_commander28.Command("upload").description("\uB313\uAE00\uC5D0 \uD30C\uC77C \uC5C5\uB85C\uB4DC (\uCCA8\uBD80 \uCE74\uB4DC\uAC00 \uC544\uB2CC \uBCF8\uBB38 \uB9C1\uD06C\uB85C \uD45C\uC2DC)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uB313\uAE00 ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C \uACBD\uB85C").argument("[arg3]", "\uB313\uAE00 ID (positional \uBAA8\uB4DC)").argument("[arg4]", "\uD30C\uC77C \uACBD\uB85C (positional \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <logId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("--file <path>", "\uC5C5\uB85C\uB4DC\uD560 \uD30C\uC77C \uACBD\uB85C (positional \uB300\uCCB4)").action(async (arg1, arg2, arg3, arg4, opts) => {
|
|
4572
5057
|
const globalOpts = uploadCommentFileCommand.optsWithGlobals();
|
|
4573
5058
|
const config = await getConfigOrThrow();
|
|
4574
5059
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4579,6 +5064,7 @@ var uploadCommentFileCommand = new import_commander26.Command("upload").descript
|
|
|
4579
5064
|
arg4,
|
|
4580
5065
|
idOpt: opts.id,
|
|
4581
5066
|
urlOpt: opts.url,
|
|
5067
|
+
argv: process.argv.slice(2),
|
|
4582
5068
|
commentIdOpt: opts.commentId,
|
|
4583
5069
|
secondaryOpt: opts.file,
|
|
4584
5070
|
requireSecondary: true,
|
|
@@ -4617,10 +5103,10 @@ var uploadCommentFileCommand = new import_commander26.Command("upload").descript
|
|
|
4617
5103
|
});
|
|
4618
5104
|
|
|
4619
5105
|
// src/commands/post/comment/file/download.ts
|
|
4620
|
-
var
|
|
5106
|
+
var import_commander29 = require("commander");
|
|
4621
5107
|
var import_promises8 = require("fs/promises");
|
|
4622
5108
|
var import_node_path8 = require("path");
|
|
4623
|
-
var downloadCommentFileCommand = new
|
|
5109
|
+
var downloadCommentFileCommand = new import_commander29.Command("download").description(
|
|
4624
5110
|
"\uB313\uAE00\uC5D0 \uCCA8\uBD80\uB41C \uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC (\uD604\uC7AC comment-id \uB294 \uBBF8\uC0AC\uC6A9 \u2014 \uBA58\uD0C8 \uBAA8\uB378 \uC77C\uAD00\uC131, \uBBF8\uB798 \uB313\uAE00 \uB2E8\uC704 \uAD8C\uD55C \uD638\uD658\uC6A9)"
|
|
4625
5111
|
).argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uB313\uAE00 ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uB313\uAE00 ID (positional \uBAA8\uB4DC)").argument("[arg4]", "\uD30C\uC77C ID (positional \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <logId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("--out <path>", "\uC800\uC7A5 \uACBD\uB85C (\uBBF8\uC9C0\uC815 \uC2DC \uD604\uC7AC \uB514\uB809\uD1A0\uB9AC\uC5D0 \uC6D0\uBCF8 \uD30C\uC77C\uBA85\uC73C\uB85C \uC800\uC7A5)", ".").action(async (arg1, arg2, arg3, arg4, opts) => {
|
|
4626
5112
|
const config = await getConfigOrThrow();
|
|
@@ -4632,6 +5118,7 @@ var downloadCommentFileCommand = new import_commander27.Command("download").desc
|
|
|
4632
5118
|
arg4,
|
|
4633
5119
|
idOpt: opts.id,
|
|
4634
5120
|
urlOpt: opts.url,
|
|
5121
|
+
argv: process.argv.slice(2),
|
|
4635
5122
|
commentIdOpt: opts.commentId,
|
|
4636
5123
|
secondaryOpt: opts.fileId,
|
|
4637
5124
|
requireSecondary: true,
|
|
@@ -4648,8 +5135,8 @@ var downloadCommentFileCommand = new import_commander27.Command("download").desc
|
|
|
4648
5135
|
});
|
|
4649
5136
|
|
|
4650
5137
|
// src/commands/post/comment/file/delete.ts
|
|
4651
|
-
var
|
|
4652
|
-
var deleteCommentFileCommand = new
|
|
5138
|
+
var import_commander30 = require("commander");
|
|
5139
|
+
var deleteCommentFileCommand = new import_commander30.Command("delete").description("\uB313\uAE00 \uCCA8\uBD80 \uD30C\uC77C \uC0AD\uC81C (\uBCF8\uBB38 reference \uC81C\uAC70\uC640 \uD30C\uC77C \uC0AD\uC81C\uB97C \uD568\uAED8 \uC218\uD589)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uB313\uAE00 ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uB313\uAE00 ID (positional \uBAA8\uB4DC)").argument("[arg4]", "\uD30C\uC77C ID (positional \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--comment-id <logId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, arg3, arg4, opts) => {
|
|
4653
5140
|
const confirmed = await authorizeDeletion(
|
|
4654
5141
|
!!opts.yes,
|
|
4655
5142
|
!!process.stdin.isTTY,
|
|
@@ -4670,6 +5157,7 @@ var deleteCommentFileCommand = new import_commander28.Command("delete").descript
|
|
|
4670
5157
|
arg4,
|
|
4671
5158
|
idOpt: opts.id,
|
|
4672
5159
|
urlOpt: opts.url,
|
|
5160
|
+
argv: process.argv.slice(2),
|
|
4673
5161
|
commentIdOpt: opts.commentId,
|
|
4674
5162
|
secondaryOpt: opts.fileId,
|
|
4675
5163
|
requireSecondary: true,
|
|
@@ -4707,11 +5195,11 @@ var deleteCommentFileCommand = new import_commander28.Command("delete").descript
|
|
|
4707
5195
|
});
|
|
4708
5196
|
|
|
4709
5197
|
// src/commands/post/comment/file/index.ts
|
|
4710
|
-
var commentFileCommand = new
|
|
5198
|
+
var commentFileCommand = new import_commander31.Command("file").description("\uB313\uAE00 \uCCA8\uBD80 \uD30C\uC77C \uAD00\uB9AC").addCommand(listCommentFileCommand).addCommand(uploadCommentFileCommand).addCommand(downloadCommentFileCommand).addCommand(deleteCommentFileCommand);
|
|
4711
5199
|
|
|
4712
5200
|
// src/commands/post/file/list.ts
|
|
4713
|
-
var
|
|
4714
|
-
var fileListCommand = new
|
|
5201
|
+
var import_commander32 = require("commander");
|
|
5202
|
+
var fileListCommand = new import_commander32.Command("list").description("\uC5C5\uBB34 \uCCA8\uBD80\uD30C\uC77C \uBAA9\uB85D \uC870\uD68C").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").action(async (project, postNumberStr, opts) => {
|
|
4715
5203
|
const globalOpts = fileListCommand.optsWithGlobals();
|
|
4716
5204
|
const config = await getConfigOrThrow();
|
|
4717
5205
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4720,7 +5208,8 @@ var fileListCommand = new import_commander30.Command("list").description("\uC5C5
|
|
|
4720
5208
|
projectArg: project,
|
|
4721
5209
|
postNumberArg: postNumberStr,
|
|
4722
5210
|
idOpt: opts.id,
|
|
4723
|
-
urlOpt: opts.url
|
|
5211
|
+
urlOpt: opts.url,
|
|
5212
|
+
argv: process.argv.slice(2)
|
|
4724
5213
|
});
|
|
4725
5214
|
const res = await client.getPostFiles(projectId, postId);
|
|
4726
5215
|
stopSpinner(true, `\uCCA8\uBD80\uD30C\uC77C ${res.result.length}\uAC1C`);
|
|
@@ -4739,7 +5228,7 @@ var fileListCommand = new import_commander30.Command("list").description("\uC5C5
|
|
|
4739
5228
|
});
|
|
4740
5229
|
|
|
4741
5230
|
// src/commands/post/file/download.ts
|
|
4742
|
-
var
|
|
5231
|
+
var import_commander33 = require("commander");
|
|
4743
5232
|
var import_promises9 = require("fs/promises");
|
|
4744
5233
|
var import_node_path9 = require("path");
|
|
4745
5234
|
|
|
@@ -4785,7 +5274,7 @@ function emitDeleteResult(globalOpts, result) {
|
|
|
4785
5274
|
}
|
|
4786
5275
|
|
|
4787
5276
|
// src/commands/post/file/download.ts
|
|
4788
|
-
var fileDownloadCommand = new
|
|
5277
|
+
var fileDownloadCommand = new import_commander33.Command("download").description("\uCCA8\uBD80\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uD30C\uC77C ID (positional \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("-o, --output <dir>", "\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC", ".").action(async (arg1, arg2, arg3, opts) => {
|
|
4789
5278
|
const globalOpts = fileDownloadCommand.optsWithGlobals();
|
|
4790
5279
|
const config = await getConfigOrThrow();
|
|
4791
5280
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4830,7 +5319,8 @@ var fileDownloadCommand = new import_commander31.Command("download").description
|
|
|
4830
5319
|
projectArg,
|
|
4831
5320
|
postNumberArg,
|
|
4832
5321
|
idOpt: opts.id,
|
|
4833
|
-
urlOpt: opts.url
|
|
5322
|
+
urlOpt: opts.url,
|
|
5323
|
+
argv: process.argv.slice(2)
|
|
4834
5324
|
});
|
|
4835
5325
|
const { buffer, fileName } = await client.downloadPostFile(projectId, postId, fileId);
|
|
4836
5326
|
const safeName = (0, import_node_path9.basename)(decodeURIComponent(fileName));
|
|
@@ -4841,10 +5331,10 @@ var fileDownloadCommand = new import_commander31.Command("download").description
|
|
|
4841
5331
|
});
|
|
4842
5332
|
|
|
4843
5333
|
// src/commands/post/file/download-all.ts
|
|
4844
|
-
var
|
|
5334
|
+
var import_commander34 = require("commander");
|
|
4845
5335
|
var import_promises10 = require("fs/promises");
|
|
4846
5336
|
var import_node_path10 = require("path");
|
|
4847
|
-
var fileDownloadAllCommand = new
|
|
5337
|
+
var fileDownloadAllCommand = new import_commander34.Command("download-all").description("\uC5C5\uBB34\uC758 \uBAA8\uB4E0 \uCCA8\uBD80\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray URL)").argument("[post-number]", "\uC5C5\uBB34 \uBC88\uD638 (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("-o, --output <dir>", "\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC", ".").action(async (project, postNumberStr, opts) => {
|
|
4848
5338
|
const globalOpts = fileDownloadAllCommand.optsWithGlobals();
|
|
4849
5339
|
const config = await getConfigOrThrow();
|
|
4850
5340
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4853,7 +5343,8 @@ var fileDownloadAllCommand = new import_commander32.Command("download-all").desc
|
|
|
4853
5343
|
projectArg: project,
|
|
4854
5344
|
postNumberArg: postNumberStr,
|
|
4855
5345
|
idOpt: opts.id,
|
|
4856
|
-
urlOpt: opts.url
|
|
5346
|
+
urlOpt: opts.url,
|
|
5347
|
+
argv: process.argv.slice(2)
|
|
4857
5348
|
});
|
|
4858
5349
|
const res = await client.getPostFiles(projectId, postId);
|
|
4859
5350
|
if (res.result.length === 0) {
|
|
@@ -4893,9 +5384,9 @@ var fileDownloadAllCommand = new import_commander32.Command("download-all").desc
|
|
|
4893
5384
|
});
|
|
4894
5385
|
|
|
4895
5386
|
// src/commands/post/file/upload.ts
|
|
4896
|
-
var
|
|
5387
|
+
var import_commander35 = require("commander");
|
|
4897
5388
|
var import_node_path11 = require("path");
|
|
4898
|
-
var fileUploadCommand = new
|
|
5389
|
+
var fileUploadCommand = new import_commander35.Command("upload").description("\uCCA8\uBD80\uD30C\uC77C \uC5C5\uB85C\uB4DC").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C \uACBD\uB85C").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C \uACBD\uB85C").argument("[arg3]", "\uD30C\uC77C \uACBD\uB85C (positional \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--file <path>", "\uC5C5\uB85C\uB4DC\uD560 \uD30C\uC77C \uACBD\uB85C (positional \uB300\uCCB4)").action(async (arg1, arg2, arg3, opts) => {
|
|
4899
5390
|
const globalOpts = fileUploadCommand.optsWithGlobals();
|
|
4900
5391
|
const config = await getConfigOrThrow();
|
|
4901
5392
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -4940,7 +5431,8 @@ var fileUploadCommand = new import_commander33.Command("upload").description("\u
|
|
|
4940
5431
|
projectArg,
|
|
4941
5432
|
postNumberArg,
|
|
4942
5433
|
idOpt: opts.id,
|
|
4943
|
-
urlOpt: opts.url
|
|
5434
|
+
urlOpt: opts.url,
|
|
5435
|
+
argv: process.argv.slice(2)
|
|
4944
5436
|
});
|
|
4945
5437
|
const res = await client.uploadPostFile(projectId, postId, filePath);
|
|
4946
5438
|
stopSpinner(true, "\uC5C5\uB85C\uB4DC \uC644\uB8CC");
|
|
@@ -4956,8 +5448,8 @@ var fileUploadCommand = new import_commander33.Command("upload").description("\u
|
|
|
4956
5448
|
});
|
|
4957
5449
|
|
|
4958
5450
|
// src/commands/post/file/delete.ts
|
|
4959
|
-
var
|
|
4960
|
-
var fileDeleteCommand = new
|
|
5451
|
+
var import_commander36 = require("commander");
|
|
5452
|
+
var fileDeleteCommand = new import_commander36.Command("delete").description("\uCCA8\uBD80\uD30C\uC77C \uC0AD\uC81C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg2]", "\uC5C5\uBB34 \uBC88\uD638 \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uD30C\uC77C ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <postId>", "Dooray post ID (project/post-number \uB300\uC2E0)").option("--url <url>", "Dooray \uC5C5\uBB34 URL (project/post-number \uB300\uC2E0)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, arg3, opts) => {
|
|
4961
5453
|
const confirmed = await authorizeDeletion(
|
|
4962
5454
|
!!opts.yes,
|
|
4963
5455
|
!!process.stdin.isTTY,
|
|
@@ -5011,7 +5503,8 @@ var fileDeleteCommand = new import_commander34.Command("delete").description("\u
|
|
|
5011
5503
|
projectArg,
|
|
5012
5504
|
postNumberArg,
|
|
5013
5505
|
idOpt: opts.id,
|
|
5014
|
-
urlOpt: opts.url
|
|
5506
|
+
urlOpt: opts.url,
|
|
5507
|
+
argv: process.argv.slice(2)
|
|
5015
5508
|
});
|
|
5016
5509
|
await client.deletePostFile(projectId, postId, fileId);
|
|
5017
5510
|
stopSpinner(true, "\uC0AD\uC81C \uC644\uB8CC");
|
|
@@ -5019,13 +5512,18 @@ var fileDeleteCommand = new import_commander34.Command("delete").description("\u
|
|
|
5019
5512
|
});
|
|
5020
5513
|
|
|
5021
5514
|
// src/commands/wiki/list.ts
|
|
5022
|
-
var
|
|
5515
|
+
var import_commander37 = require("commander");
|
|
5023
5516
|
|
|
5024
5517
|
// src/formatters/wiki.ts
|
|
5025
|
-
function formatWikiList(wikis, opts) {
|
|
5518
|
+
function formatWikiList(wikis, opts, codeByProjectId) {
|
|
5026
5519
|
output(opts, {
|
|
5027
|
-
headers: ["ID", "Name", "Type"],
|
|
5028
|
-
rows: wikis.map((w) => [
|
|
5520
|
+
headers: ["ID", "Name", "Project", "Type"],
|
|
5521
|
+
rows: wikis.map((w) => [
|
|
5522
|
+
w.id,
|
|
5523
|
+
w.name,
|
|
5524
|
+
codeByProjectId.get(w.project.id) ?? w.project.id,
|
|
5525
|
+
w.type
|
|
5526
|
+
]),
|
|
5029
5527
|
raw: wikis,
|
|
5030
5528
|
ids: wikis.map((w) => w.id)
|
|
5031
5529
|
});
|
|
@@ -5104,30 +5602,31 @@ function formatWikiPageDetail(page, opts) {
|
|
|
5104
5602
|
`\uC791\uC131\uC790: ${page.creator?.member?.name ?? ""}`,
|
|
5105
5603
|
...page.createdAt ? [`\uC0DD\uC131: ${page.createdAt}`] : [],
|
|
5106
5604
|
...page.updatedAt ? [`\uC218\uC815: ${page.updatedAt}`] : [],
|
|
5107
|
-
"",
|
|
5108
|
-
page.body?.content ?? ""
|
|
5109
|
-
];
|
|
5110
|
-
process.stdout.write(lines.join("\n") + "\n");
|
|
5111
|
-
}
|
|
5112
|
-
|
|
5113
|
-
// src/commands/wiki/list.ts
|
|
5114
|
-
var wikiListCommand = new import_commander35.Command("list").description("\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C").option("--page <number>", "\uD398\uC774\uC9C0 \uBC88\uD638", "0").option("--size <number>", "\uD398\uC774\uC9C0 \uD06C\uAE30", "20").action(async (opts) => {
|
|
5115
|
-
const globalOpts = wikiListCommand.optsWithGlobals();
|
|
5116
|
-
const config = await getConfigOrThrow();
|
|
5117
|
-
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
5118
|
-
startSpinner("\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
5119
|
-
const res = await client.getWikis({
|
|
5120
|
-
page: Number(opts.page),
|
|
5121
|
-
size: Number(opts.size)
|
|
5122
|
-
});
|
|
5123
|
-
stopSpinner(true, "\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C \uC644\uB8CC");
|
|
5124
|
-
formatWikiList(res.result, globalOpts);
|
|
5125
|
-
});
|
|
5126
|
-
|
|
5127
|
-
// src/commands/wiki/pages.ts
|
|
5128
|
-
var import_commander36 = require("commander");
|
|
5605
|
+
"",
|
|
5606
|
+
page.body?.content ?? ""
|
|
5607
|
+
];
|
|
5608
|
+
process.stdout.write(lines.join("\n") + "\n");
|
|
5609
|
+
}
|
|
5129
5610
|
|
|
5130
5611
|
// src/resolvers/wiki.ts
|
|
5612
|
+
async function fetchAllWikis(client) {
|
|
5613
|
+
const all = [];
|
|
5614
|
+
let page = 0;
|
|
5615
|
+
const size = 100;
|
|
5616
|
+
while (true) {
|
|
5617
|
+
const res = await client.getWikis({ page, size });
|
|
5618
|
+
if (res.result.length === 0) break;
|
|
5619
|
+
all.push(...res.result);
|
|
5620
|
+
if (all.length >= res.totalCount) break;
|
|
5621
|
+
page++;
|
|
5622
|
+
}
|
|
5623
|
+
return all;
|
|
5624
|
+
}
|
|
5625
|
+
function filterWikisByName(wikis, keyword) {
|
|
5626
|
+
if (keyword === "") return wikis;
|
|
5627
|
+
const lowerKeyword = keyword.toLowerCase();
|
|
5628
|
+
return wikis.filter((w) => w.name.toLowerCase().includes(lowerKeyword));
|
|
5629
|
+
}
|
|
5131
5630
|
async function resolveWiki(client, projectCode) {
|
|
5132
5631
|
await resolveProject(client, projectCode);
|
|
5133
5632
|
const entry = await getProjects();
|
|
@@ -5135,8 +5634,9 @@ async function resolveWiki(client, projectCode) {
|
|
|
5135
5634
|
(p) => p.code === projectCode || p.id === projectCode
|
|
5136
5635
|
);
|
|
5137
5636
|
if (!project?.wikiId) {
|
|
5637
|
+
const orgIdHint = PROJECT_ID_RE.test(projectCode) ? "\n \uC704\uD0A4 \uBCF8\uBB38\uC758 \uD398\uC774\uC9C0 \uB9C1\uD06C\uB294 dooray://<orgId>/pages/<pageId> \uD615\uD0DC\uC774\uACE0, \uC55E \uC22B\uC790\uB294 orgId \uC785\uB2C8\uB2E4.\n orgId \uB294 project \uB3C4 \uC704\uD0A4 ID \uB3C4 \uC544\uB2C8\uBBC0\uB85C project \uC790\uB9AC\uC5D0 \uB123\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.\n \uADF8 \uB9C1\uD06C\uC758 \uB4A4 \uC22B\uC790\uAC00 \uD398\uC774\uC9C0 ID \uC774\uBBC0\uB85C project \uC5C6\uC774 \uC870\uD68C\uD560 \uC218 \uC788\uC2B5\uB2C8\uB2E4:\n dooray wiki page get --id <\uD398\uC774\uC9C0 ID>" : "";
|
|
5138
5638
|
throw new DoorayCliError(
|
|
5139
|
-
`\uD504\uB85C\uC81D\uD2B8\uC5D0 \uC704\uD0A4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4: ${projectCode}`,
|
|
5639
|
+
`\uD504\uB85C\uC81D\uD2B8\uC5D0 \uC704\uD0A4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4: ${projectCode}${orgIdHint}`,
|
|
5140
5640
|
EXIT_PARAM_ERROR
|
|
5141
5641
|
);
|
|
5142
5642
|
}
|
|
@@ -5149,8 +5649,8 @@ async function resolveWikiHomePageId(client, wikiId) {
|
|
|
5149
5649
|
if (fresh) {
|
|
5150
5650
|
wikis = cached.data;
|
|
5151
5651
|
} else {
|
|
5152
|
-
const
|
|
5153
|
-
wikis =
|
|
5652
|
+
const all = await fetchAllWikis(client);
|
|
5653
|
+
wikis = all.map((w) => ({
|
|
5154
5654
|
id: w.id,
|
|
5155
5655
|
projectId: w.project.id,
|
|
5156
5656
|
name: w.name,
|
|
@@ -5168,8 +5668,55 @@ async function resolveWikiHomePageId(client, wikiId) {
|
|
|
5168
5668
|
return wiki.homePageId;
|
|
5169
5669
|
}
|
|
5170
5670
|
|
|
5671
|
+
// src/commands/wiki/list.ts
|
|
5672
|
+
var wikiListCommand = new import_commander37.Command("list").description("\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C").option("--page <number>", "\uD398\uC774\uC9C0 \uBC88\uD638", "0").option("--size <number>", "\uD398\uC774\uC9C0 \uD06C\uAE30", "20").option("--search <keyword>", "\uC704\uD0A4 \uC774\uB984 \uBD80\uBD84 \uC77C\uCE58 \uAC80\uC0C9 (\uB300\uC18C\uBB38\uC790 \uBB34\uC2DC)").action(async (opts) => {
|
|
5673
|
+
const globalOpts = wikiListCommand.optsWithGlobals();
|
|
5674
|
+
const config = await getConfigOrThrow();
|
|
5675
|
+
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
5676
|
+
const projectCodeMapPromise = buildProjectCodeMap(client).catch(
|
|
5677
|
+
() => /* @__PURE__ */ new Map()
|
|
5678
|
+
);
|
|
5679
|
+
if (opts.search != null && opts.search.trim() === "") {
|
|
5680
|
+
throw new DoorayCliError(
|
|
5681
|
+
"--search \uC5D0 \uBE48 \uAC12\uC744 \uC904 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4. \uCC3E\uC744 \uC774\uB984\uC758 \uC77C\uBD80\uB97C \uC785\uB825\uD558\uC138\uC694.",
|
|
5682
|
+
EXIT_PARAM_ERROR
|
|
5683
|
+
);
|
|
5684
|
+
}
|
|
5685
|
+
let wikis;
|
|
5686
|
+
if (opts.search) {
|
|
5687
|
+
const pageGivenExplicitly = wikiListCommand.getOptionValueSource("page") === "cli";
|
|
5688
|
+
const sizeGivenExplicitly = wikiListCommand.getOptionValueSource("size") === "cli";
|
|
5689
|
+
if (pageGivenExplicitly || sizeGivenExplicitly) {
|
|
5690
|
+
process.stderr.write(
|
|
5691
|
+
"--search \uB294 \uC804\uCCB4 \uBAA9\uB85D\uC5D0\uC11C \uCC3E\uC73C\uBBC0\uB85C --page \uC640 --size \uB97C \uBB34\uC2DC\uD569\uB2C8\uB2E4.\n"
|
|
5692
|
+
);
|
|
5693
|
+
}
|
|
5694
|
+
startSpinner("\uC704\uD0A4 \uBAA9\uB85D \uC804\uCCB4 \uC870\uD68C \uC911...");
|
|
5695
|
+
const all = await fetchAllWikis(client);
|
|
5696
|
+
stopSpinner(true, "\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C \uC644\uB8CC");
|
|
5697
|
+
wikis = filterWikisByName(all, opts.search);
|
|
5698
|
+
if (wikis.length === 0) {
|
|
5699
|
+
process.stderr.write(
|
|
5700
|
+
`"${opts.search}" \uC640 \uC774\uB984\uC774 \uBD80\uBD84 \uC77C\uCE58\uD558\uB294 \uC704\uD0A4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4. \uB300\uC18C\uBB38\uC790\uB294 \uAD6C\uBD84\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.
|
|
5701
|
+
`
|
|
5702
|
+
);
|
|
5703
|
+
}
|
|
5704
|
+
} else {
|
|
5705
|
+
startSpinner("\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C \uC911...");
|
|
5706
|
+
const res = await client.getWikis({
|
|
5707
|
+
page: Number(opts.page),
|
|
5708
|
+
size: Number(opts.size)
|
|
5709
|
+
});
|
|
5710
|
+
stopSpinner(true, "\uC704\uD0A4 \uBAA9\uB85D \uC870\uD68C \uC644\uB8CC");
|
|
5711
|
+
wikis = res.result;
|
|
5712
|
+
}
|
|
5713
|
+
const projectCodeMap = await projectCodeMapPromise;
|
|
5714
|
+
formatWikiList(wikis, globalOpts, projectCodeMap);
|
|
5715
|
+
});
|
|
5716
|
+
|
|
5171
5717
|
// src/commands/wiki/pages.ts
|
|
5172
|
-
var
|
|
5718
|
+
var import_commander38 = require("commander");
|
|
5719
|
+
var wikiPagesCommand = new import_commander38.Command("pages").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uBAA9\uB85D \uC870\uD68C").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").option("--parent <page-id>", "\uBD80\uBAA8 \uD398\uC774\uC9C0 ID").action(async (project, opts) => {
|
|
5173
5720
|
const globalOpts = wikiPagesCommand.optsWithGlobals();
|
|
5174
5721
|
const config = await getConfigOrThrow();
|
|
5175
5722
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5181,8 +5728,8 @@ var wikiPagesCommand = new import_commander36.Command("pages").description("\uC7
|
|
|
5181
5728
|
});
|
|
5182
5729
|
|
|
5183
5730
|
// src/commands/wiki/tree.ts
|
|
5184
|
-
var
|
|
5185
|
-
var wikiTreeCommand = new
|
|
5731
|
+
var import_commander39 = require("commander");
|
|
5732
|
+
var wikiTreeCommand = new import_commander39.Command("tree").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uACC4\uCE35 \uD2B8\uB9AC \uC870\uD68C").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").option("--depth <n>", "\uC7AC\uADC0 \uCD5C\uB300 \uAE4A\uC774 (root=1, \uBBF8\uC9C0\uC815 \uC2DC \uC804\uCCB4)").action(async (project, opts) => {
|
|
5186
5733
|
const globalOpts = wikiTreeCommand.optsWithGlobals();
|
|
5187
5734
|
const config = await getConfigOrThrow();
|
|
5188
5735
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5202,21 +5749,87 @@ var wikiTreeCommand = new import_commander37.Command("tree").description("\uC704
|
|
|
5202
5749
|
});
|
|
5203
5750
|
|
|
5204
5751
|
// src/commands/wiki/page-get.ts
|
|
5205
|
-
var
|
|
5206
|
-
|
|
5752
|
+
var import_commander40 = require("commander");
|
|
5753
|
+
|
|
5754
|
+
// src/resolvers/wiki-page-input.ts
|
|
5755
|
+
var INPUT_HELP2 = "\uC704\uD0A4 \uD398\uC774\uC9C0\uB97C \uC2DD\uBCC4\uD560 \uC815\uBCF4\uAC00 \uBD80\uC871\uD569\uB2C8\uB2E4. \uB2E4\uC74C \uC911 \uD558\uB098\uB97C \uC785\uB825\uD558\uC138\uC694:\n - --id <page-id> \uC608: --id 1234567890123456789\n - <project> <page-id> \uC608: my-project 1234567890123456789\n - <Dooray URL> \uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>\n \uC704\uD0A4\uB97C \uC774\uB984\uC73C\uB85C \uCC3E\uC73C\uB824\uBA74: dooray wiki list --search <\uC704\uD0A4 \uC774\uB984 \uC77C\uBD80>\n --project \uB294 \uC120\uD0DD\uC785\uB2C8\uB2E4. \uD568\uAED8 \uC8FC\uBA74 wikiId \uD574\uC11D \uD638\uCD9C\uC744 \uC544\uB08D\uB2C8\uB2E4.";
|
|
5756
|
+
async function resolveWikiPageInput(client, args) {
|
|
5757
|
+
const { projectArg, pageIdArg, idOpt, urlOpt, project } = args;
|
|
5758
|
+
const hasPositional = !!projectArg || !!pageIdArg;
|
|
5759
|
+
if (idOpt && urlOpt) {
|
|
5760
|
+
throw new DoorayCliError("--id\uC640 --url\uC740 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
5761
|
+
}
|
|
5762
|
+
if ((idOpt || urlOpt) && hasPositional) {
|
|
5763
|
+
throw new DoorayCliError(
|
|
5764
|
+
"--id/--url\uACFC positional \uC778\uC790(<project> <page-id>)\uB294 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
5765
|
+
EXIT_PARAM_ERROR
|
|
5766
|
+
);
|
|
5767
|
+
}
|
|
5768
|
+
if (urlOpt) {
|
|
5769
|
+
const parsed = parseDoorayWikiUrl(urlOpt);
|
|
5770
|
+
if (!parsed) {
|
|
5771
|
+
throw new DoorayCliError(
|
|
5772
|
+
`--url \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: "${urlOpt}"
|
|
5773
|
+
\uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>`,
|
|
5774
|
+
EXIT_PARAM_ERROR
|
|
5775
|
+
);
|
|
5776
|
+
}
|
|
5777
|
+
return parsed;
|
|
5778
|
+
}
|
|
5779
|
+
if (projectArg && !pageIdArg && isLikelyDoorayUrl(projectArg)) {
|
|
5780
|
+
const parsed = parseDoorayWikiUrl(projectArg);
|
|
5781
|
+
if (!parsed) {
|
|
5782
|
+
throw new DoorayCliError(
|
|
5783
|
+
`Dooray Wiki URL \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: "${projectArg}"
|
|
5784
|
+
\uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>`,
|
|
5785
|
+
EXIT_PARAM_ERROR
|
|
5786
|
+
);
|
|
5787
|
+
}
|
|
5788
|
+
return parsed;
|
|
5789
|
+
}
|
|
5790
|
+
if (idOpt) {
|
|
5791
|
+
if (project) {
|
|
5792
|
+
const wikiId2 = await resolveWiki(client, project);
|
|
5793
|
+
return { wikiId: wikiId2, pageId: idOpt };
|
|
5794
|
+
}
|
|
5795
|
+
const res = await client.getWikiPageStandalone(idOpt);
|
|
5796
|
+
const wikiId = res.result.wikiId;
|
|
5797
|
+
if (!wikiId) {
|
|
5798
|
+
throw new DoorayCliError(
|
|
5799
|
+
`\uD398\uC774\uC9C0 \uC751\uB2F5\uC5D0 wikiId \uAC00 \uC5C6\uC2B5\uB2C8\uB2E4 (pageId: ${idOpt})`,
|
|
5800
|
+
EXIT_API_ERROR
|
|
5801
|
+
);
|
|
5802
|
+
}
|
|
5803
|
+
return { wikiId, pageId: idOpt };
|
|
5804
|
+
}
|
|
5805
|
+
if (projectArg && pageIdArg) {
|
|
5806
|
+
const wikiId = await resolveWiki(client, projectArg);
|
|
5807
|
+
return { wikiId, pageId: pageIdArg };
|
|
5808
|
+
}
|
|
5809
|
+
throw new DoorayCliError(INPUT_HELP2, EXIT_PARAM_ERROR);
|
|
5810
|
+
}
|
|
5811
|
+
|
|
5812
|
+
// src/commands/wiki/page-get.ts
|
|
5813
|
+
var wikiPageGetCommand = new import_commander40.Command("get").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC0C1\uC138 \uC870\uD68C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 Dooray Wiki URL").argument("[arg2]", "page-id (positional 2\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (project \uC5C6\uC774 \uC870\uD68C)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uC120\uD0DD, \uC8FC\uBA74 wikiId \uD574\uC11D \uD638\uCD9C\uC744 \uC544\uB080\uB2E4)").action(async (arg1, arg2, opts) => {
|
|
5207
5814
|
const globalOpts = wikiPageGetCommand.optsWithGlobals();
|
|
5208
5815
|
const config = await getConfigOrThrow();
|
|
5209
5816
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
5817
|
+
const { wikiId, pageId } = await resolveWikiPageInput(client, {
|
|
5818
|
+
projectArg: arg1,
|
|
5819
|
+
pageIdArg: arg2,
|
|
5820
|
+
idOpt: opts.id,
|
|
5821
|
+
urlOpt: opts.url,
|
|
5822
|
+
project: opts.project
|
|
5823
|
+
});
|
|
5210
5824
|
startSpinner("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC870\uD68C \uC911...");
|
|
5211
|
-
const wikiId = await resolveWiki(client, project);
|
|
5212
5825
|
const res = await client.getWikiPage(wikiId, pageId);
|
|
5213
5826
|
stopSpinner(true, "\uC704\uD0A4 \uD398\uC774\uC9C0 \uC870\uD68C \uC644\uB8CC");
|
|
5214
5827
|
formatWikiPageDetail(res.result, globalOpts);
|
|
5215
5828
|
});
|
|
5216
5829
|
|
|
5217
5830
|
// src/commands/wiki/page-create.ts
|
|
5218
|
-
var
|
|
5219
|
-
var wikiPageCreateCommand = new
|
|
5831
|
+
var import_commander41 = require("commander");
|
|
5832
|
+
var wikiPageCreateCommand = new import_commander41.Command("create").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC0DD\uC131").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").requiredOption("--title <title>", "\uD398\uC774\uC9C0 \uC81C\uBAA9").option("--parent <page-id>", "\uBD80\uBAA8 \uD398\uC774\uC9C0 ID").option("--body <text>", "\uBCF8\uBB38 \uD14D\uC2A4\uD2B8 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").action(async (project, opts) => {
|
|
5220
5833
|
const globalOpts = wikiPageCreateCommand.optsWithGlobals();
|
|
5221
5834
|
const config = await getConfigOrThrow();
|
|
5222
5835
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5241,8 +5854,8 @@ var wikiPageCreateCommand = new import_commander39.Command("create").description
|
|
|
5241
5854
|
});
|
|
5242
5855
|
|
|
5243
5856
|
// src/commands/wiki/page-edit.ts
|
|
5244
|
-
var
|
|
5245
|
-
var wikiPageEditCommand = new
|
|
5857
|
+
var import_commander42 = require("commander");
|
|
5858
|
+
var wikiPageEditCommand = new import_commander42.Command("edit").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC218\uC815 (\uD50C\uB798\uADF8 \uC5C6\uC73C\uBA74 $EDITOR)").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").argument("<page-id>", "\uD398\uC774\uC9C0 ID").option("--title <title>", "\uD398\uC774\uC9C0 \uC81C\uBAA9 (\uC9C0\uC815 \uC2DC $EDITOR \uC0DD\uB7B5)").option("--body <text>", "\uBCF8\uBB38 \uD14D\uC2A4\uD2B8 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").action(async (project, pageId, opts) => {
|
|
5246
5859
|
const config = await getConfigOrThrow();
|
|
5247
5860
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
5248
5861
|
const hasTitle = opts.title != null;
|
|
@@ -5295,64 +5908,8 @@ var wikiPageEditCommand = new import_commander40.Command("edit").description("\u
|
|
|
5295
5908
|
});
|
|
5296
5909
|
|
|
5297
5910
|
// src/commands/wiki/page-delete.ts
|
|
5298
|
-
var
|
|
5299
|
-
|
|
5300
|
-
// src/resolvers/wiki-page-input.ts
|
|
5301
|
-
var INPUT_HELP2 = "\uC704\uD0A4 \uD398\uC774\uC9C0\uB97C \uC2DD\uBCC4\uD560 \uC815\uBCF4\uAC00 \uBD80\uC871\uD569\uB2C8\uB2E4. \uB2E4\uC74C \uC911 \uD558\uB098\uB97C \uC785\uB825\uD558\uC138\uC694:\n - <project> <page-id> \uC608: my-project 9876543210987654321\n - --id <page-id> --project <project> (\uB610\uB294 --url)\n - <Dooray URL> \uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>";
|
|
5302
|
-
async function resolveWikiPageInput(client, args) {
|
|
5303
|
-
const { projectArg, pageIdArg, idOpt, urlOpt, project } = args;
|
|
5304
|
-
const hasPositional = !!projectArg || !!pageIdArg;
|
|
5305
|
-
if (idOpt && urlOpt) {
|
|
5306
|
-
throw new DoorayCliError("--id\uC640 --url\uC740 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
5307
|
-
}
|
|
5308
|
-
if ((idOpt || urlOpt) && hasPositional) {
|
|
5309
|
-
throw new DoorayCliError(
|
|
5310
|
-
"--id/--url\uACFC positional \uC778\uC790(<project> <page-id>)\uB294 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
5311
|
-
EXIT_PARAM_ERROR
|
|
5312
|
-
);
|
|
5313
|
-
}
|
|
5314
|
-
if (urlOpt) {
|
|
5315
|
-
const parsed = parseDoorayWikiUrl(urlOpt);
|
|
5316
|
-
if (!parsed) {
|
|
5317
|
-
throw new DoorayCliError(
|
|
5318
|
-
`--url \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: "${urlOpt}"
|
|
5319
|
-
\uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>`,
|
|
5320
|
-
EXIT_PARAM_ERROR
|
|
5321
|
-
);
|
|
5322
|
-
}
|
|
5323
|
-
return parsed;
|
|
5324
|
-
}
|
|
5325
|
-
if (projectArg && !pageIdArg && isLikelyDoorayUrl(projectArg)) {
|
|
5326
|
-
const parsed = parseDoorayWikiUrl(projectArg);
|
|
5327
|
-
if (!parsed) {
|
|
5328
|
-
throw new DoorayCliError(
|
|
5329
|
-
`Dooray Wiki URL \uD615\uC2DD\uC774 \uC62C\uBC14\uB974\uC9C0 \uC54A\uC2B5\uB2C8\uB2E4: "${projectArg}"
|
|
5330
|
-
\uC608: https://x.dooray.com/wiki/<wikiId>/<pageId>`,
|
|
5331
|
-
EXIT_PARAM_ERROR
|
|
5332
|
-
);
|
|
5333
|
-
}
|
|
5334
|
-
return parsed;
|
|
5335
|
-
}
|
|
5336
|
-
if (idOpt) {
|
|
5337
|
-
const projectCode = project ?? projectArg;
|
|
5338
|
-
if (!projectCode) {
|
|
5339
|
-
throw new DoorayCliError(
|
|
5340
|
-
"--id \uBAA8\uB4DC\uB294 --project <code> \uAC00 \uD544\uC694\uD569\uB2C8\uB2E4 (\uB610\uB294 \uCCAB positional \uC5D0 project code).",
|
|
5341
|
-
EXIT_PARAM_ERROR
|
|
5342
|
-
);
|
|
5343
|
-
}
|
|
5344
|
-
const wikiId = await resolveWiki(client, projectCode);
|
|
5345
|
-
return { wikiId, pageId: idOpt };
|
|
5346
|
-
}
|
|
5347
|
-
if (projectArg && pageIdArg) {
|
|
5348
|
-
const wikiId = await resolveWiki(client, projectArg);
|
|
5349
|
-
return { wikiId, pageId: pageIdArg };
|
|
5350
|
-
}
|
|
5351
|
-
throw new DoorayCliError(INPUT_HELP2, EXIT_PARAM_ERROR);
|
|
5352
|
-
}
|
|
5353
|
-
|
|
5354
|
-
// src/commands/wiki/page-delete.ts
|
|
5355
|
-
var wikiPageDeleteCommand = new import_commander41.Command("delete").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC0AD\uC81C (\uBE44\uACF5\uC2DD endpoint)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uBBF8\uC0AC\uC6A9").argument("[arg2]", "page-id (positional 2\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, opts) => {
|
|
5911
|
+
var import_commander43 = require("commander");
|
|
5912
|
+
var wikiPageDeleteCommand = new import_commander43.Command("delete").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC0AD\uC81C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uBBF8\uC0AC\uC6A9").argument("[arg2]", "page-id (positional 2\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, opts) => {
|
|
5356
5913
|
const confirmed = await authorizeDeletion(
|
|
5357
5914
|
!!opts.yes,
|
|
5358
5915
|
!!process.stdin.isTTY,
|
|
@@ -5389,12 +5946,94 @@ var wikiPageDeleteCommand = new import_commander41.Command("delete").description
|
|
|
5389
5946
|
}
|
|
5390
5947
|
});
|
|
5391
5948
|
|
|
5949
|
+
// src/commands/wiki/page-move.ts
|
|
5950
|
+
var import_commander44 = require("commander");
|
|
5951
|
+
function validateMoveOptions(opts) {
|
|
5952
|
+
if (!opts.parent) {
|
|
5953
|
+
throw new DoorayCliError(
|
|
5954
|
+
"--parent \uB294 \uD544\uC218\uC785\uB2C8\uB2E4. \uC774\uB3D9 \uB300\uC0C1 \uBD80\uBAA8 \uD398\uC774\uC9C0 ID \uB97C \uC9C0\uC815\uD558\uC138\uC694.",
|
|
5955
|
+
EXIT_PARAM_ERROR
|
|
5956
|
+
);
|
|
5957
|
+
}
|
|
5958
|
+
if (opts.before && opts.first) {
|
|
5959
|
+
throw new DoorayCliError(
|
|
5960
|
+
"--before \uC640 --first \uB294 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
5961
|
+
EXIT_PARAM_ERROR
|
|
5962
|
+
);
|
|
5963
|
+
}
|
|
5964
|
+
}
|
|
5965
|
+
function buildMoveBody(opts, resolvedTargetWikiId) {
|
|
5966
|
+
const body = {
|
|
5967
|
+
targetParentPageId: opts.parent
|
|
5968
|
+
};
|
|
5969
|
+
if (resolvedTargetWikiId) {
|
|
5970
|
+
body.targetWikiId = resolvedTargetWikiId;
|
|
5971
|
+
}
|
|
5972
|
+
if (opts.children === false) {
|
|
5973
|
+
body.withChildren = false;
|
|
5974
|
+
}
|
|
5975
|
+
if (opts.first) {
|
|
5976
|
+
body.beforePageId = "0";
|
|
5977
|
+
} else if (opts.before) {
|
|
5978
|
+
body.beforePageId = opts.before;
|
|
5979
|
+
}
|
|
5980
|
+
return body;
|
|
5981
|
+
}
|
|
5982
|
+
function emitMoveResult(globalOpts, pageId, body) {
|
|
5983
|
+
if (globalOpts.json) {
|
|
5984
|
+
printJson({ pageId, ...body, status: "moved" });
|
|
5985
|
+
} else if (globalOpts.quiet) {
|
|
5986
|
+
process.stdout.write(`${pageId}
|
|
5987
|
+
`);
|
|
5988
|
+
} else {
|
|
5989
|
+
process.stdout.write(
|
|
5990
|
+
`\uD398\uC774\uC9C0(${pageId})\uAC00 \uBD80\uBAA8 \uD398\uC774\uC9C0(${body.targetParentPageId}) \uC544\uB798\uB85C \uC774\uB3D9\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
5991
|
+
`
|
|
5992
|
+
);
|
|
5993
|
+
process.stdout.write(
|
|
5994
|
+
body.withChildren === false ? "\uD558\uC704 \uD398\uC774\uC9C0\uB294 \uD568\uAED8 \uC774\uB3D9\uD558\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4.\n" : "\uD558\uC704 \uD398\uC774\uC9C0\uB3C4 \uD568\uAED8 \uC774\uB3D9\uD588\uC2B5\uB2C8\uB2E4.\n"
|
|
5995
|
+
);
|
|
5996
|
+
const orderMessage = describeOrderChange(body.beforePageId);
|
|
5997
|
+
if (orderMessage) process.stdout.write(orderMessage);
|
|
5998
|
+
}
|
|
5999
|
+
}
|
|
6000
|
+
function describeOrderChange(beforePageId) {
|
|
6001
|
+
if (beforePageId == null) return null;
|
|
6002
|
+
if (beforePageId === "0") return "\uD615\uC81C \uC911 \uB9E8 \uC55E\uC73C\uB85C \uC815\uB82C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n";
|
|
6003
|
+
return `\uD615\uC81C \uD398\uC774\uC9C0(${beforePageId}) \uBC14\uB85C \uB4A4\uB85C \uC815\uB82C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
|
|
6004
|
+
`;
|
|
6005
|
+
}
|
|
6006
|
+
var wikiPageMoveCommand = new import_commander44.Command("move").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC774\uB3D9 (\uBD80\uBAA8 \uBCC0\uACBD, \uC815\uB82C \uBCC0\uACBD, \uC704\uD0A4 \uAC04 \uC774\uB3D9)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uBBF8\uC0AC\uC6A9").argument("[arg2]", "page-id (positional 2\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D \uD638\uCD9C \uC808\uC57D)").option("--parent <page-id>", "\uC774\uB3D9 \uB300\uC0C1 \uBD80\uBAA8 \uD398\uC774\uC9C0 ID (\uD544\uC218)").option("--to-wiki <project|wikiId>", "\uC774\uB3D9 \uB300\uC0C1 \uC704\uD0A4 (\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 \uC704\uD0A4 ID)").option("--before <page-id>", "\uC774 \uD398\uC774\uC9C0 \uBC14\uB85C \uB4A4\uC5D0 \uC704\uCE58").option("--first", "\uD615\uC81C \uC911 \uB9E8 \uC55E\uC73C\uB85C \uC774\uB3D9").option("--no-children", "\uD558\uC704 \uD398\uC774\uC9C0\uB97C \uD568\uAED8 \uC62E\uAE30\uC9C0 \uC54A\uB294\uB2E4 (\uAE30\uBCF8\uC740 \uD568\uAED8 \uC774\uB3D9)").action(async (arg1, arg2, opts) => {
|
|
6007
|
+
validateMoveOptions(opts);
|
|
6008
|
+
const globalOpts = wikiPageMoveCommand.optsWithGlobals();
|
|
6009
|
+
const config = await getConfigOrThrow();
|
|
6010
|
+
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
6011
|
+
const { wikiId, pageId } = await resolveWikiPageInput(client, {
|
|
6012
|
+
projectArg: arg1,
|
|
6013
|
+
pageIdArg: arg2,
|
|
6014
|
+
idOpt: opts.id,
|
|
6015
|
+
urlOpt: opts.url,
|
|
6016
|
+
project: opts.project
|
|
6017
|
+
});
|
|
6018
|
+
const targetWikiId = opts.toWiki ? PROJECT_ID_RE.test(opts.toWiki) ? opts.toWiki : await resolveWiki(client, opts.toWiki) : void 0;
|
|
6019
|
+
const body = buildMoveBody(opts, targetWikiId);
|
|
6020
|
+
startSpinner("\uC704\uD0A4 \uD398\uC774\uC9C0 \uC774\uB3D9 \uC911...");
|
|
6021
|
+
try {
|
|
6022
|
+
await client.moveWikiPage(wikiId, pageId, body);
|
|
6023
|
+
stopSpinner(true, "\uC704\uD0A4 \uD398\uC774\uC9C0 \uC774\uB3D9 \uC644\uB8CC");
|
|
6024
|
+
emitMoveResult(globalOpts, pageId, body);
|
|
6025
|
+
} catch (e) {
|
|
6026
|
+
stopSpinner(false);
|
|
6027
|
+
throw e;
|
|
6028
|
+
}
|
|
6029
|
+
});
|
|
6030
|
+
|
|
5392
6031
|
// src/commands/wiki/page-file/index.ts
|
|
5393
|
-
var
|
|
6032
|
+
var import_commander50 = require("commander");
|
|
5394
6033
|
|
|
5395
6034
|
// src/commands/wiki/page-file/list.ts
|
|
5396
|
-
var
|
|
5397
|
-
var wikiPageFileListCommand = new
|
|
6035
|
+
var import_commander45 = require("commander");
|
|
6036
|
+
var wikiPageFileListCommand = new import_commander45.Command("list").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uCCA8\uBD80\uD30C\uC77C \uBAA9\uB85D \uC870\uD68C (general + inline image)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray Wiki URL)").argument("[page-id]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (--project \uB3D9\uBC18 \uD544\uC694)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").action(async (project, pageIdArg, opts) => {
|
|
5398
6037
|
const globalOpts = wikiPageFileListCommand.optsWithGlobals();
|
|
5399
6038
|
const config = await getConfigOrThrow();
|
|
5400
6039
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5425,7 +6064,7 @@ var wikiPageFileListCommand = new import_commander42.Command("list").description
|
|
|
5425
6064
|
});
|
|
5426
6065
|
|
|
5427
6066
|
// src/commands/wiki/page-file/upload.ts
|
|
5428
|
-
var
|
|
6067
|
+
var import_commander46 = require("commander");
|
|
5429
6068
|
|
|
5430
6069
|
// src/utils/wiki-snippet.ts
|
|
5431
6070
|
function wikiInlineImageSnippet(wikiId, attachFileId, name) {
|
|
@@ -5433,7 +6072,7 @@ function wikiInlineImageSnippet(wikiId, attachFileId, name) {
|
|
|
5433
6072
|
}
|
|
5434
6073
|
|
|
5435
6074
|
// src/commands/wiki/page-file/upload.ts
|
|
5436
|
-
var wikiPageFileUploadCommand = new
|
|
6075
|
+
var wikiPageFileUploadCommand = new import_commander46.Command("upload").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uCCA8\uBD80\uD30C\uC77C \uC5C5\uB85C\uB4DC").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C \uACBD\uB85C").argument("[arg2]", "page-id \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C \uACBD\uB85C").argument("[arg3]", "\uD30C\uC77C \uACBD\uB85C (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("--file <path>", "\uC5C5\uB85C\uB4DC\uD560 \uD30C\uC77C \uACBD\uB85C (positional \uB300\uCCB4)").option("--type <type>", "\uD30C\uC77C \uD0C0\uC785: general | inline_image (\uAE30\uBCF8 general)", "general").action(async (arg1, arg2, arg3, opts) => {
|
|
5437
6076
|
const globalOpts = wikiPageFileUploadCommand.optsWithGlobals();
|
|
5438
6077
|
const config = await getConfigOrThrow();
|
|
5439
6078
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5528,10 +6167,10 @@ var wikiPageFileUploadCommand = new import_commander43.Command("upload").descrip
|
|
|
5528
6167
|
});
|
|
5529
6168
|
|
|
5530
6169
|
// src/commands/wiki/page-file/download.ts
|
|
5531
|
-
var
|
|
6170
|
+
var import_commander47 = require("commander");
|
|
5532
6171
|
var import_promises11 = require("fs/promises");
|
|
5533
6172
|
var import_node_path12 = require("path");
|
|
5534
|
-
var wikiPageFileDownloadCommand = new
|
|
6173
|
+
var wikiPageFileDownloadCommand = new import_commander47.Command("download").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uCCA8\uBD80\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg2]", "page-id \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uD30C\uC77C ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("-o, --output <dir>", "\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC", ".").action(async (arg1, arg2, arg3, opts) => {
|
|
5535
6174
|
const globalOpts = wikiPageFileDownloadCommand.optsWithGlobals();
|
|
5536
6175
|
const config = await getConfigOrThrow();
|
|
5537
6176
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5593,10 +6232,10 @@ var wikiPageFileDownloadCommand = new import_commander44.Command("download").des
|
|
|
5593
6232
|
});
|
|
5594
6233
|
|
|
5595
6234
|
// src/commands/wiki/page-file/download-all.ts
|
|
5596
|
-
var
|
|
6235
|
+
var import_commander48 = require("commander");
|
|
5597
6236
|
var import_promises12 = require("fs/promises");
|
|
5598
6237
|
var import_node_path13 = require("path");
|
|
5599
|
-
var wikiPageFileDownloadAllCommand = new
|
|
6238
|
+
var wikiPageFileDownloadAllCommand = new import_commander48.Command("download-all").description("\uC704\uD0A4 \uD398\uC774\uC9C0\uC758 \uBAA8\uB4E0 \uCCA8\uBD80\uD30C\uC77C \uB2E4\uC6B4\uB85C\uB4DC (general + inline image)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray Wiki URL)").argument("[page-id]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (project\uC640 \uD568\uAED8 \uC0AC\uC6A9)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (--project \uB3D9\uBC18 \uD544\uC694)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("-o, --output <dir>", "\uC800\uC7A5 \uB514\uB809\uD1A0\uB9AC", ".").action(async (project, pageIdArg, opts) => {
|
|
5600
6239
|
const globalOpts = wikiPageFileDownloadAllCommand.optsWithGlobals();
|
|
5601
6240
|
const config = await getConfigOrThrow();
|
|
5602
6241
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5653,8 +6292,8 @@ var wikiPageFileDownloadAllCommand = new import_commander45.Command("download-al
|
|
|
5653
6292
|
});
|
|
5654
6293
|
|
|
5655
6294
|
// src/commands/wiki/page-file/delete.ts
|
|
5656
|
-
var
|
|
5657
|
-
var wikiPageFileDeleteCommand = new
|
|
6295
|
+
var import_commander49 = require("commander");
|
|
6296
|
+
var wikiPageFileDeleteCommand = new import_commander49.Command("delete").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uCCA8\uBD80\uD30C\uC77C \uC0AD\uC81C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC, Dooray Wiki URL, \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg2]", "page-id \uB610\uB294 (`--id`/`--url` \uBAA8\uB4DC\uC77C \uB54C) \uD30C\uC77C ID").argument("[arg3]", "\uD30C\uC77C ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC5D0\uC11C wikiId \uD574\uC11D\uC6A9)").option("--file-id <fileId>", "\uD30C\uC77C ID (positional \uB300\uCCB4)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, arg3, opts) => {
|
|
5658
6297
|
const confirmed = await authorizeDeletion(
|
|
5659
6298
|
!!opts.yes,
|
|
5660
6299
|
!!process.stdin.isTTY,
|
|
@@ -5722,7 +6361,7 @@ var wikiPageFileDeleteCommand = new import_commander46.Command("delete").descrip
|
|
|
5722
6361
|
});
|
|
5723
6362
|
|
|
5724
6363
|
// src/commands/wiki/page-file/index.ts
|
|
5725
|
-
var wikiPageFileCommand = new
|
|
6364
|
+
var wikiPageFileCommand = new import_commander50.Command("file").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uCCA8\uBD80\uD30C\uC77C \uAD00\uB828 \uBA85\uB839");
|
|
5726
6365
|
wikiPageFileCommand.addCommand(wikiPageFileListCommand);
|
|
5727
6366
|
wikiPageFileCommand.addCommand(wikiPageFileUploadCommand);
|
|
5728
6367
|
wikiPageFileCommand.addCommand(wikiPageFileDownloadCommand);
|
|
@@ -5730,10 +6369,10 @@ wikiPageFileCommand.addCommand(wikiPageFileDownloadAllCommand);
|
|
|
5730
6369
|
wikiPageFileCommand.addCommand(wikiPageFileDeleteCommand);
|
|
5731
6370
|
|
|
5732
6371
|
// src/commands/wiki/page-comment/index.ts
|
|
5733
|
-
var
|
|
6372
|
+
var import_commander57 = require("commander");
|
|
5734
6373
|
|
|
5735
6374
|
// src/commands/wiki/page-comment/list.ts
|
|
5736
|
-
var
|
|
6375
|
+
var import_commander51 = require("commander");
|
|
5737
6376
|
|
|
5738
6377
|
// src/formatters/wiki-comment.ts
|
|
5739
6378
|
function formatWikiCommentList(comments, opts) {
|
|
@@ -5780,7 +6419,7 @@ function truncate(s, n) {
|
|
|
5780
6419
|
}
|
|
5781
6420
|
|
|
5782
6421
|
// src/commands/wiki/page-comment/list.ts
|
|
5783
|
-
var wikiPageCommentListCommand = new
|
|
6422
|
+
var wikiPageCommentListCommand = new import_commander51.Command("list").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uB313\uAE00 \uBAA9\uB85D \uC870\uD68C (\uCD5C\uC2E0\uC21C)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray Wiki URL)").argument("[page-id]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (--project \uB3D9\uBC18)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").option("--size <n>", "\uD398\uC774\uC9C0 \uD06C\uAE30 (\uAE30\uBCF8 20, \uCD5C\uB300 100)", (v) => parseInt(v, 10)).option("--page <n>", "\uD398\uC774\uC9C0 \uBC88\uD638 (0\uBD80\uD130)", (v) => parseInt(v, 10)).option("--latest <n>", "\uCD5C\uC2E0 N\uAC1C\uB9CC (size \uB300\uC2E0 \uC0AC\uC6A9)", (v) => parseInt(v, 10)).action(async (project, pageIdArg, opts) => {
|
|
5784
6423
|
const globalOpts = wikiPageCommentListCommand.optsWithGlobals();
|
|
5785
6424
|
const config = await getConfigOrThrow();
|
|
5786
6425
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5805,8 +6444,8 @@ var wikiPageCommentListCommand = new import_commander48.Command("list").descript
|
|
|
5805
6444
|
});
|
|
5806
6445
|
|
|
5807
6446
|
// src/commands/wiki/page-comment/latest.ts
|
|
5808
|
-
var
|
|
5809
|
-
var wikiPageCommentLatestCommand = new
|
|
6447
|
+
var import_commander52 = require("commander");
|
|
6448
|
+
var wikiPageCommentLatestCommand = new import_commander52.Command("latest").description("\uCD5C\uC2E0 \uB313\uAE00 1\uAC74 \uC870\uD68C (= comment list --latest 1)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray Wiki URL)").argument("[page-id]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (--project \uB3D9\uBC18)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").action(async (project, pageIdArg, opts) => {
|
|
5810
6449
|
const globalOpts = wikiPageCommentLatestCommand.optsWithGlobals();
|
|
5811
6450
|
const config = await getConfigOrThrow();
|
|
5812
6451
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5833,7 +6472,7 @@ var wikiPageCommentLatestCommand = new import_commander49.Command("latest").desc
|
|
|
5833
6472
|
});
|
|
5834
6473
|
|
|
5835
6474
|
// src/commands/wiki/page-comment/get.ts
|
|
5836
|
-
var
|
|
6475
|
+
var import_commander53 = require("commander");
|
|
5837
6476
|
|
|
5838
6477
|
// src/commands/wiki/page-comment/parse-args.ts
|
|
5839
6478
|
function parseWikiCommentArgs(arg1, arg2, arg3, opts) {
|
|
@@ -5886,7 +6525,7 @@ function parseWikiCommentArgs(arg1, arg2, arg3, opts) {
|
|
|
5886
6525
|
}
|
|
5887
6526
|
|
|
5888
6527
|
// src/commands/wiki/page-comment/get.ts
|
|
5889
|
-
var wikiPageCommentGetCommand = new
|
|
6528
|
+
var wikiPageCommentGetCommand = new import_commander53.Command("get").description("\uB2E8\uC77C \uB313\uAE00 \uC870\uD68C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray Wiki URL (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (positional \uB300\uC2E0)").option("--url <url>", "Dooray Wiki URL (positional \uB300\uC2E0)").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").option("--comment-id <id>", "\uB313\uAE00 ID (arg3 \uB300\uC2E0)").action(async (arg1, arg2, arg3, opts) => {
|
|
5890
6529
|
const parsed = parseWikiCommentArgs(arg1, arg2, arg3, opts);
|
|
5891
6530
|
const config = await getConfigOrThrow();
|
|
5892
6531
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -5910,8 +6549,8 @@ var wikiPageCommentGetCommand = new import_commander50.Command("get").descriptio
|
|
|
5910
6549
|
});
|
|
5911
6550
|
|
|
5912
6551
|
// src/commands/wiki/page-comment/add.ts
|
|
5913
|
-
var
|
|
5914
|
-
var wikiPageCommentAddCommand = new
|
|
6552
|
+
var import_commander54 = require("commander");
|
|
6553
|
+
var wikiPageCommentAddCommand = new import_commander54.Command("add").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uB313\uAE00 \uCD94\uAC00 (--body \uC5C6\uC73C\uBA74 $EDITOR)").argument("[project]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (\uB610\uB294 \uCCAB \uC778\uC790\uC5D0 Dooray Wiki URL)").argument("[page-id]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (--project \uB3D9\uBC18)").option("--url <url>", "Dooray Wiki URL").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").option("--body <text>", "\uB313\uAE00 \uBCF8\uBB38 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").action(async (project, pageIdArg, opts) => {
|
|
5915
6554
|
if ((opts.id || opts.url) && (project || pageIdArg)) {
|
|
5916
6555
|
throw new DoorayCliError(
|
|
5917
6556
|
"positional \uC778\uC790\uC640 --id/--url \uC635\uC158\uC740 \uB3D9\uC2DC\uC5D0 \uC0AC\uC6A9\uD560 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.",
|
|
@@ -5957,8 +6596,8 @@ var wikiPageCommentAddCommand = new import_commander51.Command("add").descriptio
|
|
|
5957
6596
|
});
|
|
5958
6597
|
|
|
5959
6598
|
// src/commands/wiki/page-comment/edit.ts
|
|
5960
|
-
var
|
|
5961
|
-
var wikiPageCommentEditCommand = new
|
|
6599
|
+
var import_commander55 = require("commander");
|
|
6600
|
+
var wikiPageCommentEditCommand = new import_commander55.Command("edit").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uB313\uAE00 \uC218\uC815 ($EDITOR \uB610\uB294 --body \uC635\uC158)").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray Wiki URL (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (positional \uB300\uC2E0)").option("--url <url>", "Dooray Wiki URL (positional \uB300\uC2E0)").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").option("--comment-id <commentId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("--body <text>", "\uB313\uAE00 \uBCF8\uBB38 \uBCC0\uACBD (- \uC785\uB825 \uC2DC stdin, non-interactive)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin, non-interactive)").action(async (arg1, arg2, arg3, opts) => {
|
|
5962
6601
|
const parsed = parseWikiCommentArgs(arg1, arg2, arg3, opts);
|
|
5963
6602
|
const config = await getConfigOrThrow();
|
|
5964
6603
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -6002,8 +6641,8 @@ var wikiPageCommentEditCommand = new import_commander52.Command("edit").descript
|
|
|
6002
6641
|
});
|
|
6003
6642
|
|
|
6004
6643
|
// src/commands/wiki/page-comment/delete.ts
|
|
6005
|
-
var
|
|
6006
|
-
var wikiPageCommentDeleteCommand = new
|
|
6644
|
+
var import_commander56 = require("commander");
|
|
6645
|
+
var wikiPageCommentDeleteCommand = new import_commander56.Command("delete").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uB313\uAE00 \uC0AD\uC81C").argument("[arg1]", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC / Dooray Wiki URL (\uBAA8\uB4DC\uBCC4)").argument("[arg2]", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (\uBAA8\uB4DC\uBCC4)").argument("[arg3]", "\uB313\uAE00 ID (positional 3\uAC1C \uBAA8\uB4DC)").option("--id <pageId>", "\uC704\uD0A4 \uD398\uC774\uC9C0 ID (positional \uB300\uC2E0)").option("--url <url>", "Dooray Wiki URL (positional \uB300\uC2E0)").option("--project <code>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC (--id \uBAA8\uB4DC\uC6A9)").option("--comment-id <commentId>", "\uB313\uAE00 ID (positional \uB300\uCCB4)").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC0AD\uC81C (\uC790\uB3D9\uD654\uC6A9)").action(async (arg1, arg2, arg3, opts) => {
|
|
6007
6646
|
const confirmed = await authorizeDeletion(
|
|
6008
6647
|
!!opts.yes,
|
|
6009
6648
|
!!process.stdin.isTTY,
|
|
@@ -6036,7 +6675,7 @@ var wikiPageCommentDeleteCommand = new import_commander53.Command("delete").desc
|
|
|
6036
6675
|
});
|
|
6037
6676
|
|
|
6038
6677
|
// src/commands/wiki/page-comment/index.ts
|
|
6039
|
-
var wikiPageCommentCommand = new
|
|
6678
|
+
var wikiPageCommentCommand = new import_commander57.Command("comment").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uB313\uAE00 \uAD00\uB828 \uBA85\uB839");
|
|
6040
6679
|
wikiPageCommentCommand.addCommand(wikiPageCommentListCommand);
|
|
6041
6680
|
wikiPageCommentCommand.addCommand(wikiPageCommentLatestCommand);
|
|
6042
6681
|
wikiPageCommentCommand.addCommand(wikiPageCommentGetCommand);
|
|
@@ -6045,10 +6684,10 @@ wikiPageCommentCommand.addCommand(wikiPageCommentEditCommand);
|
|
|
6045
6684
|
wikiPageCommentCommand.addCommand(wikiPageCommentDeleteCommand);
|
|
6046
6685
|
|
|
6047
6686
|
// src/commands/member/index.ts
|
|
6048
|
-
var
|
|
6687
|
+
var import_commander61 = require("commander");
|
|
6049
6688
|
|
|
6050
6689
|
// src/commands/member/get.ts
|
|
6051
|
-
var
|
|
6690
|
+
var import_commander58 = require("commander");
|
|
6052
6691
|
|
|
6053
6692
|
// src/formatters/member.ts
|
|
6054
6693
|
function formatMemberDetail(member, opts) {
|
|
@@ -6094,7 +6733,7 @@ function formatMemberSearchResults(members, opts) {
|
|
|
6094
6733
|
}
|
|
6095
6734
|
|
|
6096
6735
|
// src/commands/member/get.ts
|
|
6097
|
-
var memberGetCommand = new
|
|
6736
|
+
var memberGetCommand = new import_commander58.Command("get").description("\uBA64\uBC84 \uC0C1\uC138 \uC815\uBCF4 \uC870\uD68C (organizationMemberId)").argument("<member-id>", "\uC870\uD68C\uD560 organization member ID").action(async (memberId) => {
|
|
6098
6737
|
const globalOpts = memberGetCommand.optsWithGlobals();
|
|
6099
6738
|
const config = await getConfigOrThrow();
|
|
6100
6739
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -6103,8 +6742,8 @@ var memberGetCommand = new import_commander55.Command("get").description("\uBA64
|
|
|
6103
6742
|
});
|
|
6104
6743
|
|
|
6105
6744
|
// src/commands/member/list.ts
|
|
6106
|
-
var
|
|
6107
|
-
var memberListCommand = new
|
|
6745
|
+
var import_commander59 = require("commander");
|
|
6746
|
+
var memberListCommand = new import_commander59.Command("list").description("\uD504\uB85C\uC81D\uD2B8 \uBA64\uBC84 \uBAA9\uB85D").argument("<project>", "\uD504\uB85C\uC81D\uD2B8 \uCF54\uB4DC \uB610\uB294 ID").action(async (project) => {
|
|
6108
6747
|
const globalOpts = memberListCommand.optsWithGlobals();
|
|
6109
6748
|
const config = await getConfigOrThrow();
|
|
6110
6749
|
const client = new DoorayApiClient(config.apiKey, config.baseUrl);
|
|
@@ -6119,8 +6758,8 @@ var memberListCommand = new import_commander56.Command("list").description("\uD5
|
|
|
6119
6758
|
});
|
|
6120
6759
|
|
|
6121
6760
|
// src/commands/member/search.ts
|
|
6122
|
-
var
|
|
6123
|
-
var memberSearchCommand = new
|
|
6761
|
+
var import_commander60 = require("commander");
|
|
6762
|
+
var memberSearchCommand = new import_commander60.Command("search").description("organization \uC804\uCCB4\uC5D0\uC11C \uBA64\uBC84 \uAC80\uC0C9").argument("[keyword]", "\uC774\uB984 \uAC80\uC0C9\uC5B4 (--email/--user-code \uBBF8\uC9C0\uC815 \uC2DC name\uC73C\uB85C \uAC80\uC0C9)").option("--email <email>", "\uC678\uBD80 \uC774\uBA54\uC77C (\uCF64\uB9C8 \uAD6C\uBD84 \uAC00\uB2A5, exact match)").option("--user-code <code>", "\uC0AC\uBC88 like \uAC80\uC0C9").option("--user-code-exact <code>", "\uC0AC\uBC88 exact match").option("--page <n>", "\uD398\uC774\uC9C0 (\uAE30\uBCF8 0)", "0").option("--size <n>", "\uD398\uC774\uC9C0 \uD06C\uAE30 (\uAE30\uBCF8 20, max 100)", "20").action(async (keyword, opts) => {
|
|
6124
6763
|
const globalOpts = memberSearchCommand.optsWithGlobals();
|
|
6125
6764
|
const filterCount = [keyword, opts.email, opts.userCode, opts.userCodeExact].filter(Boolean).length;
|
|
6126
6765
|
if (filterCount === 0) {
|
|
@@ -6153,13 +6792,13 @@ var memberSearchCommand = new import_commander57.Command("search").description("
|
|
|
6153
6792
|
});
|
|
6154
6793
|
|
|
6155
6794
|
// src/commands/member/index.ts
|
|
6156
|
-
var memberCommand = new
|
|
6795
|
+
var memberCommand = new import_commander61.Command("member").description("Dooray \uBA64\uBC84 \uC870\uD68C");
|
|
6157
6796
|
memberCommand.addCommand(memberGetCommand);
|
|
6158
6797
|
memberCommand.addCommand(memberListCommand);
|
|
6159
6798
|
memberCommand.addCommand(memberSearchCommand);
|
|
6160
6799
|
|
|
6161
6800
|
// src/commands/mail/list.ts
|
|
6162
|
-
var
|
|
6801
|
+
var import_commander62 = require("commander");
|
|
6163
6802
|
|
|
6164
6803
|
// src/api/imapClient.ts
|
|
6165
6804
|
var import_imapflow = require("imapflow");
|
|
@@ -6340,7 +6979,7 @@ async function getMail(config, uid) {
|
|
|
6340
6979
|
|
|
6341
6980
|
// src/commands/mail/list.ts
|
|
6342
6981
|
var import_chalk6 = __toESM(require("chalk"));
|
|
6343
|
-
var mailListCommand = new
|
|
6982
|
+
var mailListCommand = new import_commander62.Command("list").description("\uBA54\uC77C \uBAA9\uB85D \uC870\uD68C").option("--unread", "\uC548\uC77D\uC740 \uBA54\uC77C\uB9CC").option("--search <keyword>", "\uC81C\uBAA9 \uAC80\uC0C9").option("--size <number>", "\uC870\uD68C \uAC1C\uC218", "20").action(async (opts) => {
|
|
6344
6983
|
const globalOpts = mailListCommand.optsWithGlobals();
|
|
6345
6984
|
const config = await getConfigOrThrow();
|
|
6346
6985
|
startSpinner("\uBA54\uC77C \uC870\uD68C \uC911...");
|
|
@@ -6372,9 +7011,9 @@ var mailListCommand = new import_commander59.Command("list").description("\uBA54
|
|
|
6372
7011
|
});
|
|
6373
7012
|
|
|
6374
7013
|
// src/commands/mail/get.ts
|
|
6375
|
-
var
|
|
7014
|
+
var import_commander63 = require("commander");
|
|
6376
7015
|
var import_chalk7 = __toESM(require("chalk"));
|
|
6377
|
-
var mailGetCommand = new
|
|
7016
|
+
var mailGetCommand = new import_commander63.Command("get").description("\uBA54\uC77C \uC0C1\uC138 \uC870\uD68C").argument("<uid>", "\uBA54\uC77C UID").action(async (uid) => {
|
|
6378
7017
|
const globalOpts = mailGetCommand.optsWithGlobals();
|
|
6379
7018
|
const config = await getConfigOrThrow();
|
|
6380
7019
|
startSpinner("\uBA54\uC77C \uC870\uD68C \uC911...");
|
|
@@ -6405,7 +7044,7 @@ ${mail.body}
|
|
|
6405
7044
|
});
|
|
6406
7045
|
|
|
6407
7046
|
// src/commands/mail/send.ts
|
|
6408
|
-
var
|
|
7047
|
+
var import_commander64 = require("commander");
|
|
6409
7048
|
var import_promises13 = require("fs/promises");
|
|
6410
7049
|
|
|
6411
7050
|
// src/api/smtpClient.ts
|
|
@@ -6457,7 +7096,7 @@ async function sendMail(config, opts) {
|
|
|
6457
7096
|
}
|
|
6458
7097
|
|
|
6459
7098
|
// src/commands/mail/send.ts
|
|
6460
|
-
var mailSendCommand = new
|
|
7099
|
+
var mailSendCommand = new import_commander64.Command("send").description("\uBA54\uC77C \uBC1C\uC1A1").requiredOption("--to <addresses...>", "\uBC1B\uB294\uC0AC\uB78C \uC774\uBA54\uC77C (\uBCF5\uC218 \uAC00\uB2A5)").requiredOption("--subject <title>", "\uC81C\uBAA9").option("--body <text>", "\uBCF8\uBB38").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C").option("--cc <addresses...>", "\uCC38\uC870").option("--bcc <addresses...>", "\uC228\uC740\uCC38\uC870").option("--html", "\uBCF8\uBB38\uC744 HTML\uB85C \uC804\uC1A1").action(async (opts) => {
|
|
6461
7100
|
const globalOpts = mailSendCommand.optsWithGlobals();
|
|
6462
7101
|
const config = await getConfigOrThrow();
|
|
6463
7102
|
let body = opts.body ?? "";
|
|
@@ -6492,7 +7131,7 @@ var mailSendCommand = new import_commander61.Command("send").description("\uBA54
|
|
|
6492
7131
|
});
|
|
6493
7132
|
|
|
6494
7133
|
// src/commands/mail/reply.ts
|
|
6495
|
-
var
|
|
7134
|
+
var import_commander65 = require("commander");
|
|
6496
7135
|
var import_promises14 = require("fs/promises");
|
|
6497
7136
|
async function getMessageId(config, uid) {
|
|
6498
7137
|
const client = createImapClient(config);
|
|
@@ -6513,7 +7152,7 @@ async function getMessageId(config, uid) {
|
|
|
6513
7152
|
await closeImapClient(client);
|
|
6514
7153
|
}
|
|
6515
7154
|
}
|
|
6516
|
-
var mailReplyCommand = new
|
|
7155
|
+
var mailReplyCommand = new import_commander65.Command("reply").description("\uBA54\uC77C \uB2F5\uC7A5").argument("<uid>", "\uC6D0\uBCF8 \uBA54\uC77C UID").option("--body <text>", "\uB2F5\uC7A5 \uBCF8\uBB38").option("--body-file <path>", "\uB2F5\uC7A5 \uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C").option("--cc <addresses...>", "\uCC38\uC870").option("--html", "\uBCF8\uBB38\uC744 HTML\uB85C \uC804\uC1A1").action(async (uid, opts) => {
|
|
6517
7156
|
const globalOpts = mailReplyCommand.optsWithGlobals();
|
|
6518
7157
|
const config = await getConfigOrThrow();
|
|
6519
7158
|
let body = opts.body ?? "";
|
|
@@ -6554,7 +7193,7 @@ var mailReplyCommand = new import_commander62.Command("reply").description("\uBA
|
|
|
6554
7193
|
});
|
|
6555
7194
|
|
|
6556
7195
|
// src/commands/mail/logout.ts
|
|
6557
|
-
var
|
|
7196
|
+
var import_commander66 = require("commander");
|
|
6558
7197
|
var import_chalk8 = __toESM(require("chalk"));
|
|
6559
7198
|
async function authorizeMailLogout(skipConfirmation, isTTY, confirmRemoval) {
|
|
6560
7199
|
if (skipConfirmation) return true;
|
|
@@ -6566,7 +7205,7 @@ async function authorizeMailLogout(skipConfirmation, isTTY, confirmRemoval) {
|
|
|
6566
7205
|
}
|
|
6567
7206
|
return confirmRemoval();
|
|
6568
7207
|
}
|
|
6569
|
-
var mailLogoutCommand = new
|
|
7208
|
+
var mailLogoutCommand = new import_commander66.Command("logout").description("\uC800\uC7A5\uB41C \uBA54\uC77C \uC778\uC99D\uC815\uBCF4 \uC81C\uAC70").option("-y, --yes", "\uD655\uC778 \uC5C6\uC774 \uC778\uC99D\uC815\uBCF4 \uC81C\uAC70 (\uC790\uB3D9\uD654\uC6A9)").action(async (opts) => {
|
|
6570
7209
|
const confirmed = await authorizeMailLogout(
|
|
6571
7210
|
!!opts.yes,
|
|
6572
7211
|
!!process.stdin.isTTY,
|
|
@@ -6582,18 +7221,21 @@ var mailLogoutCommand = new import_commander63.Command("logout").description("\u
|
|
|
6582
7221
|
process.stderr.write("\uCDE8\uC18C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.\n");
|
|
6583
7222
|
return;
|
|
6584
7223
|
}
|
|
6585
|
-
const
|
|
7224
|
+
const result = await clearMailCredentials();
|
|
7225
|
+
if (result.state === "failed") {
|
|
7226
|
+
throw new DoorayCliError(result.reason, EXIT_CONFIG_ERROR);
|
|
7227
|
+
}
|
|
6586
7228
|
process.stderr.write(
|
|
6587
|
-
|
|
7229
|
+
result.state === "cleared" && result.hadCredentials ? import_chalk8.default.green("\u2713 \uBA54\uC77C \uC778\uC99D\uC815\uBCF4\uB97C \uC81C\uAC70\uD588\uC2B5\uB2C8\uB2E4.\n") : "\uC800\uC7A5\uB41C \uBA54\uC77C \uC778\uC99D\uC815\uBCF4\uAC00 \uC5C6\uC2B5\uB2C8\uB2E4.\n"
|
|
6588
7230
|
);
|
|
6589
7231
|
});
|
|
6590
7232
|
|
|
6591
7233
|
// src/commands/messenger/index.ts
|
|
6592
|
-
var
|
|
7234
|
+
var import_commander69 = require("commander");
|
|
6593
7235
|
|
|
6594
7236
|
// src/commands/messenger/send.ts
|
|
6595
|
-
var
|
|
6596
|
-
var messengerSendCommand = new
|
|
7237
|
+
var import_commander67 = require("commander");
|
|
7238
|
+
var messengerSendCommand = new import_commander67.Command("send").description("\uBA54\uC2E0\uC800 1:1 \uB2E4\uC774\uB809\uD2B8 \uBA54\uC2DC\uC9C0 \uC804\uC1A1 (--body \uC5C6\uC73C\uBA74 $EDITOR)").option("--to <id|email>", "\uBC1B\uB294 \uC0AC\uB78C (organizationMemberId \uB610\uB294 \uC774\uBA54\uC77C \u2014 \uC774\uB984 \uBBF8\uC9C0\uC6D0)").option("--body <text>", "\uBA54\uC2DC\uC9C0 \uBCF8\uBB38 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").action(async (opts) => {
|
|
6597
7239
|
if (!opts.to) {
|
|
6598
7240
|
throw new DoorayCliError("--to \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
6599
7241
|
}
|
|
@@ -6633,7 +7275,7 @@ var messengerSendCommand = new import_commander64.Command("send").description("\
|
|
|
6633
7275
|
});
|
|
6634
7276
|
|
|
6635
7277
|
// src/commands/messenger/channel-send.ts
|
|
6636
|
-
var
|
|
7278
|
+
var import_commander68 = require("commander");
|
|
6637
7279
|
|
|
6638
7280
|
// src/resolvers/messenger-channel.ts
|
|
6639
7281
|
var CHANNEL_ID_RE = /^\d{15,}$/;
|
|
@@ -6651,7 +7293,7 @@ async function resolveMessengerChannel(client, input2) {
|
|
|
6651
7293
|
}
|
|
6652
7294
|
|
|
6653
7295
|
// src/commands/messenger/channel-send.ts
|
|
6654
|
-
var messengerChannelSendCommand = new
|
|
7296
|
+
var messengerChannelSendCommand = new import_commander68.Command("channel-send").description("\uBA54\uC2E0\uC800 \uB300\uD654\uBC29 \uBA54\uC2DC\uC9C0 \uC804\uC1A1 (--body \uC5C6\uC73C\uBA74 $EDITOR)").option("--channel <channelId|\uC774\uB984>", "\uB300\uD654\uBC29 channelId \uB610\uB294 \uC774\uB984 (\uBD80\uBD84\uC77C\uCE58)").option("--body <text>", "\uBA54\uC2DC\uC9C0 \uBCF8\uBB38 (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C (- \uC785\uB825 \uC2DC stdin\uC5D0\uC11C \uC77D\uAE30)").action(async (opts) => {
|
|
6655
7297
|
if (!opts.channel) {
|
|
6656
7298
|
throw new DoorayCliError("--channel \uC635\uC158\uC740 \uD544\uC218\uC785\uB2C8\uB2E4.", EXIT_PARAM_ERROR);
|
|
6657
7299
|
}
|
|
@@ -6685,12 +7327,12 @@ var messengerChannelSendCommand = new import_commander65.Command("channel-send")
|
|
|
6685
7327
|
});
|
|
6686
7328
|
|
|
6687
7329
|
// src/commands/messenger/index.ts
|
|
6688
|
-
var messengerCommand = new
|
|
7330
|
+
var messengerCommand = new import_commander69.Command("messenger").description("\uBA54\uC2E0\uC800 \uAD00\uB828 \uBA85\uB839");
|
|
6689
7331
|
messengerCommand.addCommand(messengerSendCommand);
|
|
6690
7332
|
messengerCommand.addCommand(messengerChannelSendCommand);
|
|
6691
7333
|
|
|
6692
7334
|
// src/commands/feedback.ts
|
|
6693
|
-
var
|
|
7335
|
+
var import_commander70 = require("commander");
|
|
6694
7336
|
var import_node_child_process2 = require("child_process");
|
|
6695
7337
|
var import_node_util = require("util");
|
|
6696
7338
|
var import_promises17 = require("fs/promises");
|
|
@@ -6801,7 +7443,7 @@ async function readBody(opts) {
|
|
|
6801
7443
|
if (opts.bodyFile) return await (0, import_promises17.readFile)(opts.bodyFile, "utf-8");
|
|
6802
7444
|
return void 0;
|
|
6803
7445
|
}
|
|
6804
|
-
var feedbackCommand = new
|
|
7446
|
+
var feedbackCommand = new import_commander70.Command("feedback").description("dooray-cli\uC5D0 \uB300\uD55C GitHub issue \uB4F1\uB85D (gh CLI \uC704\uC784)").option("--title <text>", "\uC774\uC288 \uC81C\uBAA9 (\uC5C6\uC73C\uBA74 \uC778\uD130\uB799\uD2F0\uBE0C)").option("--body <text>", "\uC774\uC288 \uBCF8\uBB38").option("--body-file <path>", "\uBCF8\uBB38 \uD30C\uC77C \uACBD\uB85C").option(
|
|
6805
7447
|
"--label <name>",
|
|
6806
7448
|
"\uB77C\uBCA8 (\uBC18\uBCF5 \uAC00\uB2A5)",
|
|
6807
7449
|
(value, prev) => [...prev, value],
|
|
@@ -6964,7 +7606,7 @@ function sanitizeArgv(argv) {
|
|
|
6964
7606
|
}
|
|
6965
7607
|
|
|
6966
7608
|
// src/index.ts
|
|
6967
|
-
var program = new
|
|
7609
|
+
var program = new import_commander71.Command();
|
|
6968
7610
|
program.name("dooray").description("Dooray REST API CLI").version(CLI_VERSION).option("--json", "JSON \uD615\uC2DD\uC73C\uB85C \uCD9C\uB825").option("--quiet", "ID\uB9CC \uCD9C\uB825").option("--no-color", "\uC0C9\uC0C1 \uBE44\uD65C\uC131\uD654");
|
|
6969
7611
|
program.hook("preAction", () => {
|
|
6970
7612
|
const opts = program.opts();
|
|
@@ -6975,14 +7617,17 @@ program.hook("preAction", () => {
|
|
|
6975
7617
|
setQuiet(true);
|
|
6976
7618
|
}
|
|
6977
7619
|
});
|
|
6978
|
-
var projectCommand = new
|
|
7620
|
+
var projectCommand = new import_commander71.Command("project").description("\uD504\uB85C\uC81D\uD2B8 \uAD00\uB828 \uBA85\uB839");
|
|
6979
7621
|
projectCommand.addCommand(projectListCommand);
|
|
6980
7622
|
projectCommand.addCommand(projectMembersCommand);
|
|
6981
7623
|
projectCommand.addCommand(projectWorkflowsCommand);
|
|
6982
7624
|
projectCommand.addCommand(projectGroupsCommand);
|
|
6983
7625
|
projectCommand.addCommand(projectTagsCommand);
|
|
6984
7626
|
projectCommand.addCommand(projectTemplatesCommand);
|
|
6985
|
-
|
|
7627
|
+
projectTagsCommand.addCommand(projectTagsListCommand);
|
|
7628
|
+
projectTagsCommand.addCommand(projectTagsCreateCommand);
|
|
7629
|
+
projectTagsCommand.addCommand(projectTagsGroupCommand);
|
|
7630
|
+
var postCommand = new import_commander71.Command("post").description("\uC5C5\uBB34 \uAD00\uB828 \uBA85\uB839");
|
|
6986
7631
|
postCommand.addCommand(postListCommand);
|
|
6987
7632
|
postCommand.addCommand(postSearchCommand);
|
|
6988
7633
|
postCommand.addCommand(postGetCommand);
|
|
@@ -6990,7 +7635,7 @@ postCommand.addCommand(postEditCommand);
|
|
|
6990
7635
|
postCommand.addCommand(postCreateCommand);
|
|
6991
7636
|
postCommand.addCommand(postDoneCommand);
|
|
6992
7637
|
postCommand.addCommand(postWorkflowCommand);
|
|
6993
|
-
var commentCommand = new
|
|
7638
|
+
var commentCommand = new import_commander71.Command("comment").description("\uB313\uAE00 \uAD00\uB828 \uBA85\uB839");
|
|
6994
7639
|
commentCommand.addCommand(commentListCommand);
|
|
6995
7640
|
commentCommand.addCommand(commentLatestCommand);
|
|
6996
7641
|
commentCommand.addCommand(commentGetCommand);
|
|
@@ -6999,26 +7644,27 @@ commentCommand.addCommand(commentEditCommand);
|
|
|
6999
7644
|
commentCommand.addCommand(commentDeleteCommand);
|
|
7000
7645
|
commentCommand.addCommand(commentFileCommand);
|
|
7001
7646
|
postCommand.addCommand(commentCommand);
|
|
7002
|
-
var fileCommand = new
|
|
7647
|
+
var fileCommand = new import_commander71.Command("file").description("\uCCA8\uBD80\uD30C\uC77C \uAD00\uB828 \uBA85\uB839");
|
|
7003
7648
|
fileCommand.addCommand(fileListCommand);
|
|
7004
7649
|
fileCommand.addCommand(fileDownloadCommand);
|
|
7005
7650
|
fileCommand.addCommand(fileDownloadAllCommand);
|
|
7006
7651
|
fileCommand.addCommand(fileUploadCommand);
|
|
7007
7652
|
fileCommand.addCommand(fileDeleteCommand);
|
|
7008
7653
|
postCommand.addCommand(fileCommand);
|
|
7009
|
-
var wikiCommand = new
|
|
7654
|
+
var wikiCommand = new import_commander71.Command("wiki").description("\uC704\uD0A4 \uAD00\uB828 \uBA85\uB839");
|
|
7010
7655
|
wikiCommand.addCommand(wikiListCommand);
|
|
7011
7656
|
wikiCommand.addCommand(wikiPagesCommand);
|
|
7012
7657
|
wikiCommand.addCommand(wikiTreeCommand);
|
|
7013
|
-
var wikiPageCommand = new
|
|
7658
|
+
var wikiPageCommand = new import_commander71.Command("page").description("\uC704\uD0A4 \uD398\uC774\uC9C0 \uAD00\uB828 \uBA85\uB839");
|
|
7014
7659
|
wikiPageCommand.addCommand(wikiPageGetCommand);
|
|
7015
7660
|
wikiPageCommand.addCommand(wikiPageCreateCommand);
|
|
7016
7661
|
wikiPageCommand.addCommand(wikiPageEditCommand);
|
|
7017
7662
|
wikiPageCommand.addCommand(wikiPageDeleteCommand);
|
|
7663
|
+
wikiPageCommand.addCommand(wikiPageMoveCommand);
|
|
7018
7664
|
wikiPageCommand.addCommand(wikiPageFileCommand);
|
|
7019
7665
|
wikiPageCommand.addCommand(wikiPageCommentCommand);
|
|
7020
7666
|
wikiCommand.addCommand(wikiPageCommand);
|
|
7021
|
-
var mailCommand = new
|
|
7667
|
+
var mailCommand = new import_commander71.Command("mail").description("\uBA54\uC77C \uAD00\uB828 \uBA85\uB839");
|
|
7022
7668
|
mailCommand.addCommand(mailListCommand);
|
|
7023
7669
|
mailCommand.addCommand(mailGetCommand);
|
|
7024
7670
|
mailCommand.addCommand(mailSendCommand);
|
|
@@ -7044,7 +7690,7 @@ program.parseAsync().catch(async (err) => {
|
|
|
7044
7690
|
const sanitized = sanitizeArgv(process.argv.slice(2));
|
|
7045
7691
|
const firstNonFlag = sanitized.find((a) => !a.startsWith("-"));
|
|
7046
7692
|
const isFeedbackCommand = firstNonFlag === "feedback";
|
|
7047
|
-
if (config
|
|
7693
|
+
if (config.state === "ok" && config.config.trackLastRun && !isFeedbackCommand) {
|
|
7048
7694
|
await writeLastRun({
|
|
7049
7695
|
argv: ["dooray", ...sanitized],
|
|
7050
7696
|
exitCode,
|