-
Notifications
You must be signed in to change notification settings - Fork 75
MVP機能実装 #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rad091217-png
wants to merge
1
commit into
GenerativeAgents:main
Choose a base branch
from
rad091217-png:feature/task-5-taskcli-p1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
MVP機能実装 #6
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| [ | ||
| { | ||
| "id": 1, | ||
| "title": "テスト用タスク", | ||
| "status": "completed", | ||
| "createdAt": "2026-03-25T01:35:05.059Z", | ||
| "updatedAt": "2026-03-25T01:36:44.220Z", | ||
| "statusHistory": [ | ||
| { | ||
| "from": "open", | ||
| "to": "in_progress", | ||
| "changedAt": "2026-03-25T01:36:02.973Z" | ||
| }, | ||
| { | ||
| "from": "in_progress", | ||
| "to": "completed", | ||
| "changedAt": "2026-03-25T01:36:44.220Z" | ||
| } | ||
| ], | ||
| "branchName": "feature/task-1-no-title" | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "title": "Git環境なしテスト", | ||
| "status": "in_progress", | ||
| "createdAt": "2026-03-25T01:36:25.215Z", | ||
| "updatedAt": "2026-03-25T01:36:28.659Z", | ||
| "statusHistory": [ | ||
| { | ||
| "from": "open", | ||
| "to": "in_progress", | ||
| "changedAt": "2026-03-25T01:36:28.659Z" | ||
| } | ||
| ], | ||
| "branchName": "feature/task-2-git" | ||
| }, | ||
| { | ||
| "id": 3, | ||
| "title": "警告テスト用タスク", | ||
| "status": "open", | ||
| "createdAt": "2026-03-25T01:36:47.965Z", | ||
| "updatedAt": "2026-03-25T01:36:47.965Z", | ||
| "statusHistory": [] | ||
| }, | ||
| { | ||
| "id": 4, | ||
| "title": "テスト用タスク", | ||
| "status": "open", | ||
| "createdAt": "2026-03-25T01:38:08.014Z", | ||
| "updatedAt": "2026-03-25T01:38:08.014Z", | ||
| "statusHistory": [] | ||
| }, | ||
| { | ||
| "id": 5, | ||
| "title": "TaskCLI P1機能の実装", | ||
| "description": "GitHub Issues連携・検索・優先度管理を実装する", | ||
| "status": "in_progress", | ||
| "createdAt": "2026-03-25T01:54:14.616Z", | ||
| "updatedAt": "2026-03-25T01:54:21.778Z", | ||
| "statusHistory": [ | ||
| { | ||
| "from": "open", | ||
| "to": "in_progress", | ||
| "changedAt": "2026-03-25T01:54:21.778Z" | ||
| } | ||
| ], | ||
| "branchName": "feature/task-5-taskcli-p1" | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| [ | ||
| { | ||
| "id": 1, | ||
| "title": "テスト用タスク", | ||
| "status": "completed", | ||
| "createdAt": "2026-03-25T01:35:05.059Z", | ||
| "updatedAt": "2026-03-25T01:36:44.220Z", | ||
| "statusHistory": [ | ||
| { | ||
| "from": "open", | ||
| "to": "in_progress", | ||
| "changedAt": "2026-03-25T01:36:02.973Z" | ||
| }, | ||
| { | ||
| "from": "in_progress", | ||
| "to": "completed", | ||
| "changedAt": "2026-03-25T01:36:44.220Z" | ||
| } | ||
| ], | ||
| "branchName": "feature/task-1-no-title" | ||
| }, | ||
| { | ||
| "id": 2, | ||
| "title": "Git環境なしテスト", | ||
| "status": "in_progress", | ||
| "createdAt": "2026-03-25T01:36:25.215Z", | ||
| "updatedAt": "2026-03-25T01:36:28.659Z", | ||
| "statusHistory": [ | ||
| { | ||
| "from": "open", | ||
| "to": "in_progress", | ||
| "changedAt": "2026-03-25T01:36:28.659Z" | ||
| } | ||
| ], | ||
| "branchName": "feature/task-2-git" | ||
| }, | ||
| { | ||
| "id": 3, | ||
| "title": "警告テスト用タスク", | ||
| "status": "open", | ||
| "createdAt": "2026-03-25T01:36:47.965Z", | ||
| "updatedAt": "2026-03-25T01:36:47.965Z", | ||
| "statusHistory": [] | ||
| }, | ||
| { | ||
| "id": 4, | ||
| "title": "テスト用タスク", | ||
| "status": "open", | ||
| "createdAt": "2026-03-25T01:38:08.014Z", | ||
| "updatedAt": "2026-03-25T01:38:08.014Z", | ||
| "statusHistory": [] | ||
| }, | ||
| { | ||
| "id": 5, | ||
| "title": "TaskCLI P1機能の実装", | ||
| "description": "GitHub Issues連携・検索・優先度管理を実装する", | ||
| "status": "open", | ||
| "createdAt": "2026-03-25T01:54:14.616Z", | ||
| "updatedAt": "2026-03-25T01:54:14.616Z", | ||
| "statusHistory": [] | ||
| } | ||
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,215 @@ | ||
| # 技術仕様書 (Architecture Design Document) | ||
|
|
||
| ## テクノロジースタック | ||
|
|
||
| ### 言語・ランタイム | ||
|
|
||
| | 技術 | バージョン | 理由 | | ||
| |------|-----------|------| | ||
| | Node.js | v18+ (推奨: v24.11.0) | 非同期I/Oに優れた実績あるランタイム。npm v24.11.0はdevcontainerに標準搭載済み | | ||
| | TypeScript | 5.x | 静的型付けによるコンパイル時バグ検出と IDE 補完で保守性を向上 | | ||
| | npm | 11.x | Node.js v24.11.0 に同梱。`package-lock.json` により依存関係を厳密に管理 | | ||
|
|
||
| ### フレームワーク・ライブラリ(本番依存) | ||
|
|
||
| | 技術 | バージョン | 用途 | 選定理由 | | ||
| |------|-----------|------|----------| | ||
| | commander | ^11.0.0 | CLIコマンドパース | 学習コストが低く機能が十分。npmダウンロード数トップクラスで実績あり | | ||
| | chalk | ^5.3.0 | ターミナルカラー出力 | ESM対応の最新版。シンプルなAPIで色・スタイル指定が直感的 | | ||
| | cli-table3 | ^0.6.3 | テーブル表示 | CLIでの表形式出力に特化したシンプルなライブラリ | | ||
| | simple-git | ^3.22.0 | Git操作 | Node.jsからGitを操作する事実上の標準ライブラリ。型定義が充実 | | ||
| | @octokit/rest | ^20.0.0 | GitHub API | GitHubの公式Node.jsクライアント。TypeScript対応 | | ||
|
|
||
| ### 開発ツール | ||
|
|
||
| | 技術 | バージョン | 用途 | 選定理由 | | ||
| |------|-----------|------|----------| | ||
| | vitest | ^1.0.0 | テストフレームワーク | Viteベースで高速。TypeScriptをネイティブサポート | | ||
| | eslint | ^9.0.0 | 静的解析 | TypeScript対応のlinter標準 | | ||
| | prettier | ^3.0.0 | コードフォーマット | opinionatedなフォーマッターで議論を排除 | | ||
| | tsx | ^4.0.0 | TypeScript実行(開発時) | `ts-node` より高速なTypeScript実行環境 | | ||
| | @types/node | ^20.0.0 | Node.js型定義 | TypeScriptからNode.js APIを型安全に利用 | | ||
|
|
||
| --- | ||
|
|
||
| ## アーキテクチャパターン | ||
|
|
||
| ### レイヤードアーキテクチャ | ||
|
|
||
| ``` | ||
| ┌───────────────────────────────────────┐ | ||
| │ CLIレイヤー(src/cli/) │ ← コマンドパース・入力検証・表示 | ||
| │ Commander.js によるコマンドルーティング │ | ||
| ├───────────────────────────────────────┤ | ||
| │ サービスレイヤー(src/services/) │ ← ビジネスロジック | ||
| │ TaskService / GitService / │ | ||
| │ GitHubService │ | ||
| ├───────────────────────────────────────┤ | ||
| │ データレイヤー(src/storage/) │ ← データ永続化 | ||
| │ FileStorage(JSON読み書き) │ | ||
| └───────────────────────────────────────┘ | ||
| ↕ | ||
| ┌───────────────────────────────────────┐ | ||
| │ 外部システム │ | ||
| │ Git(simple-git)/ GitHub API │ | ||
| │ (@octokit/rest) │ | ||
| └───────────────────────────────────────┘ | ||
| ``` | ||
|
|
||
| #### CLIレイヤー(`src/cli/`) | ||
|
|
||
| - **責務**: ユーザー入力の受付、バリデーション、結果の表示 | ||
| - **許可される操作**: サービスレイヤーの呼び出し | ||
| - **禁止される操作**: データレイヤー(FileStorage)への直接アクセス | ||
|
|
||
| #### サービスレイヤー(`src/services/`) | ||
|
|
||
| - **責務**: ビジネスロジックの実装、Gitブランチ管理、GitHub API呼び出し | ||
| - **許可される操作**: データレイヤーの呼び出し、外部APIの呼び出し | ||
| - **禁止される操作**: CLIレイヤーへの依存、console.logによる直接出力 | ||
|
|
||
| #### データレイヤー(`src/storage/`) | ||
|
|
||
| - **責務**: データの永続化(`.task/tasks.json` / `.task/config.json`)、バックアップ | ||
| - **許可される操作**: ファイルシステムへのアクセス | ||
| - **禁止される操作**: ビジネスロジックの実装 | ||
|
|
||
| --- | ||
|
|
||
| ## データ永続化戦略 | ||
|
|
||
| ### ストレージ方式 | ||
|
|
||
| | データ種別 | ストレージ | フォーマット | 理由 | | ||
| |-----------|----------|-------------|------| | ||
| | タスクデータ | ローカルファイル(`.task/tasks.json`) | JSON | 特別なソフト不要・Gitで管理可能・可読性が高い | | ||
| | アプリ設定 | ローカルファイル(`.task/config.json`) | JSON | 同上。GitHub設定などをプロジェクト単位で管理 | | ||
| | エラーログ | ローカルファイル(`.task/error.log`) | テキスト | デバッグ用の追記ログ | | ||
|
|
||
| **MVP後の移行パス**: タスク数が1,000件を超えた場合、またはチーム機能を実装する段階でSQLite(`better-sqlite3`)への移行を検討。データモデルは移行を考慮した設計とする。 | ||
|
|
||
| ### バックアップ戦略 | ||
|
|
||
| - **タイミング**: `saveTasks()` 呼び出し時(書き込み前に毎回) | ||
| - **保存先**: `.task/tasks.json.bak`(直前の1世代のみ) | ||
| - **復元方法**: `tasks.json` の読み込みに失敗した際、`.bak` から自動復元を試みる | ||
| - **手動復元**: `cp .task/tasks.json.bak .task/tasks.json` | ||
|
|
||
| --- | ||
|
|
||
| ## パフォーマンス要件 | ||
|
|
||
| ### レスポンスタイム | ||
|
|
||
| | 操作 | 目標時間 | 測定環境 | | ||
| |------|---------|---------| | ||
| | `task add` / `task done` など基本コマンド | 100ms以内 | CPU Core i5相当、メモリ8GB、SSD | | ||
| | `task list`(1,000件) | 1秒以内 | 同上 | | ||
| | `task sync`(GitHub API) | 5秒以内(タイムアウト設定) | ネットワーク込み | | ||
|
|
||
| **測定方法**: `console.time` でCLI起動から結果表示まで計測。CIのE2Eテストで1,000件のダミーデータを使って自動計測。 | ||
|
|
||
| ### リソース使用量 | ||
|
|
||
| | リソース | 上限 | 理由 | | ||
| |---------|------|------| | ||
| | メモリ | 128MB | タスク1,000件のJSONを全件ロードしても十分な余裕 | | ||
| | 起動時メモリ | 50MB | Node.js最小構成での起動コスト | | ||
| | ディスク(`.task/`) | 10MB | タスク10,000件 × 平均1KB = 10MB | | ||
|
|
||
| --- | ||
|
|
||
| ## セキュリティアーキテクチャ | ||
|
|
||
| ### データ保護 | ||
|
|
||
| - **ファイルパーミッション**: `.task/config.json` 作成時に `chmod 600` を適用(所有者のみ読み書き可) | ||
| - **機密情報管理**: GitHub Personal Access Token は `GITHUB_TOKEN` 環境変数から取得。`config.json` には保存しない。`.task/` ディレクトリを `.gitignore` に追加するよう `task init` 実行時に案内する | ||
|
|
||
| ### 入力検証 | ||
|
|
||
| - **バリデーション**: CLIレイヤーで実施 | ||
| - タイトル: 1文字以上200文字以内 | ||
| - タスクID: 正の整数 | ||
| - 期限: `YYYY-MM-DD` 形式、過去日付は警告(エラーではない) | ||
| - 優先度: `high` / `medium` / `low` のいずれか | ||
| - **サニタイゼーション**: ブランチ名に使用するslugから英数字とハイフン以外の文字を除去(パスインジェクション対策) | ||
| - **エラーハンドリング**: スタックトレースはエラーログに記録し、ユーザーには原因と解決策のみ表示 | ||
|
|
||
| --- | ||
|
|
||
| ## スケーラビリティ設計 | ||
|
|
||
| ### データ増加への対応 | ||
|
|
||
| - **想定データ量(MVP)**: タスク1,000件以内(JSONファイルで十分対応可能) | ||
| - **パフォーマンス劣化対策**: `task list` の表示件数をデフォルト50件に制限し、`--all` フラグで全件表示 | ||
| - **アーカイブ戦略**: `status: archived` のタスクは `task list` からデフォルト除外。将来的に `.task/archive.json` へ移動する機能を追加 | ||
|
|
||
| ### 機能拡張性 | ||
|
|
||
| - **設定のカスタマイズ**: `config.json` への設定追加でプラグイン的な拡張を可能にする設計(例: カスタムブランチプレフィックス、デフォルト優先度) | ||
| - **API拡張性**: GitService / GitHubService を抽象化し、将来的なGitLab・Bitbucket対応を考慮したインターフェース設計 | ||
|
|
||
| --- | ||
|
|
||
| ## テスト戦略 | ||
|
|
||
| ### ユニットテスト(vitest) | ||
|
|
||
| - **フレームワーク**: vitest | ||
| - **対象**: `TaskService`・`GitService`・`FileStorage` の各メソッド | ||
| - **カバレッジ目標**: 80%以上 | ||
| - **方針**: GitService のGit操作は `simple-git` をモックし、ファイルI/Oは一時ディレクトリを使用 | ||
|
|
||
| ### 統合テスト | ||
|
|
||
| - **方法**: 実際の一時ディレクトリに対してFileStorageを通じたE2Eフロー確認 | ||
| - **対象**: `task add` → `task start` → `task done` の一連のフロー | ||
|
|
||
| ### E2Eテスト | ||
|
|
||
| - **ツール**: vitest + `child_process.exec` | ||
| - **シナリオ**: CLIコマンドを実際に実行してstdout / stderrを検証 | ||
| - **テスト用データ**: `.task-test/` ディレクトリを使用して本番データと分離(テスト後に削除) | ||
|
|
||
| --- | ||
|
|
||
| ## 技術的制約 | ||
|
|
||
| ### 環境要件 | ||
|
|
||
| - **OS**: macOS・Linux・Windows(Git Bash) | ||
| - **Node.js**: v18以上(LTS推奨: v24.11.0) | ||
| - **Git**: v2.x以上(Gitブランチ連携を使用する場合) | ||
| - **必要な外部依存**: インターネット接続(GitHub API連携時のみ) | ||
|
|
||
| ### パフォーマンス制約 | ||
|
|
||
| - JSONファイル全件ロード方式のため、タスク数が10,000件を超えると `task list` が1秒超になる可能性がある(その段階でSQLite移行を推奨) | ||
| - GitHub API のレート制限: 認証ありで5,000リクエスト/時間 | ||
|
|
||
| ### セキュリティ制約 | ||
|
|
||
| - GitHub Token の保存はファイルシステムの環境変数のみ(設定ファイルへの永続化は行わない) | ||
| - `.task/` ディレクトリをGit管理下に置く場合は機密情報(token等)が含まれないことをユーザーが確認する | ||
|
|
||
| --- | ||
|
|
||
| ## 依存関係管理 | ||
|
|
||
| | ライブラリ | 用途 | バージョン管理方針 | | ||
| |-----------|------|-------------------| | ||
| | commander | CLIパース | `^11.0.0`(マイナーバージョン自動) | | ||
| | chalk | カラー出力 | `^5.3.0`(ESM版。メジャー固定) | | ||
| | cli-table3 | テーブル表示 | `^0.6.3`(マイナーバージョン自動) | | ||
| | simple-git | Git操作 | `^3.22.0`(マイナーバージョン自動) | | ||
| | @octokit/rest | GitHub API | `^20.0.0`(マイナーバージョン自動) | | ||
| | vitest | テスト | `^1.0.0`(開発依存・マイナー自動) | | ||
| | typescript | 型チェック | `~5.3.0`(devDep・パッチのみ自動) | | ||
| | eslint | 静的解析 | `^9.0.0`(devDep・マイナー自動) | | ||
|
|
||
| **方針**: | ||
| - 本番依存は `^`(マイナーバージョンアップ自動)を基本とし、`package-lock.json` で実際のバージョンを固定 | ||
| - メジャーバージョンアップは手動で検証してから更新 | ||
| - `npm audit` をCIで実行し、脆弱性を定期検知 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
コードブロックに言語指定を追加してください。
静的解析ツール (markdownlint MD040) がこのコードブロックに言語指定がないことを警告しています。ASCIIアート図の場合は
textまたはplaintextを指定できます。📝 修正案
📝 Committable suggestion
🧰 Tools
🪛 markdownlint-cli2 (0.21.0)
[warning] 39-39: Fenced code blocks should have a language specified
(MD040, fenced-code-language)
🤖 Prompt for AI Agents