Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 24 additions & 24 deletions PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
| Phase 1 | MVP(auth, config, issue, project, api) | 19 | 完了 |
| Phase 2 | 開発者向け(pr, repo, notification, status, browse) | 19 | 完了 |
| Phase 3 | 管理機能(wiki, user, team, category, milestone 等) | 38 | 完了 |
| Phase 4 | 拡張機能(space, webhook, star, watching, alias 等) | 23 | 未着手 |
| Phase 4 | 拡張機能(space, webhook, star, watching, alias 等) | 23 | 完了 |

---

Expand Down Expand Up @@ -1115,7 +1115,7 @@ Git リポジトリをクローンする。
#### `backlog space info`

- **対応 API**: `GET /api/v2/space`
- **状態**: 未着手
- **状態**: 完了

#### `backlog space activities`

Expand All @@ -1125,17 +1125,17 @@ Git リポジトリをクローンする。
| `--activity-type` | | number[] | No | タイプフィルタ | `activityTypeId[]` |

- **対応 API**: `GET /api/v2/space/activities`
- **状態**: 未着手
- **状態**: 完了

#### `backlog space disk-usage`

- **対応 API**: `GET /api/v2/space/diskUsage`
- **状態**: 未着手
- **状態**: 完了

#### `backlog space notification`

- **対応 API**: `GET /api/v2/space/notification`
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1148,7 +1148,7 @@ Git リポジトリをクローンする。
| `--project` | `-p` | string | Yes* | プロジェクトキー |

- **対応 API**: `GET /api/v2/projects/:key/webhooks`
- **状態**: 未着手
- **状態**: 完了

#### `backlog webhook view <id>`

Expand All @@ -1157,7 +1157,7 @@ Git リポジトリをクローンする。
| `<id>` | number | Yes | Webhook ID |

- **対応 API**: `GET /api/v2/projects/:key/webhooks/:id`
- **状態**: 未着手
- **状態**: 完了

#### `backlog webhook create`

Expand All @@ -1171,7 +1171,7 @@ Git リポジトリをクローンする。
| `--activity-type-ids` | | number[] | No | 対象イベントタイプ | `activityTypeIds[]` |

- **対応 API**: `POST /api/v2/projects/:key/webhooks`
- **状態**: 未着手
- **状態**: 完了

#### `backlog webhook edit <id>`

Expand All @@ -1185,7 +1185,7 @@ Git リポジトリをクローンする。
| `--activity-type-ids` | | number[] | No | イベントタイプ | `activityTypeIds[]` |

- **対応 API**: `PATCH /api/v2/projects/:key/webhooks/:webhookId`
- **状態**: 未着手
- **状態**: 完了

#### `backlog webhook delete <id>`

Expand All @@ -1195,7 +1195,7 @@ Git リポジトリをクローンする。
| `--confirm` | boolean | No | 確認スキップ |

- **対応 API**: `DELETE /api/v2/projects/:key/webhooks/:webhookId`
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1211,7 +1211,7 @@ Git リポジトリをクローンする。
| `--pr-comment` | number | No | PR コメント ID | `pullRequestCommentId` |

- **対応 API**: `POST /api/v2/stars`
- **状態**: 未着手
- **状態**: 完了

#### `backlog star list [user-id]`

Expand All @@ -1222,7 +1222,7 @@ Git リポジトリをクローンする。
| `--order` | | string | No | 並び順 | `order` |

- **対応 API**: `GET /api/v2/users/:userId/stars`
- **状態**: 未着手
- **状態**: 完了

#### `backlog star count [user-id]`

Expand All @@ -1233,7 +1233,7 @@ Git リポジトリをクローンする。
| `--until` | string | No | 終了日 | `until` |

- **対応 API**: `GET /api/v2/users/:userId/stars/count`
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1249,7 +1249,7 @@ Git リポジトリをクローンする。
| `--sort` | | string | No | ソートキー | `sort` |

- **対応 API**: `GET /api/v2/users/:userId/watchings`
- **状態**: 未着手
- **状態**: 完了

#### `backlog watching add`

Expand All @@ -1259,7 +1259,7 @@ Git リポジトリをクローンする。
| `--note` | string | No | メモ | `note` |

- **対応 API**: `POST /api/v2/watchings`
- **状態**: 未着手
- **状態**: 完了

#### `backlog watching view <watching-id>`

Expand All @@ -1268,7 +1268,7 @@ Git リポジトリをクローンする。
| `<watching-id>` | number | Yes | ウォッチ ID |

- **対応 API**: `GET /api/v2/watchings/:watchingId`
- **状態**: 未着手
- **状態**: 完了

#### `backlog watching delete <watching-id>`

Expand All @@ -1278,7 +1278,7 @@ Git リポジトリをクローンする。
| `--confirm` | boolean | No | 確認スキップ |

- **対応 API**: `DELETE /api/v2/watchings/:watchingId`
- **状態**: 未着手
- **状態**: 完了

#### `backlog watching read <watching-id>`

Expand All @@ -1287,7 +1287,7 @@ Git リポジトリをクローンする。
| `<watching-id>` | number | Yes | ウォッチ ID |

- **対応 API**: `POST /api/v2/watchings/:watchingId/markAsRead`
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1302,12 +1302,12 @@ Git リポジトリをクローンする。
| `--shell` | boolean | No | シェルコマンドとして登録 |

- **対応 API**: ローカル設定
- **状態**: 未着手
- **状態**: 完了

#### `backlog alias list`

- **対応 API**: ローカル設定
- **状態**: 未着手
- **状態**: 完了

#### `backlog alias delete <name>`

Expand All @@ -1316,7 +1316,7 @@ Git リポジトリをクローンする。
| `<name>` | string | Yes | エイリアス名 |

- **対応 API**: ローカル設定
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1331,7 +1331,7 @@ OAuth トークンをリフレッシュする。
| `--hostname` | string | No | 対象スペース |

- **対応 API**: OAuth 2.0 Token Refresh
- **状態**: 未着手
- **状態**: 完了

#### `backlog auth switch`

Expand All @@ -1342,7 +1342,7 @@ OAuth トークンをリフレッシュする。
| `--hostname` | string | No | 切り替え先スペース |

- **対応 API**: ローカル設定
- **状態**: 未着手
- **状態**: 完了

---

Expand All @@ -1355,7 +1355,7 @@ OAuth トークンをリフレッシュする。
| `<shell>` | string | Yes | シェル種別(`bash`/`zsh`/`fish`) |

- **対応 API**: ローカル処理
- **状態**: 未着手
- **状態**: 完了

---

Expand Down
17 changes: 15 additions & 2 deletions claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,29 @@ Turborepo ベースのモノレポ。ライブラリは unjs エコシステム

```
src/commands/
auth/ — 認証管理(login, logout, status, token)
auth/ — 認証管理(login, logout, status, token, refresh, switch
config/ — CLI 設定(get, set, list)
issue/ — 課題管理(list, view, create, edit, close, reopen, comment, status)
project/ — プロジェクト管理(list, view, activities)
project/ — プロジェクト管理(list, view, create, edit, delete, users, add-user, remove-user, activities)
pr/ — プルリクエスト管理(list, view, create, edit, close, merge, reopen, comment, comments, status)
repo/ — Git リポジトリ管理(list, view, clone)
notification/ — 通知管理(list, count, read, read-all)
wiki/ — Wiki 管理(list, view, create, edit, delete, count, tags, history, attachments)
user/ — ユーザー管理(list, view, me, activities)
team/ — チーム管理(list, view, create, edit, delete)
category/ — カテゴリ管理(list, create, edit, delete)
milestone/ — マイルストーン管理(list, create, edit, delete)
issue-type/ — 課題種別管理(list, create, edit, delete)
status-type/ — ステータス管理(list, create, edit, delete)
space/ — スペース管理(info, activities, disk-usage, notification)
webhook/ — Webhook 管理(list, view, create, edit, delete)
star/ — スター管理(add, list, count)
watching/ — ウォッチ管理(list, add, view, delete, read)
alias/ — エイリアス管理(set, list, delete)
status.ts — ダッシュボード(自分の課題・通知・最近の更新サマリー)
browse.ts — ブラウザで開く
api.ts — 汎用 API リクエスト
completion.ts — シェル補完スクリプト生成
```

新しいコマンドを追加する手順:
Expand Down
7 changes: 7 additions & 0 deletions packages/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,16 @@ export type {
BacklogRepository,
BacklogResolution,
BacklogSpace,
BacklogSpaceDiskUsage,
BacklogSpaceNotification,
BacklogStar,
BacklogStarCount,
BacklogStatus,
BacklogTeam,
BacklogUser,
BacklogWatching,
BacklogWatchingCount,
BacklogWebhook,
BacklogWiki,
BacklogWikiAttachment,
BacklogWikiCount,
Expand Down
74 changes: 74 additions & 0 deletions packages/api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -276,3 +276,77 @@ export interface BacklogMilestone {
archived: boolean;
displayOrder: number;
}

/** Backlog space disk usage response. */
export interface BacklogSpaceDiskUsage {
capacity: number;
issue: number;
wiki: number;
file: number;
subversion: number;
git: number;
gitLFS: number;
pullRequest: number;
details: {
projectId: number;
issue: number;
wiki: number;
file: number;
subversion: number;
git: number;
gitLFS: number;
pullRequest: number;
}[];
}

/** Backlog space notification response. */
export interface BacklogSpaceNotification {
content: string;
updated: string;
}

/** Backlog webhook object. */
export interface BacklogWebhook {
id: number;
name: string;
description: string;
hookUrl: string;
allEvent: boolean;
activityTypeIds: number[];
createdUser: BacklogUser;
created: string;
updatedUser: BacklogUser;
updated: string;
}

/** Backlog star object. */
export interface BacklogStar {
id: number;
comment: string | null;
url: string;
title: string;
presenter: BacklogUser;
created: string;
}

/** Backlog star count response. */
export interface BacklogStarCount {
count: number;
}

/** Backlog watching object. */
export interface BacklogWatching {
id: number;
resourceAlreadyRead: boolean;
note: string;
type: string;
issue?: BacklogIssue;
lastContentUpdated: string | null;
created: string;
updated: string;
}

/** Backlog watching count response. */
export interface BacklogWatchingCount {
count: number;
}
59 changes: 59 additions & 0 deletions packages/cli/src/commands/alias/delete.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { beforeEach, describe, expect, it, vi } from "vitest";

vi.mock("@repo/config", () => ({
loadConfig: vi.fn(),
writeConfig: vi.fn(),
}));

vi.mock("consola", () => ({
default: {
success: vi.fn(),
error: vi.fn(),
},
}));

import { loadConfig, writeConfig } from "@repo/config";

describe("alias delete", () => {
beforeEach(() => {
vi.clearAllMocks();
});

it("既存のエイリアスを削除する", async () => {
vi.mocked(loadConfig).mockResolvedValue({
spaces: [],
defaultSpace: undefined,
aliases: { il: "issue list", pv: "pr view" },
} as never);

const mod = await import("#commands/alias/delete.ts");
await mod.default.run?.({
args: { name: "il" },
} as never);

expect(writeConfig).toHaveBeenCalledWith(
expect.objectContaining({
aliases: { pv: "pr view" },
}),
);
});

it("存在しないエイリアスの場合 process.exit(1) を呼ぶ", async () => {
vi.mocked(loadConfig).mockResolvedValue({
spaces: [],
defaultSpace: undefined,
} as never);

const exitSpy = vi
.spyOn(process, "exit")
.mockImplementation(() => undefined as never);

const mod = await import("#commands/alias/delete.ts");
await mod.default.run?.({
args: { name: "missing" },
} as never);

expect(exitSpy).toHaveBeenCalledWith(1);
exitSpy.mockRestore();
});
});
Loading