backlog-exporter 0.0.6

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 ADDED
@@ -0,0 +1,593 @@
1
+ # backlog-exporter
2
+
3
+ Backlog のデータをエクスポートするためのコマンドラインツール
4
+
5
+ [![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
6
+ [![Version](https://img.shields.io/npm/v/backlog-exporter.svg)](https://npmjs.org/package/backlog-exporter)
7
+ [![Downloads/week](https://img.shields.io/npm/dw/backlog-exporter.svg)](https://npmjs.org/package/backlog-exporter)
8
+
9
+ <!-- toc -->
10
+ * [backlog-exporter](#backlog-exporter)
11
+ * [概要](#概要)
12
+ * [インストール](#インストール)
13
+ * [使用方法](#使用方法)
14
+ * [課題のエクスポート](#課題のエクスポート)
15
+ * [Wikiのエクスポート](#wikiのエクスポート)
16
+ * [課題とWikiの一括エクスポート](#課題とwikiの一括エクスポート)
17
+ * [コマンド](#コマンド)
18
+ * [出力形式](#出力形式)
19
+ * [課題のタイトル](#課題のタイトル)
20
+ * [Wiki のタイトル](#wiki-のタイトル)
21
+ * [その他の特徴](#その他の特徴)
22
+ <!-- tocstop -->
23
+
24
+ # 概要
25
+
26
+ backlog-exporter は、Backlog のデータをローカルにエクスポートするためのコマンドラインツールです。
27
+ 現在、以下の機能をサポートしています:
28
+
29
+ - **課題(Issue)のエクスポート**:Backlog の課題を Markdown ファイルとして保存
30
+ - **Wiki 記事のエクスポート**:Backlog の Wiki 記事を Markdown ファイルとして保存
31
+ - **一括エクスポート**:課題と Wiki を同時に取得する機能
32
+
33
+ # インストール
34
+
35
+ <!-- usage -->
36
+ ```sh-session
37
+ $ npm install -g backlog-exporter
38
+ $ backlog-exporter COMMAND
39
+ running command...
40
+ $ backlog-exporter (--version)
41
+ backlog-exporter/0.0.6 linux-x64 node-v23.9.0
42
+ $ backlog-exporter --help [COMMAND]
43
+ USAGE
44
+ $ backlog-exporter COMMAND
45
+ ...
46
+ ```
47
+ <!-- usagestop -->
48
+
49
+ # 使用方法
50
+
51
+ backlog-exporter を使用するには、Backlog のドメイン、プロジェクト ID(またはキー)、API キーが必要です。
52
+
53
+ API キーは以下の方法で指定できます:
54
+
55
+ 1. コマンドラインオプションとして指定
56
+ 2. 環境変数 `BACKLOG_API_KEY` に設定
57
+ 3. `.env` ファイルに `BACKLOG_API_KEY=あなたのAPIキー` として設定
58
+
59
+ ## 基本的な使用例
60
+
61
+ ```sh
62
+ # 課題のエクスポート
63
+ $ backlog-exporter issue --domain example.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY --output ./issues
64
+
65
+ # Wikiのエクスポート
66
+ $ backlog-exporter wiki --domain example.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY --output ./wiki
67
+
68
+ # 課題とWikiの一括エクスポート
69
+ $ backlog-exporter all --domain example.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY --output ./backlog-data
70
+ ```
71
+
72
+ # コマンド
73
+
74
+ <!-- commands -->
75
+ * [`backlog-exporter all [URL]`](#backlog-exporter-all-url)
76
+ * [`backlog-exporter hello PERSON`](#backlog-exporter-hello-person)
77
+ * [`backlog-exporter hello world`](#backlog-exporter-hello-world)
78
+ * [`backlog-exporter help [COMMAND]`](#backlog-exporter-help-command)
79
+ * [`backlog-exporter issue [URL]`](#backlog-exporter-issue-url)
80
+ * [`backlog-exporter plugins`](#backlog-exporter-plugins)
81
+ * [`backlog-exporter plugins add PLUGIN`](#backlog-exporter-plugins-add-plugin)
82
+ * [`backlog-exporter plugins:inspect PLUGIN...`](#backlog-exporter-pluginsinspect-plugin)
83
+ * [`backlog-exporter plugins install PLUGIN`](#backlog-exporter-plugins-install-plugin)
84
+ * [`backlog-exporter plugins link PATH`](#backlog-exporter-plugins-link-path)
85
+ * [`backlog-exporter plugins remove [PLUGIN]`](#backlog-exporter-plugins-remove-plugin)
86
+ * [`backlog-exporter plugins reset`](#backlog-exporter-plugins-reset)
87
+ * [`backlog-exporter plugins uninstall [PLUGIN]`](#backlog-exporter-plugins-uninstall-plugin)
88
+ * [`backlog-exporter plugins unlink [PLUGIN]`](#backlog-exporter-plugins-unlink-plugin)
89
+ * [`backlog-exporter plugins update`](#backlog-exporter-plugins-update)
90
+ * [`backlog-exporter wiki [URL]`](#backlog-exporter-wiki-url)
91
+
92
+ ## `backlog-exporter all [URL]`
93
+
94
+ Backlogからissueとwikiを同時に取得する
95
+
96
+ ```
97
+ USAGE
98
+ $ backlog-exporter all [URL] --domain <value> --projectIdOrKey <value> [--apiKey <value>] [-c <value>]
99
+ [-o <value>] [--statusId <value>]
100
+
101
+ ARGUMENTS
102
+ URL URL to download from
103
+
104
+ FLAGS
105
+ -c, --count=<value> [default: 100] 一度に取得する課題数
106
+ -o, --output=<value> 出力ディレクトリのルートパス(デフォルトはプロジェクトキー)
107
+ --apiKey=<value> Backlog API key (環境変数 BACKLOG_API_KEY からも自動読み取り可能)
108
+ --domain=<value> (required) Backlog domain (e.g. example.backlog.jp)
109
+ --projectIdOrKey=<value> (required) Backlog project ID or key
110
+ --statusId=<value> Filter issues by status ID
111
+
112
+ DESCRIPTION
113
+ Backlogからissueとwikiを同時に取得する
114
+
115
+ EXAMPLES
116
+ $ backlog-exporter all --domain cm1.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY -o ./output-dir
117
+ BacklogからAPIキーを使用してissueとwikiを同時に取得する
118
+ ```
119
+
120
+ _See code: [src/commands/all/index.ts](https://github.com/ShuntaToda/backlog-exporter/blob/v0.0.6/src/commands/all/index.ts)_
121
+
122
+ ## `backlog-exporter hello PERSON`
123
+
124
+ Say hello
125
+
126
+ ```
127
+ USAGE
128
+ $ backlog-exporter hello PERSON -f <value>
129
+
130
+ ARGUMENTS
131
+ PERSON Person to say hello to
132
+
133
+ FLAGS
134
+ -f, --from=<value> (required) Who is saying hello
135
+
136
+ DESCRIPTION
137
+ Say hello
138
+
139
+ EXAMPLES
140
+ $ backlog-exporter hello friend --from oclif
141
+ hello friend from oclif! (./src/commands/hello/index.ts)
142
+ ```
143
+
144
+ _See code: [src/commands/hello/index.ts](https://github.com/ShuntaToda/backlog-exporter/blob/v0.0.6/src/commands/hello/index.ts)_
145
+
146
+ ## `backlog-exporter hello world`
147
+
148
+ Say hello world
149
+
150
+ ```
151
+ USAGE
152
+ $ backlog-exporter hello world
153
+
154
+ DESCRIPTION
155
+ Say hello world
156
+
157
+ EXAMPLES
158
+ $ backlog-exporter hello world
159
+ hello world! (./src/commands/hello/world.ts)
160
+ ```
161
+
162
+ _See code: [src/commands/hello/world.ts](https://github.com/ShuntaToda/backlog-exporter/blob/v0.0.6/src/commands/hello/world.ts)_
163
+
164
+ ## `backlog-exporter help [COMMAND]`
165
+
166
+ Display help for backlog-exporter.
167
+
168
+ ```
169
+ USAGE
170
+ $ backlog-exporter help [COMMAND...] [-n]
171
+
172
+ ARGUMENTS
173
+ COMMAND... Command to show help for.
174
+
175
+ FLAGS
176
+ -n, --nested-commands Include all nested commands in the output.
177
+
178
+ DESCRIPTION
179
+ Display help for backlog-exporter.
180
+ ```
181
+
182
+ _See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v6.2.26/src/commands/help.ts)_
183
+
184
+ ## `backlog-exporter issue [URL]`
185
+
186
+ Backlogから課題をダウンロードする
187
+
188
+ ```
189
+ USAGE
190
+ $ backlog-exporter issue [URL] --domain <value> --projectIdOrKey <value> [--apiKey <value>] [-c <value>]
191
+ [-o <value>] [--statusId <value>]
192
+
193
+ ARGUMENTS
194
+ URL URL to download from
195
+
196
+ FLAGS
197
+ -c, --count=<value> [default: 100] 一度に取得する課題数
198
+ -o, --output=<value> [default: ./backlog-issues] 出力ディレクトリパス
199
+ --apiKey=<value> Backlog API key (環境変数 BACKLOG_API_KEY からも自動読み取り可能)
200
+ --domain=<value> (required) Backlog domain (e.g. example.backlog.jp)
201
+ --projectIdOrKey=<value> (required) Backlog project ID or key
202
+ --statusId=<value> Filter issues by status ID
203
+
204
+ DESCRIPTION
205
+ Backlogから課題をダウンロードする
206
+
207
+ EXAMPLES
208
+ $ backlog-exporter issue --domain cm1.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY --output ./issue-data
209
+ BacklogからAPIキーを使用して課題をダウンロードする
210
+ ```
211
+
212
+ _See code: [src/commands/issue/index.ts](https://github.com/ShuntaToda/backlog-exporter/blob/v0.0.6/src/commands/issue/index.ts)_
213
+
214
+ ## `backlog-exporter plugins`
215
+
216
+ List installed plugins.
217
+
218
+ ```
219
+ USAGE
220
+ $ backlog-exporter plugins [--json] [--core]
221
+
222
+ FLAGS
223
+ --core Show core plugins.
224
+
225
+ GLOBAL FLAGS
226
+ --json Format output as json.
227
+
228
+ DESCRIPTION
229
+ List installed plugins.
230
+
231
+ EXAMPLES
232
+ $ backlog-exporter plugins
233
+ ```
234
+
235
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/index.ts)_
236
+
237
+ ## `backlog-exporter plugins add PLUGIN`
238
+
239
+ Installs a plugin into backlog-exporter.
240
+
241
+ ```
242
+ USAGE
243
+ $ backlog-exporter plugins add PLUGIN... [--json] [-f] [-h] [-s | -v]
244
+
245
+ ARGUMENTS
246
+ PLUGIN... Plugin to install.
247
+
248
+ FLAGS
249
+ -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
250
+ -h, --help Show CLI help.
251
+ -s, --silent Silences npm output.
252
+ -v, --verbose Show verbose npm output.
253
+
254
+ GLOBAL FLAGS
255
+ --json Format output as json.
256
+
257
+ DESCRIPTION
258
+ Installs a plugin into backlog-exporter.
259
+
260
+ Uses npm to install plugins.
261
+
262
+ Installation of a user-installed plugin will override a core plugin.
263
+
264
+ Use the BACKLOG_EXPORTER_NPM_LOG_LEVEL environment variable to set the npm loglevel.
265
+ Use the BACKLOG_EXPORTER_NPM_REGISTRY environment variable to set the npm registry.
266
+
267
+ ALIASES
268
+ $ backlog-exporter plugins add
269
+
270
+ EXAMPLES
271
+ Install a plugin from npm registry.
272
+
273
+ $ backlog-exporter plugins add myplugin
274
+
275
+ Install a plugin from a github url.
276
+
277
+ $ backlog-exporter plugins add https://github.com/someuser/someplugin
278
+
279
+ Install a plugin from a github slug.
280
+
281
+ $ backlog-exporter plugins add someuser/someplugin
282
+ ```
283
+
284
+ ## `backlog-exporter plugins:inspect PLUGIN...`
285
+
286
+ Displays installation properties of a plugin.
287
+
288
+ ```
289
+ USAGE
290
+ $ backlog-exporter plugins inspect PLUGIN...
291
+
292
+ ARGUMENTS
293
+ PLUGIN... [default: .] Plugin to inspect.
294
+
295
+ FLAGS
296
+ -h, --help Show CLI help.
297
+ -v, --verbose
298
+
299
+ GLOBAL FLAGS
300
+ --json Format output as json.
301
+
302
+ DESCRIPTION
303
+ Displays installation properties of a plugin.
304
+
305
+ EXAMPLES
306
+ $ backlog-exporter plugins inspect myplugin
307
+ ```
308
+
309
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/inspect.ts)_
310
+
311
+ ## `backlog-exporter plugins install PLUGIN`
312
+
313
+ Installs a plugin into backlog-exporter.
314
+
315
+ ```
316
+ USAGE
317
+ $ backlog-exporter plugins install PLUGIN... [--json] [-f] [-h] [-s | -v]
318
+
319
+ ARGUMENTS
320
+ PLUGIN... Plugin to install.
321
+
322
+ FLAGS
323
+ -f, --force Force npm to fetch remote resources even if a local copy exists on disk.
324
+ -h, --help Show CLI help.
325
+ -s, --silent Silences npm output.
326
+ -v, --verbose Show verbose npm output.
327
+
328
+ GLOBAL FLAGS
329
+ --json Format output as json.
330
+
331
+ DESCRIPTION
332
+ Installs a plugin into backlog-exporter.
333
+
334
+ Uses npm to install plugins.
335
+
336
+ Installation of a user-installed plugin will override a core plugin.
337
+
338
+ Use the BACKLOG_EXPORTER_NPM_LOG_LEVEL environment variable to set the npm loglevel.
339
+ Use the BACKLOG_EXPORTER_NPM_REGISTRY environment variable to set the npm registry.
340
+
341
+ ALIASES
342
+ $ backlog-exporter plugins add
343
+
344
+ EXAMPLES
345
+ Install a plugin from npm registry.
346
+
347
+ $ backlog-exporter plugins install myplugin
348
+
349
+ Install a plugin from a github url.
350
+
351
+ $ backlog-exporter plugins install https://github.com/someuser/someplugin
352
+
353
+ Install a plugin from a github slug.
354
+
355
+ $ backlog-exporter plugins install someuser/someplugin
356
+ ```
357
+
358
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/install.ts)_
359
+
360
+ ## `backlog-exporter plugins link PATH`
361
+
362
+ Links a plugin into the CLI for development.
363
+
364
+ ```
365
+ USAGE
366
+ $ backlog-exporter plugins link PATH [-h] [--install] [-v]
367
+
368
+ ARGUMENTS
369
+ PATH [default: .] path to plugin
370
+
371
+ FLAGS
372
+ -h, --help Show CLI help.
373
+ -v, --verbose
374
+ --[no-]install Install dependencies after linking the plugin.
375
+
376
+ DESCRIPTION
377
+ Links a plugin into the CLI for development.
378
+
379
+ Installation of a linked plugin will override a user-installed or core plugin.
380
+
381
+ e.g. If you have a user-installed or core plugin that has a 'hello' command, installing a linked plugin with a 'hello'
382
+ command will override the user-installed or core plugin implementation. This is useful for development work.
383
+
384
+
385
+ EXAMPLES
386
+ $ backlog-exporter plugins link myplugin
387
+ ```
388
+
389
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/link.ts)_
390
+
391
+ ## `backlog-exporter plugins remove [PLUGIN]`
392
+
393
+ Removes a plugin from the CLI.
394
+
395
+ ```
396
+ USAGE
397
+ $ backlog-exporter plugins remove [PLUGIN...] [-h] [-v]
398
+
399
+ ARGUMENTS
400
+ PLUGIN... plugin to uninstall
401
+
402
+ FLAGS
403
+ -h, --help Show CLI help.
404
+ -v, --verbose
405
+
406
+ DESCRIPTION
407
+ Removes a plugin from the CLI.
408
+
409
+ ALIASES
410
+ $ backlog-exporter plugins unlink
411
+ $ backlog-exporter plugins remove
412
+
413
+ EXAMPLES
414
+ $ backlog-exporter plugins remove myplugin
415
+ ```
416
+
417
+ ## `backlog-exporter plugins reset`
418
+
419
+ Remove all user-installed and linked plugins.
420
+
421
+ ```
422
+ USAGE
423
+ $ backlog-exporter plugins reset [--hard] [--reinstall]
424
+
425
+ FLAGS
426
+ --hard Delete node_modules and package manager related files in addition to uninstalling plugins.
427
+ --reinstall Reinstall all plugins after uninstalling.
428
+ ```
429
+
430
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/reset.ts)_
431
+
432
+ ## `backlog-exporter plugins uninstall [PLUGIN]`
433
+
434
+ Removes a plugin from the CLI.
435
+
436
+ ```
437
+ USAGE
438
+ $ backlog-exporter plugins uninstall [PLUGIN...] [-h] [-v]
439
+
440
+ ARGUMENTS
441
+ PLUGIN... plugin to uninstall
442
+
443
+ FLAGS
444
+ -h, --help Show CLI help.
445
+ -v, --verbose
446
+
447
+ DESCRIPTION
448
+ Removes a plugin from the CLI.
449
+
450
+ ALIASES
451
+ $ backlog-exporter plugins unlink
452
+ $ backlog-exporter plugins remove
453
+
454
+ EXAMPLES
455
+ $ backlog-exporter plugins uninstall myplugin
456
+ ```
457
+
458
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/uninstall.ts)_
459
+
460
+ ## `backlog-exporter plugins unlink [PLUGIN]`
461
+
462
+ Removes a plugin from the CLI.
463
+
464
+ ```
465
+ USAGE
466
+ $ backlog-exporter plugins unlink [PLUGIN...] [-h] [-v]
467
+
468
+ ARGUMENTS
469
+ PLUGIN... plugin to uninstall
470
+
471
+ FLAGS
472
+ -h, --help Show CLI help.
473
+ -v, --verbose
474
+
475
+ DESCRIPTION
476
+ Removes a plugin from the CLI.
477
+
478
+ ALIASES
479
+ $ backlog-exporter plugins unlink
480
+ $ backlog-exporter plugins remove
481
+
482
+ EXAMPLES
483
+ $ backlog-exporter plugins unlink myplugin
484
+ ```
485
+
486
+ ## `backlog-exporter plugins update`
487
+
488
+ Update installed plugins.
489
+
490
+ ```
491
+ USAGE
492
+ $ backlog-exporter plugins update [-h] [-v]
493
+
494
+ FLAGS
495
+ -h, --help Show CLI help.
496
+ -v, --verbose
497
+
498
+ DESCRIPTION
499
+ Update installed plugins.
500
+ ```
501
+
502
+ _See code: [@oclif/plugin-plugins](https://github.com/oclif/plugin-plugins/blob/v5.4.34/src/commands/plugins/update.ts)_
503
+
504
+ ## `backlog-exporter wiki [URL]`
505
+
506
+ BacklogからWikiコンテンツをダウンロードする
507
+
508
+ ```
509
+ USAGE
510
+ $ backlog-exporter wiki [URL] --domain <value> --projectIdOrKey <value> [--apiKey <value>] [-o <value>]
511
+
512
+ ARGUMENTS
513
+ URL URL to download from
514
+
515
+ FLAGS
516
+ -o, --output=<value> [default: ./backlog-wiki] 出力ディレクトリパス
517
+ --apiKey=<value> Backlog API key (環境変数 BACKLOG_API_KEY からも自動読み取り可能)
518
+ --domain=<value> (required) Backlog domain (e.g. example.backlog.jp)
519
+ --projectIdOrKey=<value> (required) Backlog project ID or key
520
+
521
+ DESCRIPTION
522
+ BacklogからWikiコンテンツをダウンロードする
523
+
524
+ EXAMPLES
525
+ $ backlog-exporter wiki --domain cm1.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY --output ./wiki-data
526
+ BacklogからAPIキーを使用してWikiコンテンツをダウンロードする
527
+ ```
528
+
529
+ _See code: [src/commands/wiki/index.ts](https://github.com/ShuntaToda/backlog-exporter/blob/v0.0.6/src/commands/wiki/index.ts)_
530
+ <!-- commandsstop -->
531
+
532
+ # 出力形式
533
+
534
+ ## 課題の出力形式
535
+
536
+ 課題は以下の形式で Markdown ファイルとして保存されます:
537
+
538
+ ```markdown
539
+ # 課題のタイトル
540
+
541
+ ## 基本情報
542
+
543
+ - 課題キー: PROJ-123
544
+ - ステータス: 処理中
545
+ - 優先度: 高
546
+ - 担当者: 山田太郎
547
+ - 作成日時: 2023/01/01 10:00:00
548
+ - 更新日時: 2023/01/02 15:30:45
549
+ - [Backlog Issue Link](https://example.backlog.jp/view/PROJ-123)
550
+
551
+ ## 詳細
552
+
553
+ ここに課題の詳細説明が入ります。
554
+
555
+ ## コメント
556
+
557
+ ### コメント 1
558
+
559
+ - **投稿者**: 佐藤次郎
560
+ - **日時**: 2023/01/01 11:15:30
561
+
562
+ コメントの内容がここに表示されます。
563
+
564
+ ---
565
+
566
+ ### コメント 2
567
+
568
+ - **投稿者**: 鈴木三郎
569
+ - **日時**: 2023/01/02 09:45:12
570
+
571
+ 返信コメントの内容がここに表示されます。
572
+ ```
573
+
574
+ ## Wiki の出力形式
575
+
576
+ Wiki は以下の形式で Markdown ファイルとして保存されます:
577
+
578
+ ```markdown
579
+ # Wiki のタイトル
580
+
581
+ [Backlog Wiki Link](https://example.backlog.jp/alias/wiki/12345)
582
+
583
+ ここに Wiki の本文内容が入ります。
584
+ Backlog の書式がそのまま保持されます。
585
+ ```
586
+
587
+ # その他の特徴
588
+
589
+ - **環境変数サポート**: 環境変数 `BACKLOG_API_KEY` を使用して API キーを設定可能
590
+ - **自動ディレクトリ作成**: 出力ディレクトリが存在しない場合は自動的に作成
591
+ - **並列処理**: 並列処理による高速なダウンロード
592
+ - **ファイル名サニタイズ**: ファイル名の自動サニタイズ(不正な文字の除去)
593
+ - **階層構造の保持**: Wiki の階層構造を保持したエクスポート
package/bin/dev.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node --loader ts-node/esm --no-warnings=ExperimentalWarning "%~dp0\dev" %*
package/bin/dev.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env -S node --loader ts-node/esm --disable-warning=ExperimentalWarning
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({development: true, dir: import.meta.url})
package/bin/run.cmd ADDED
@@ -0,0 +1,3 @@
1
+ @echo off
2
+
3
+ node "%~dp0\run" %*
package/bin/run.js ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {execute} from '@oclif/core'
4
+
5
+ await execute({dir: import.meta.url})
@@ -0,0 +1,17 @@
1
+ import { Command } from '@oclif/core';
2
+ export default class DownloadAll extends Command {
3
+ static args: {
4
+ url: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
5
+ };
6
+ static description: string;
7
+ static examples: string[];
8
+ static flags: {
9
+ apiKey: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
10
+ count: import("@oclif/core/interfaces").OptionFlag<number, import("@oclif/core/interfaces").CustomOptions>;
11
+ domain: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
12
+ output: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
13
+ projectIdOrKey: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
14
+ statusId: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
15
+ };
16
+ run(): Promise<void>;
17
+ }
@@ -0,0 +1,64 @@
1
+ import { Args, Command, Flags } from '@oclif/core';
2
+ import * as dotenv from 'dotenv';
3
+ import path from 'node:path';
4
+ import { downloadIssues, downloadWikis } from '../../utils/backlog-api.js';
5
+ import { validateAndGetProjectId } from '../../utils/backlog.js';
6
+ import { createOutputDirectory, getApiKey } from '../../utils/common.js';
7
+ // .envファイルを読み込む
8
+ dotenv.config();
9
+ export default class DownloadAll extends Command {
10
+ static args = {
11
+ url: Args.string({ description: 'URL to download from', required: false }),
12
+ };
13
+ static description = 'Backlogからissueとwikiを同時に取得する';
14
+ static examples = [
15
+ `<%= config.bin %> <%= command.id %> --domain cm1.backlog.jp --projectIdOrKey PROJECT_KEY --apiKey YOUR_API_KEY -o ./output-dir
16
+ BacklogからAPIキーを使用してissueとwikiを同時に取得する
17
+ `,
18
+ ];
19
+ static flags = {
20
+ apiKey: Flags.string({
21
+ description: 'Backlog API key (環境変数 BACKLOG_API_KEY からも自動読み取り可能)',
22
+ required: false,
23
+ }),
24
+ count: Flags.integer({ char: 'c', default: 100, description: '一度に取得する課題数', required: false }),
25
+ domain: Flags.string({ description: 'Backlog domain (e.g. example.backlog.jp)', required: true }),
26
+ output: Flags.string({
27
+ char: 'o',
28
+ description: '出力ディレクトリのルートパス(デフォルトはプロジェクトキー)',
29
+ required: false,
30
+ }),
31
+ projectIdOrKey: Flags.string({ description: 'Backlog project ID or key', required: true }),
32
+ statusId: Flags.string({ description: 'Filter issues by status ID', required: false }),
33
+ };
34
+ async run() {
35
+ const { flags } = await this.parse(DownloadAll);
36
+ const { count, domain, projectIdOrKey, statusId } = flags;
37
+ const apiKey = getApiKey(this, flags.apiKey);
38
+ // 出力ディレクトリのルートパスを設定(デフォルトはプロジェクトキー)
39
+ const outputRoot = flags.output || projectIdOrKey;
40
+ this.log(`Backlogから ${domain} のプロジェクト ${projectIdOrKey} の課題とWikiを取得しています...`);
41
+ this.log(`出力ディレクトリ: ${outputRoot}`);
42
+ try {
43
+ // プロジェクトキーからプロジェクトIDを取得
44
+ const projectId = await validateAndGetProjectId(domain, projectIdOrKey, apiKey);
45
+ this.log(`プロジェクトID: ${projectId} を使用します`);
46
+ // issueとwikiのサブディレクトリパスを作成
47
+ const issueOutput = path.join(outputRoot, 'issues');
48
+ const wikiOutput = path.join(outputRoot, 'wiki');
49
+ // 出力ディレクトリの作成
50
+ await createOutputDirectory(outputRoot);
51
+ await createOutputDirectory(issueOutput);
52
+ await createOutputDirectory(wikiOutput);
53
+ // 課題とWikiを並列で取得
54
+ await Promise.all([
55
+ downloadIssues(this, domain, projectId, apiKey, issueOutput, count, statusId),
56
+ downloadWikis(this, domain, projectIdOrKey, apiKey, wikiOutput),
57
+ ]);
58
+ this.log('すべてのダウンロードが完了しました!');
59
+ }
60
+ catch (error) {
61
+ this.error(`ダウンロードに失敗しました: ${error instanceof Error ? error.message : String(error)}`);
62
+ }
63
+ }
64
+ }