backlog-exporter 0.7.3 → 1.0.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 +87 -1
- package/bin/dev.js +6 -2
- package/dist/commands/all/index.d.ts +2 -0
- package/dist/commands/all/index.js +62 -126
- package/dist/commands/document/index.js +18 -11
- package/dist/commands/issue/index.js +18 -11
- package/dist/commands/prune/index.d.ts +16 -0
- package/dist/commands/prune/index.js +86 -0
- package/dist/commands/update/index.d.ts +3 -7
- package/dist/commands/update/index.js +28 -260
- package/dist/commands/wiki/index.js +17 -9
- package/dist/composition/backlog-repositories.d.ts +16 -0
- package/dist/composition/backlog-repositories.js +15 -0
- package/dist/modules/all/domain/content-selection.d.ts +4 -0
- package/dist/modules/all/domain/content-selection.js +16 -0
- package/dist/modules/all/use-case/export-all.d.ts +24 -0
- package/dist/modules/all/use-case/export-all.js +78 -0
- package/dist/modules/document/domain/document-markdown.d.ts +2 -0
- package/dist/modules/document/domain/document-markdown.js +37 -0
- package/dist/modules/document/domain/document-path.d.ts +15 -0
- package/dist/modules/document/domain/document-path.js +48 -0
- package/dist/modules/document/domain/document-repository.d.ts +6 -0
- package/dist/modules/document/domain/document-repository.js +1 -0
- package/dist/modules/document/domain/document-save-plan.d.ts +9 -0
- package/dist/modules/document/domain/document-save-plan.js +15 -0
- package/dist/modules/document/domain/document.d.ts +50 -0
- package/dist/modules/document/domain/document.js +1 -0
- package/dist/modules/document/repository/backlog-document-repository.d.ts +3 -0
- package/dist/modules/document/repository/backlog-document-repository.js +31 -0
- package/dist/modules/document/use-case/export-documents.d.ts +16 -0
- package/dist/modules/document/use-case/export-documents.js +82 -0
- package/dist/modules/issue/domain/issue-filter.d.ts +2 -0
- package/dist/modules/issue/domain/issue-filter.js +7 -0
- package/dist/modules/issue/domain/issue-markdown.d.ts +4 -0
- package/dist/modules/issue/domain/issue-markdown.js +112 -0
- package/dist/modules/issue/domain/issue-path.d.ts +23 -0
- package/dist/modules/issue/domain/issue-path.js +30 -0
- package/dist/modules/issue/domain/issue-repository.d.ts +11 -0
- package/dist/modules/issue/domain/issue-repository.js +1 -0
- package/dist/modules/issue/domain/issue.d.ts +47 -0
- package/dist/modules/issue/domain/issue.js +1 -0
- package/dist/modules/issue/repository/backlog-issue-repository.d.ts +3 -0
- package/dist/modules/issue/repository/backlog-issue-repository.js +38 -0
- package/dist/modules/issue/use-case/export-issues.d.ts +18 -0
- package/dist/modules/issue/use-case/export-issues.js +87 -0
- package/dist/modules/project/domain/project-repository.d.ts +3 -0
- package/dist/modules/project/domain/project-repository.js +1 -0
- package/dist/modules/project/repository/backlog-project-repository.d.ts +3 -0
- package/dist/modules/project/repository/backlog-project-repository.js +17 -0
- package/dist/modules/prune/domain/expected-paths.d.ts +4 -0
- package/dist/modules/prune/domain/expected-paths.js +1 -0
- package/dist/modules/prune/domain/prune-target.d.ts +3 -0
- package/dist/modules/prune/domain/prune-target.js +21 -0
- package/dist/modules/prune/repository/prune-walker.d.ts +7 -0
- package/dist/modules/prune/repository/prune-walker.js +39 -0
- package/dist/modules/prune/use-case/prune-directories.d.ts +28 -0
- package/dist/modules/prune/use-case/prune-directories.js +74 -0
- package/dist/modules/prune/use-case/prune-exports.d.ts +27 -0
- package/dist/modules/prune/use-case/prune-exports.js +74 -0
- package/dist/modules/settings/domain/settings.d.ts +15 -0
- package/dist/modules/settings/domain/settings.js +6 -0
- package/dist/modules/settings/repository/settings-store.d.ts +6 -0
- package/dist/modules/settings/repository/settings-store.js +56 -0
- package/dist/modules/update/domain/update-plan.d.ts +36 -0
- package/dist/modules/update/domain/update-plan.js +69 -0
- package/dist/modules/update/use-case/update-exports.d.ts +21 -0
- package/dist/modules/update/use-case/update-exports.js +136 -0
- package/dist/modules/wiki/domain/wiki-filter.d.ts +9 -0
- package/dist/modules/wiki/domain/wiki-filter.js +11 -0
- package/dist/modules/wiki/domain/wiki-markdown.d.ts +1 -0
- package/dist/modules/wiki/domain/wiki-markdown.js +4 -0
- package/dist/modules/wiki/domain/wiki-path.d.ts +4 -0
- package/dist/modules/wiki/domain/wiki-path.js +25 -0
- package/dist/modules/wiki/domain/wiki-repository.d.ts +5 -0
- package/dist/modules/wiki/domain/wiki-repository.js +1 -0
- package/dist/modules/wiki/domain/wiki.d.ts +10 -0
- package/dist/modules/wiki/domain/wiki.js +1 -0
- package/dist/modules/wiki/repository/backlog-wiki-repository.d.ts +3 -0
- package/dist/modules/wiki/repository/backlog-wiki-repository.js +10 -0
- package/dist/modules/wiki/use-case/export-wikis.d.ts +14 -0
- package/dist/modules/wiki/use-case/export-wikis.js +43 -0
- package/dist/shared/backlog/http-client.d.ts +17 -0
- package/dist/shared/backlog/http-client.js +62 -0
- package/dist/shared/backlog/rate-limiter.d.ts +9 -0
- package/dist/shared/backlog/rate-limiter.js +25 -0
- package/dist/shared/backlog-url.d.ts +1 -0
- package/dist/shared/backlog-url.js +5 -0
- package/dist/shared/config/env.d.ts +3 -0
- package/dist/shared/config/env.js +21 -0
- package/dist/shared/console/progress.d.ts +1 -0
- package/dist/shared/console/progress.js +4 -0
- package/dist/shared/console/prompt.d.ts +3 -0
- package/dist/shared/console/prompt.js +19 -0
- package/dist/shared/file-name.d.ts +2 -0
- package/dist/shared/file-name.js +15 -0
- package/dist/shared/markdown/body-marker.d.ts +3 -0
- package/dist/shared/markdown/body-marker.js +5 -0
- package/dist/shared/ports.d.ts +4 -0
- package/dist/shared/ports.js +1 -0
- package/dist/shared/storage/markdown-store.d.ts +5 -0
- package/dist/shared/storage/markdown-store.js +21 -0
- package/dist/shared/storage/update-log.d.ts +1 -0
- package/dist/{utils/log.js → shared/storage/update-log.js} +1 -5
- package/oclif.manifest.json +118 -26
- package/package.json +15 -19
- package/dist/utils/backlog-api.d.ts +0 -74
- package/dist/utils/backlog-api.js +0 -453
- package/dist/utils/backlog.d.ts +0 -16
- package/dist/utils/backlog.js +0 -34
- package/dist/utils/common.d.ts +0 -25
- package/dist/utils/common.js +0 -54
- package/dist/utils/log.d.ts +0 -6
- package/dist/utils/settings.d.ts +0 -45
- package/dist/utils/settings.js +0 -63
- package/dist/utils/sleep.d.ts +0 -28
- package/dist/utils/sleep.js +0 -42
package/dist/utils/common.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
/**
|
|
3
|
-
* APIキーを取得する(優先順位: コマンドライン引数 > 環境変数)
|
|
4
|
-
* @param command コマンドインスタンス
|
|
5
|
-
* @param providedApiKey コマンドライン引数から提供されたAPIキー
|
|
6
|
-
* @returns APIキー
|
|
7
|
-
*/
|
|
8
|
-
export declare function getApiKey(command: Command, providedApiKey?: string): string;
|
|
9
|
-
/**
|
|
10
|
-
* ファイル名に使用できない文字を置換する関数
|
|
11
|
-
* @param name 元のファイル名
|
|
12
|
-
* @returns サニタイズされたファイル名
|
|
13
|
-
*/
|
|
14
|
-
export declare function sanitizeFileName(name: string): string;
|
|
15
|
-
/**
|
|
16
|
-
* Wikiファイル名のサニタイズ(スラッシュはディレクトリ区切りとして使用するため残す)
|
|
17
|
-
* @param name 元のWiki名
|
|
18
|
-
* @returns サニタイズされたWikiファイル名
|
|
19
|
-
*/
|
|
20
|
-
export declare function sanitizeWikiFileName(name: string): string;
|
|
21
|
-
/**
|
|
22
|
-
* 出力ディレクトリを作成する
|
|
23
|
-
* @param outputDir 出力ディレクトリパス
|
|
24
|
-
*/
|
|
25
|
-
export declare function createOutputDirectory(outputDir: string): Promise<void>;
|
package/dist/utils/common.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs/promises';
|
|
2
|
-
/**
|
|
3
|
-
* APIキーを取得する(優先順位: コマンドライン引数 > 環境変数)
|
|
4
|
-
* @param command コマンドインスタンス
|
|
5
|
-
* @param providedApiKey コマンドライン引数から提供されたAPIキー
|
|
6
|
-
* @returns APIキー
|
|
7
|
-
*/
|
|
8
|
-
export function getApiKey(command, providedApiKey) {
|
|
9
|
-
// コマンドライン引数からのAPIキー
|
|
10
|
-
if (providedApiKey) {
|
|
11
|
-
return providedApiKey;
|
|
12
|
-
}
|
|
13
|
-
// 環境変数からのAPIキー
|
|
14
|
-
const envApiKey = process.env.BACKLOG_API_KEY;
|
|
15
|
-
if (envApiKey) {
|
|
16
|
-
command.log('環境変数 BACKLOG_API_KEY からAPIキーを使用します');
|
|
17
|
-
return envApiKey;
|
|
18
|
-
}
|
|
19
|
-
// APIキーが見つからない場合はエラー
|
|
20
|
-
command.error('APIキーが見つかりません。--apiKey フラグまたは BACKLOG_API_KEY 環境変数で提供してください');
|
|
21
|
-
return ''; // この行は実行されないが、TypeScriptのエラーを回避するために必要
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* ファイル名に使用できない文字を置換する関数
|
|
25
|
-
* @param name 元のファイル名
|
|
26
|
-
* @returns サニタイズされたファイル名
|
|
27
|
-
*/
|
|
28
|
-
export function sanitizeFileName(name) {
|
|
29
|
-
return name
|
|
30
|
-
.replaceAll(/[\\/:*?"<>|]/g, '_') // Windowsで使用できない文字を置換
|
|
31
|
-
.replaceAll(/\s+/g, '_') // スペースをアンダースコアに置換
|
|
32
|
-
.replaceAll('.', '_') // ドットを置換
|
|
33
|
-
.slice(0, 200); // 長すぎるファイル名を防ぐために200文字に制限
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Wikiファイル名のサニタイズ(スラッシュはディレクトリ区切りとして使用するため残す)
|
|
37
|
-
* @param name 元のWiki名
|
|
38
|
-
* @returns サニタイズされたWikiファイル名
|
|
39
|
-
*/
|
|
40
|
-
export function sanitizeWikiFileName(name) {
|
|
41
|
-
const invalidChars = ['\\', ':', '*', '?', '"', '<', '>', '|'];
|
|
42
|
-
let sanitizedName = name;
|
|
43
|
-
for (const char of invalidChars) {
|
|
44
|
-
sanitizedName = sanitizedName.replaceAll(char, '_');
|
|
45
|
-
}
|
|
46
|
-
return sanitizedName;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 出力ディレクトリを作成する
|
|
50
|
-
* @param outputDir 出力ディレクトリパス
|
|
51
|
-
*/
|
|
52
|
-
export async function createOutputDirectory(outputDir) {
|
|
53
|
-
await fs.mkdir(outputDir, { recursive: true });
|
|
54
|
-
}
|
package/dist/utils/log.d.ts
DELETED
package/dist/utils/settings.d.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* フォルダタイプの定義
|
|
3
|
-
*/
|
|
4
|
-
export declare enum FolderType {
|
|
5
|
-
DOCUMENT = "document",
|
|
6
|
-
ISSUE = "issue",
|
|
7
|
-
WIKI = "wiki"
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* 設定ファイルの型定義
|
|
11
|
-
*/
|
|
12
|
-
export interface Settings {
|
|
13
|
-
apiKey?: string;
|
|
14
|
-
domain?: string;
|
|
15
|
-
folderType?: FolderType;
|
|
16
|
-
issueKeyFileName?: boolean;
|
|
17
|
-
issueKeyFolder?: boolean;
|
|
18
|
-
lastUpdated?: string;
|
|
19
|
-
outputDir?: string;
|
|
20
|
-
projectIdOrKey?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 設定ファイルのパスを取得する
|
|
24
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
25
|
-
* @returns 設定ファイルのパス
|
|
26
|
-
*/
|
|
27
|
-
export declare function getSettingsFilePath(directory: string): string;
|
|
28
|
-
/**
|
|
29
|
-
* 設定ファイルを読み込む
|
|
30
|
-
* @param directory 設定ファイルが保存されているディレクトリ
|
|
31
|
-
* @returns 設定情報
|
|
32
|
-
*/
|
|
33
|
-
export declare function loadSettings(directory: string): Promise<Settings>;
|
|
34
|
-
/**
|
|
35
|
-
* 設定ファイルを保存する
|
|
36
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
37
|
-
* @param settings 保存する設定情報
|
|
38
|
-
*/
|
|
39
|
-
export declare function saveSettings(directory: string, settings: Settings): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* 設定ファイルを更新する
|
|
42
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
43
|
-
* @param newSettings 更新する設定情報
|
|
44
|
-
*/
|
|
45
|
-
export declare function updateSettings(directory: string, newSettings: Partial<Settings>): Promise<Settings>;
|
package/dist/utils/settings.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as fs from 'node:fs/promises';
|
|
2
|
-
import { join } from 'node:path';
|
|
3
|
-
/**
|
|
4
|
-
* フォルダタイプの定義
|
|
5
|
-
*/
|
|
6
|
-
export var FolderType;
|
|
7
|
-
(function (FolderType) {
|
|
8
|
-
FolderType["DOCUMENT"] = "document";
|
|
9
|
-
FolderType["ISSUE"] = "issue";
|
|
10
|
-
FolderType["WIKI"] = "wiki";
|
|
11
|
-
})(FolderType || (FolderType = {}));
|
|
12
|
-
/**
|
|
13
|
-
* 設定ファイルのパスを取得する
|
|
14
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
15
|
-
* @returns 設定ファイルのパス
|
|
16
|
-
*/
|
|
17
|
-
export function getSettingsFilePath(directory) {
|
|
18
|
-
return join(directory, 'backlog-settings.json');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* 設定ファイルを読み込む
|
|
22
|
-
* @param directory 設定ファイルが保存されているディレクトリ
|
|
23
|
-
* @returns 設定情報
|
|
24
|
-
*/
|
|
25
|
-
export async function loadSettings(directory) {
|
|
26
|
-
const settingsPath = getSettingsFilePath(directory);
|
|
27
|
-
try {
|
|
28
|
-
const data = await fs.readFile(settingsPath, 'utf8');
|
|
29
|
-
return JSON.parse(data);
|
|
30
|
-
}
|
|
31
|
-
catch {
|
|
32
|
-
// ファイルが存在しない場合や読み込みエラーの場合は空のオブジェクトを返す
|
|
33
|
-
return {};
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* 設定ファイルを保存する
|
|
38
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
39
|
-
* @param settings 保存する設定情報
|
|
40
|
-
*/
|
|
41
|
-
export async function saveSettings(directory, settings) {
|
|
42
|
-
const settingsPath = getSettingsFilePath(directory);
|
|
43
|
-
// ディレクトリが存在しない場合は作成
|
|
44
|
-
await fs.mkdir(directory, { recursive: true });
|
|
45
|
-
// 設定ファイルを保存
|
|
46
|
-
await fs.writeFile(settingsPath, JSON.stringify(settings, null, 2), 'utf8');
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* 設定ファイルを更新する
|
|
50
|
-
* @param directory 設定ファイルを保存するディレクトリ
|
|
51
|
-
* @param newSettings 更新する設定情報
|
|
52
|
-
*/
|
|
53
|
-
export async function updateSettings(directory, newSettings) {
|
|
54
|
-
// 既存の設定を読み込む
|
|
55
|
-
const currentSettings = await loadSettings(directory);
|
|
56
|
-
// 新しい設定で更新(apiKeyは除外)
|
|
57
|
-
const { apiKey, ...settingsToSave } = newSettings;
|
|
58
|
-
const updatedSettings = { ...currentSettings, ...settingsToSave };
|
|
59
|
-
// 更新した設定を保存
|
|
60
|
-
await saveSettings(directory, updatedSettings);
|
|
61
|
-
// apiKeyは戻り値には含める
|
|
62
|
-
return { ...updatedSettings, apiKey };
|
|
63
|
-
}
|
package/dist/utils/sleep.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Command } from '@oclif/core';
|
|
2
|
-
/**
|
|
3
|
-
* 指定したミリ秒だけ待機する
|
|
4
|
-
* @param ms 待機時間(ミリ秒)
|
|
5
|
-
*/
|
|
6
|
-
export declare const sleep: (ms: number) => Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* APIリクエストのレート制限対策のためのユーティリティ
|
|
9
|
-
* 100リクエストごとに15秒間待機する
|
|
10
|
-
*/
|
|
11
|
-
export declare class RateLimiter {
|
|
12
|
-
private readonly command;
|
|
13
|
-
private requestCount;
|
|
14
|
-
constructor(command: Command);
|
|
15
|
-
/**
|
|
16
|
-
* 現在のリクエスト数を取得する
|
|
17
|
-
*/
|
|
18
|
-
getCount(): number;
|
|
19
|
-
/**
|
|
20
|
-
* APIリクエストをカウントし、必要に応じて待機する
|
|
21
|
-
* @returns 現在のリクエスト数
|
|
22
|
-
*/
|
|
23
|
-
increment(): Promise<number>;
|
|
24
|
-
/**
|
|
25
|
-
* リクエスト数を設定する
|
|
26
|
-
*/
|
|
27
|
-
setCount(count: number): void;
|
|
28
|
-
}
|
package/dist/utils/sleep.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 指定したミリ秒だけ待機する
|
|
3
|
-
* @param ms 待機時間(ミリ秒)
|
|
4
|
-
*/
|
|
5
|
-
export const sleep = (ms) => new Promise((resolve) => {
|
|
6
|
-
setTimeout(resolve, ms);
|
|
7
|
-
});
|
|
8
|
-
/**
|
|
9
|
-
* APIリクエストのレート制限対策のためのユーティリティ
|
|
10
|
-
* 100リクエストごとに15秒間待機する
|
|
11
|
-
*/
|
|
12
|
-
export class RateLimiter {
|
|
13
|
-
command;
|
|
14
|
-
requestCount = 0;
|
|
15
|
-
constructor(command) {
|
|
16
|
-
this.command = command;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* 現在のリクエスト数を取得する
|
|
20
|
-
*/
|
|
21
|
-
getCount() {
|
|
22
|
-
return this.requestCount;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* APIリクエストをカウントし、必要に応じて待機する
|
|
26
|
-
* @returns 現在のリクエスト数
|
|
27
|
-
*/
|
|
28
|
-
async increment() {
|
|
29
|
-
this.requestCount++;
|
|
30
|
-
if (this.requestCount > 1 && this.requestCount % 100 === 0) {
|
|
31
|
-
this.command.log('レート制限を回避するため15秒間待機します...');
|
|
32
|
-
await sleep(15_000);
|
|
33
|
-
}
|
|
34
|
-
return this.requestCount;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* リクエスト数を設定する
|
|
38
|
-
*/
|
|
39
|
-
setCount(count) {
|
|
40
|
-
this.requestCount = count;
|
|
41
|
-
}
|
|
42
|
-
}
|