soba-cli 0.1.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.
Files changed (101) hide show
  1. checksums.yaml +7 -0
  2. data/.claude/commands/osoba/add-backlog.md +173 -0
  3. data/.claude/commands/osoba/implement.md +151 -0
  4. data/.claude/commands/osoba/plan.md +217 -0
  5. data/.claude/commands/osoba/review.md +133 -0
  6. data/.claude/commands/osoba/revise.md +176 -0
  7. data/.claude/commands/soba/implement.md +88 -0
  8. data/.claude/commands/soba/plan.md +93 -0
  9. data/.claude/commands/soba/review.md +91 -0
  10. data/.claude/commands/soba/revise.md +76 -0
  11. data/.devcontainer/.env +2 -0
  12. data/.devcontainer/Dockerfile +3 -0
  13. data/.devcontainer/LICENSE +21 -0
  14. data/.devcontainer/README.md +85 -0
  15. data/.devcontainer/bin/devcontainer-common.sh +50 -0
  16. data/.devcontainer/bin/down +35 -0
  17. data/.devcontainer/bin/rebuild +10 -0
  18. data/.devcontainer/bin/up +11 -0
  19. data/.devcontainer/compose.yaml +28 -0
  20. data/.devcontainer/devcontainer.json +53 -0
  21. data/.devcontainer/post-attach.sh +29 -0
  22. data/.devcontainer/post-create.sh +62 -0
  23. data/.devcontainer/setup/01-os-package.sh +19 -0
  24. data/.devcontainer/setup/02-npm-package.sh +22 -0
  25. data/.devcontainer/setup/03-mcp-server.sh +33 -0
  26. data/.devcontainer/setup/04-tool.sh +17 -0
  27. data/.devcontainer/setup/05-soba-setup.sh +66 -0
  28. data/.devcontainer/setup/scripts/functions/install_apt.sh +77 -0
  29. data/.devcontainer/setup/scripts/functions/install_npm.sh +71 -0
  30. data/.devcontainer/setup/scripts/functions/mcp_config.sh +14 -0
  31. data/.devcontainer/setup/scripts/functions/print_message.sh +59 -0
  32. data/.devcontainer/setup/scripts/setup/mcp-markdownify.sh +39 -0
  33. data/.devcontainer/sync-envs.sh +58 -0
  34. data/.envrc.sample +7 -0
  35. data/.rspec +4 -0
  36. data/.rubocop.yml +70 -0
  37. data/.rubocop_airbnb.yml +2 -0
  38. data/.rubocop_todo.yml +74 -0
  39. data/.tool-versions +1 -0
  40. data/CLAUDE.md +20 -0
  41. data/LICENSE +21 -0
  42. data/README.md +384 -0
  43. data/README_ja.md +384 -0
  44. data/Rakefile +18 -0
  45. data/bin/soba +120 -0
  46. data/config/config.yml.example +36 -0
  47. data/docs/business/INDEX.md +6 -0
  48. data/docs/business/overview.md +42 -0
  49. data/docs/business/workflow.md +143 -0
  50. data/docs/development/INDEX.md +10 -0
  51. data/docs/development/architecture.md +69 -0
  52. data/docs/development/coding-standards.md +152 -0
  53. data/docs/development/distribution.md +26 -0
  54. data/docs/development/implementation-guide.md +103 -0
  55. data/docs/development/testing-strategy.md +128 -0
  56. data/docs/development/tmux-management.md +253 -0
  57. data/docs/document_system.md +58 -0
  58. data/lib/soba/commands/config/show.rb +63 -0
  59. data/lib/soba/commands/init.rb +778 -0
  60. data/lib/soba/commands/open.rb +144 -0
  61. data/lib/soba/commands/start.rb +442 -0
  62. data/lib/soba/commands/status.rb +175 -0
  63. data/lib/soba/commands/stop.rb +147 -0
  64. data/lib/soba/config_loader.rb +32 -0
  65. data/lib/soba/configuration.rb +268 -0
  66. data/lib/soba/container.rb +48 -0
  67. data/lib/soba/domain/issue.rb +38 -0
  68. data/lib/soba/domain/phase_strategy.rb +74 -0
  69. data/lib/soba/infrastructure/errors.rb +23 -0
  70. data/lib/soba/infrastructure/github_client.rb +399 -0
  71. data/lib/soba/infrastructure/lock_manager.rb +129 -0
  72. data/lib/soba/infrastructure/tmux_client.rb +331 -0
  73. data/lib/soba/services/ansi_processor.rb +92 -0
  74. data/lib/soba/services/auto_merge_service.rb +133 -0
  75. data/lib/soba/services/closed_issue_window_cleaner.rb +96 -0
  76. data/lib/soba/services/daemon_service.rb +83 -0
  77. data/lib/soba/services/git_workspace_manager.rb +102 -0
  78. data/lib/soba/services/issue_monitor.rb +29 -0
  79. data/lib/soba/services/issue_processor.rb +215 -0
  80. data/lib/soba/services/issue_watcher.rb +193 -0
  81. data/lib/soba/services/pid_manager.rb +87 -0
  82. data/lib/soba/services/process_info.rb +58 -0
  83. data/lib/soba/services/queueing_service.rb +98 -0
  84. data/lib/soba/services/session_logger.rb +111 -0
  85. data/lib/soba/services/session_resolver.rb +72 -0
  86. data/lib/soba/services/slack_notifier.rb +121 -0
  87. data/lib/soba/services/status_manager.rb +74 -0
  88. data/lib/soba/services/test_process_manager.rb +84 -0
  89. data/lib/soba/services/tmux_session_manager.rb +251 -0
  90. data/lib/soba/services/workflow_blocking_checker.rb +73 -0
  91. data/lib/soba/services/workflow_executor.rb +256 -0
  92. data/lib/soba/services/workflow_integrity_checker.rb +151 -0
  93. data/lib/soba/templates/claude_commands/implement.md +88 -0
  94. data/lib/soba/templates/claude_commands/plan.md +93 -0
  95. data/lib/soba/templates/claude_commands/review.md +91 -0
  96. data/lib/soba/templates/claude_commands/revise.md +76 -0
  97. data/lib/soba/version.rb +5 -0
  98. data/lib/soba.rb +44 -0
  99. data/lib/tasks/gem.rake +75 -0
  100. data/soba-cli.gemspec +59 -0
  101. metadata +430 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f625e2d4087669f271d845b639c3742d85a34cd02db4b4c80e491e1df047065f
4
+ data.tar.gz: c387463adbc03c35def3dd15123ba05f74271c3ef7e2a3885d4627d1f7532c49
5
+ SHA512:
6
+ metadata.gz: a5298526b1759939245ddf44becd057a969ae8577e5ce239f3ee5ec40897628759916b78728bdc9bbcbf2fce7c5876aa6d30ebdbd3fd3226c6703b72ac297f16
7
+ data.tar.gz: d0a69bd5c2ed520041e3b9c83fb0b68795762b21c59a285f88e84b76c44417380279954a2e7b3670ad1e7614a527476d5a654033fb37e22e5c8026c64955659e
@@ -0,0 +1,173 @@
1
+ ---
2
+ allowed-tools: TodoWrite, TodoRead, Bash, Read, Grep, Glob, LS
3
+ description: "Create implementation plan"
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ You are a skilled Product Owner.
9
+ Your task is to analyze the user's requirements and create backlog items represented as GitHub Issues.
10
+
11
+ ---
12
+
13
+ ## Prerequisites
14
+
15
+ ### Documents
16
+
17
+ Refer to the following document indexes (Document System format):
18
+
19
+ - Business: `@docs/business/INDEX.md`
20
+ - Development: `@docs/development/INDEX.md`
21
+ - Operations: `@docs/operations/INDEX.md`
22
+
23
+ ### Qualities of a Good Backlog Item
24
+
25
+ Backlog items should follow the INVEST principle:
26
+
27
+ - **I**ndependent
28
+ - **N**egotiable
29
+ - **V**aluable
30
+ - **E**stimable
31
+ - **S**mall
32
+ - **T**estable
33
+
34
+ Each item should represent a meaningful business unit and ideally be completable within 2 days.
35
+
36
+ ### Backlog Splitting Methods
37
+
38
+ | Method | Description | Example |
39
+ |------------------------------|----------------------------------------------|---------|
40
+ | Workflow step | Split based on business or user workflows | "Purchase" → "Add to cart", "Enter info", "Payment" |
41
+ | Data type | Split based on types of data handled | "Report" → "Sales", "Access", "Satisfaction" |
42
+ | Platform | Split by platform or environment | "Notification" → "PC", "Mobile", "App" |
43
+ | Usage pattern / use case | Split by concrete usage scenarios | "Comment" → "Post", "Edit", "Delete" |
44
+ | System layer | Split by implementation layer | "Favorites" → "UI", "DB", "API" |
45
+ | Conditions / rules | Split based on conditions or exceptions | "Discount" → "Standard", "First-time", "Coupon" |
46
+
47
+ ---
48
+
49
+ ## Rules
50
+
51
+ 1. **Do not modify the codebase**
52
+ 2. **Clarify vague requirements first**
53
+ 3. **Split items into units of roughly 2 days of work**
54
+ 4. **Do not create Issues without explicit user approval**
55
+ 5. **Use the backlog template format for Issues**
56
+ 6. **Ignore backward compatibility unless explicitly required**
57
+
58
+ ---
59
+
60
+ ## Instructions
61
+
62
+ ### High-Level Workflow
63
+
64
+ 1. Analyze requirements
65
+ 2. Design backlog items
66
+ 3. Propose the items to the user
67
+ 4. Obtain approval and make revisions
68
+ 5. Create GitHub Issues and report
69
+
70
+ ---
71
+
72
+ ### Detailed Steps
73
+
74
+ 1. **Initialize the working directory**
75
+ Run the following command to reset the output directory:
76
+ ```bash
77
+ mkdir -p ./.tmp/requirements
78
+ ```
79
+
80
+ 2. **Analyze requirements and design backlog**
81
+ - Clarify the requirements
82
+ - Split them into appropriately sized backlog items (2-day units)
83
+ - For each item, write down goals, acceptance criteria, and technical considerations
84
+ - Save each item to `./.tmp/requirements/req-[slug].md` using the backlog template
85
+
86
+ 3. **Present your proposal to the user**
87
+ - Explain the rationale for splitting and prioritization
88
+ - Summarize each item using bullet points
89
+
90
+ 4. **Obtain explicit approval**
91
+ - Continue communication until approval is explicitly given
92
+ - Do not proceed unless the user says something like "OK" or "Please go ahead"
93
+
94
+ 5. **Create GitHub Issues**
95
+ - Write an issue title that follows Conventional Commits style
96
+ - Run `gh issue create` with `--body-file ./.tmp/requirements/req-[slug].md`
97
+ - Report the created issue number and URL
98
+
99
+ ---
100
+
101
+ ## Backlog Template
102
+
103
+ ```
104
+ ## ユーザーストーリー
105
+
106
+ (例)[ECサイト利用者]として、[商品をカートに入れたい]。なぜなら[購入したい商品をまとめて決済したい]から。
107
+
108
+ ## 背景・目的
109
+
110
+ この機能は以下の課題・目的を解決するために必要です。
111
+
112
+ - (この機能が必要な背景や目的を記述する)
113
+
114
+ ## 受け入れ条件(完了の定義)
115
+
116
+ - [ ] (具体的な完了条件1)
117
+ - [ ] (具体的な完了条件2)
118
+ - [ ] (具体的な完了条件3)
119
+
120
+ ## 技術的考慮事項
121
+
122
+ - (技術的に考慮すべき点1)
123
+ - (技術的に考慮すべき点2)
124
+
125
+ ## 依存関係・ブロッカー
126
+
127
+ - (依存しているIssueや外部要因など)
128
+ - (依存しているIssueや外部要因など)
129
+
130
+ ## 関連資料・Issue
131
+
132
+ - (関連するドキュメントやIssueや資料)
133
+ - (関連するドキュメントやIssueや資料)
134
+ ```
135
+
136
+ ## Backlog Example
137
+
138
+ ```
139
+ ## ユーザーストーリー
140
+
141
+ ログイン済みのユーザーとして、お気に入りボタンを使って商品を保存したい。なぜなら、あとで比較・購入しやすくなるから。
142
+
143
+ ## 背景・目的
144
+
145
+ - ユーザーが購入を即決せずに検討することが多いため、再訪時の利便性を高めたい
146
+ - 商品ページの離脱率が高く、検討中のユーザーを取りこぼしている可能性がある
147
+
148
+ ## 受け入れ条件(完了の定義)
149
+
150
+ - [ ] 商品カードまたは詳細ページに「♡」ボタンが表示されている
151
+ - [ ] ボタンを押すと商品がお気に入りリストに追加される
152
+ - [ ] 再度押すとお気に入りから削除される
153
+ - [ ] ログインユーザーごとにお気に入りが保持される
154
+ - [ ] お気に入り一覧ページが存在し、追加した商品が表示される
155
+
156
+ ## 技術的考慮事項
157
+
158
+ - ログインユーザーのIDに紐づくお気に入りテーブルを新設
159
+ - フロントエンドはVueでリアクティブに状態変更を反映する
160
+ - バックエンドはAPI経由で追加/削除/取得を非同期処理
161
+ - テストはお気に入り追加/削除/一覧表示のパターンをカバー
162
+
163
+ ## 依存関係・ブロッカー
164
+
165
+ - #100 ユーザー認証の安定化
166
+ - #102 商品一覧コンポーネントの再設計
167
+
168
+ ## 関連資料・Issue
169
+
170
+ - デザインFigma: https://figma.com/file/abc1234/favorite-feature
171
+ - 要件定義: `@docs/business/favorite-feature.md`
172
+ - 関連Issue: #90, #103
173
+ ```
@@ -0,0 +1,151 @@
1
+ ---
2
+ allowed-tools: TodoRead, TodoWrite, Bash, Read, Write, Edit, MultiEdit, Grep, Glob, LS
3
+ description: "Implementation work using TDD"
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ You are a skilled developer responsible for safely and reliably implementing this Issue.
9
+ In this phase, you will modify or add code based on the implementation plan, run tests, and finally create a Pull Request for review.
10
+
11
+ ---
12
+
13
+ ## Prerequisites
14
+
15
+ ### Documents
16
+
17
+ Refer to the following documentation:
18
+
19
+ - **Coding Standards**: @docs/development/coding-standards.md
20
+ - **Testing Strategy**: @docs/development/testing-strategy.md
21
+ - **Other Development Documents**: @docs/development/INDEX.md
22
+
23
+ ### Expected state of the Issue
24
+
25
+ - A comment contains the implementation plan
26
+ - Acceptance criteria are clearly described
27
+
28
+ ---
29
+
30
+ ## Rules
31
+
32
+ 1. Always review the implementation plan and follow it carefully
33
+ 2. Follow TDD; if you can't write tests first, reconsider your design
34
+ 3. Respect the existing design and architecture (do not change it arbitrarily)
35
+ 4. When implementation is complete, submit a Pull Request for review
36
+ 5. PRs must include the purpose, changes made, test details, and linked Issue
37
+ 6. If the current directory is under `.git/osoba/`, this is a dedicated codebase created using git worktree, so you must not reference or edit any parent directories
38
+ 7. **Code Collective Ownership**: Take responsibility for the entire codebase and proactively fix issues even if they seem unrelated to your changes
39
+ 8. **Time Constraints**: Do not fear time constraints or context compression. Work calmly and thoroughly, prioritizing quality above speed
40
+
41
+ ### Implementation Style Principles
42
+
43
+ - **Follow the DRY (Don't Repeat Yourself) principle**
44
+ Avoid repeating logic, knowledge, or structure
45
+
46
+ - **Follow the YAGNI (You Aren’t Gonna Need It) principle**
47
+ Don't add code for features that "might be needed someday"
48
+
49
+ - **Use mocks only when necessary**
50
+ Only mock external integrations (e.g., APIs, email)
51
+
52
+ - **Use FactoryBot for test data**
53
+ Maintain structured and flexible test fixtures
54
+
55
+ - **Keep controllers skinny, models fat, and views simple**
56
+ Concentrate business logic in models and keep controllers/views minimal
57
+
58
+ ---
59
+
60
+ ## Instructions
61
+
62
+ ### Workflow (Overview)
63
+
64
+ 1. Review the implementation plan and Issue
65
+ 2. Write test cases first
66
+ 3. Implement in small commits
67
+ 4. Run tests and verify functionality
68
+ 5. Run full test suite before PR creation
69
+ 6. Create a PR template as `./.tmp/pull-request-<issue number>.md`
70
+ 7. Create the Pull Request
71
+ 8. Leave a comment on the Issue
72
+ 9. Update Issue labels (remove "status:implementing", add "status:review-requested")
73
+
74
+ ---
75
+
76
+ ## Detailed Steps
77
+
78
+ 1. **Review the implementation plan and Issue**
79
+ - Run `gh issue view <issue number>` to confirm requirements
80
+ - Run `gh issue view <issue number> --comments` to review the implementation plan
81
+ - If unclear, ask questions or request clarification
82
+
83
+ 2. **Write test cases first**
84
+ - Prepare tests based on the test strategy in the plan
85
+ - Follow Red → Green → Refactor
86
+
87
+ 3. **Start implementation**
88
+ - Commit frequently with meaningful messages
89
+
90
+ 4. **Run tests and verify**
91
+ - Run `yarn test`, `rspec`, or your project's standard method # timeout 600000ms
92
+ - Perform manual UI/API testing if applicable
93
+
94
+ 5. **Run full test suite (MANDATORY)**
95
+ - **⚠️ CRITICAL: All tests in the entire codebase must pass - this is an absolute requirement for acceptance**
96
+ - Run `bin/rails spec` (NO ARGUMENTS - full test suite) to ensure all tests pass # timeout 600000ms
97
+ - Fix any failures before proceeding, even if they seem unrelated to your changes
98
+ - **ABSOLUTE REQUIREMENT**: Never create a PR without running the full test suite
99
+ - **IMPORTANT**: Execute `bin/rails spec` without any arguments to test the entire codebase
100
+
101
+ 6. **Create the PR template**
102
+ - Write `./.tmp/pull-request-123.md` based on the template shown below
103
+
104
+ 7. **Create the Pull Request**
105
+ - Title example: `feat: Add favorite feature for products (#123)`
106
+ - Use `--body-file ./.tmp/pull-request-123.md` to populate the PR body
107
+ - Example using `gh`:
108
+
109
+ ```bash
110
+ gh pr create \\
111
+ --title "feat: Add favorite feature for products (#123)" \\
112
+ --body-file ./.tmp/pull-request-123.md \\
113
+ --base main
114
+ ```
115
+
116
+ 8. **Leave a comment on the Issue**
117
+ - Example: "Submitted PR #456. Please review."
118
+
119
+ 9. **Update Issue labels**
120
+ - Remove "status:implementing" label
121
+ - Add "status:review-requested" label
122
+ - Example using `gh`:
123
+
124
+ ```bash
125
+ gh issue edit <issue number> \\
126
+ --remove-label "status:implementing" \\
127
+ --add-label "status:review-requested"
128
+ ```
129
+
130
+ ---
131
+
132
+ ## PRテンプレート
133
+
134
+ ```markdown
135
+ ## 実装完了
136
+
137
+ 以下のIssueについて、TDDに基づき実装を完了しました。
138
+
139
+ - Issue: fixes #<ISSUE番号>
140
+ - 対応内容:
141
+ - <対応した主な機能や修正点1>
142
+ - <対応した主な機能や修正点2>
143
+ - 実装方式: テスト駆動開発(TDD)に準拠
144
+ - テスト状況:
145
+ - 単体テスト: ✅ パス / ❌ 失敗
146
+ - 結合テスト: ✅ パス / ❌ 失敗
147
+ - **フルテスト (`bin/rails spec` 引数なし)**: ✅ パス / ❌ 失敗
148
+ - 関連PR: #<PR番号>
149
+
150
+ ご確認のほどよろしくお願いいたします。
151
+ ```
@@ -0,0 +1,217 @@
1
+ ---
2
+ allowed-tools: TodoWrite, TodoRead, Bash, Read, Grep, Glob, LS
3
+ description: "Create implementation plan"
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ You are a capable software architect.
9
+ Your task is to create an Implementation Plan (Plan) for a given GitHub Issue, including technical investigation, design decisions, task breakdown, test planning, and risk assessment, and post it as a comment on the Issue.
10
+
11
+ ---
12
+
13
+ ## Prerequisites
14
+
15
+ ### Documents
16
+
17
+ Please refer to the relevant documents via the following index files (Document System format):
18
+
19
+ - **Coding Standards**: @docs/development/coding-standards.md
20
+ - **Testing Strategy**: @docs/development/testing-strategy.md
21
+ - **Other Development Documents**: @docs/development/INDEX.md
22
+
23
+ ### Expected State of the Issue
24
+
25
+ - Acceptance criteria are clearly written in the GitHub Issue
26
+
27
+ ---
28
+
29
+ ## Rules
30
+
31
+ 1. **Do not modify code; focus solely on creating the plan**
32
+ 2. **Design the plan with TDD and testability in mind**
33
+ 3. **Follow the existing system architecture**
34
+ 4. **Break the plan into step-by-step, executable units**
35
+ 5. **Use the predefined template format when writing the plan**
36
+ 6. **Update the label to `status:ready` upon completion**
37
+ 7. **When researching libraries, use `use context7 mcp` to always refer to the latest official documentation**
38
+
39
+ ---
40
+
41
+ ## Instructions
42
+
43
+ ### High-Level Workflow
44
+
45
+ 1. Confirm the target Issue
46
+ 2. Investigate relevant code and architecture
47
+ 3. Choose a technical approach
48
+ 4. Define task steps and test coverage
49
+ 5. Document risks and schedule
50
+ 6. Write the plan to a file
51
+ 7. Post the plan as a comment to the Issue
52
+ 8. Update the Issue label
53
+
54
+ ---
55
+
56
+ ### Detailed Steps
57
+
58
+ 1. **Confirm the target Issue**
59
+ - Run `gh issue view <issue number>` and check:
60
+ - Title, background, user story, and acceptance criteria
61
+ - Run `gh issue view <issue number> --comments` and check:
62
+ - Additional information, user approval, or clarifications in comments
63
+
64
+ 2. **Investigate codebase and system structure**
65
+ - Review related source files, config files, and similar past implementations
66
+ - Identify impact areas and dependencies
67
+
68
+ 3. **Choose a technical approach**
69
+ - Specify libraries, design patterns, and frameworks to use
70
+ - Clearly state reasoning and alternatives considered
71
+
72
+ 4. **Break down the implementation into steps**
73
+ - Ensure each step is testable and small enough for incremental progress
74
+ - Include notes on related files, side effects, and prerequisites
75
+
76
+ 5. **Describe test strategy, risks, and schedule**
77
+ - Outline unit, integration, and E2E test plans
78
+ - List possible technical risks and mitigation strategies
79
+ - Define estimated duration and key checkpoints
80
+
81
+ 6. **Write the implementation plan to a file**
82
+ - Use the implementation plan template and save to `./.tmp/plan-[slug].md`
83
+ - Replace `[slug]` with a kebab-case version of the issue title (e.g., `plan-add-favorite.md`)
84
+
85
+ 7. **Post the plan as a comment**
86
+ - Run: `gh issue comment <issue number> --body-file ./.tmp/plan-[slug].md`
87
+
88
+ 8. **Update the label**
89
+ - Run: `gh issue edit <issue number> --remove-label "status:planning" --add-label "status:ready"`
90
+
91
+ ---
92
+
93
+ ## Plan template
94
+
95
+ ```
96
+ # 実行計画: [タイトル]
97
+
98
+ ## 前提知識
99
+ - [関連技術・既存システムの構造]
100
+ - [考慮すべき制約]
101
+ - [参考資料・ドキュメント]
102
+
103
+ ## 要件概要
104
+ - [要件の概要と目的]
105
+ - [機能要件]
106
+ - [非機能要件(例:性能、セキュリティ)]
107
+ - [受け入れ条件]
108
+
109
+ ## 設計方針
110
+ - [使用する技術や設計パターン]
111
+ - [構成方針や判断理由]
112
+ - [考慮したアーキテクチャ上のポイント]
113
+
114
+ ## 実装ステップ
115
+ 1. [ステップ1]
116
+ - [具体的な作業内容]
117
+ - [関係するファイルや関数など]
118
+ 2. [ステップ2]
119
+ - [同上]
120
+
121
+ ## テスト計画
122
+ - ユニットテスト:
123
+ - [テスト対象]
124
+ - [テストケース(正常系/異常系)]
125
+ - 結合・システムテスト:
126
+ - [検証すべきユーザーフローやパターン]
127
+ - テストデータ:
128
+ - [準備すべき入力データや事前状態の例]
129
+
130
+ ## リスクと対策
131
+ - [想定されるリスク1]
132
+ - [対策案]
133
+ - [想定されるリスク2]
134
+ - [対策案]
135
+
136
+ ## タイムライン
137
+ - 実装期間の目安: [開始日] 〜 [終了日]
138
+ - 各ステップの予想時間(単位: 時間):
139
+ - ステップ1: [X時間]
140
+ - ステップ2: [X時間]
141
+ ```
142
+
143
+ ## Plan example
144
+
145
+ ```
146
+ # 実行計画: 商品にお気に入り機能を追加する
147
+
148
+ ## 前提知識
149
+ - Webアプリは Vue 3 + Rails API で構成されている
150
+ - ユーザー認証は Devise Token Auth により実装されている
151
+ - フロントエンドは Pinia により状態管理されている
152
+ - お気に入り状態はユーザー単位で永続化される必要がある
153
+ - `products` テーブルは既に存在し、IDと基本情報を保持している
154
+
155
+ ## 要件概要
156
+ - 商品に「お気に入り」ボタン(ハートアイコン)を追加する
157
+ - ユーザーは任意の商品をお気に入りリストに追加・削除できる
158
+ - お気に入り一覧ページで、自身が登録した商品だけを確認できる
159
+ - 非ログイン状態ではボタンを表示しない
160
+ - パフォーマンス要件:追加・削除は非同期、レスポンス200ms以内
161
+
162
+ ## 設計方針
163
+ - フロントエンドは `<FavoriteButton>` コンポーネントを導入して再利用可能にする
164
+ - バックエンドは `favorites` テーブル(user_id, product_id)を新設し、RESTful APIで操作する
165
+ - フロント側は Pinia でお気に入り状態をキャッシュ保持し、APIとの同期を行う
166
+ - ユーザー認証済みでない場合、ボタンを非表示にする
167
+
168
+ ## 実装ステップ
169
+ 1. `favorites` テーブルの追加
170
+ - migration を作成し、ユニーク制約 (user_id, product_id) を設定
171
+ - index を追加して高速化
172
+
173
+ 2. APIエンドポイントの作成
174
+ - `POST /api/favorites`(追加)
175
+ - `DELETE /api/favorites/:id`(削除)
176
+ - `GET /api/favorites`(一覧取得)
177
+
178
+ 3. フロントの状態管理構築
179
+ - Piniaストアでお気に入り状態を保持
180
+ - 初回ロード時に `/favorites` を取得
181
+
182
+ 4. `<FavoriteButton>` コンポーネントの作成
183
+ - 状態に応じてアイコン切替(空白ハート↔実心ハート)
184
+ - ボタンクリックで追加/削除APIを呼び出す
185
+
186
+ 5. 商品カードおよび詳細ページへのボタン配置
187
+ - `ProductCard.vue` および `ProductDetail.vue` に設置
188
+
189
+ ## テスト計画
190
+ - ユニットテスト:
191
+ - FavoriteStore(状態切替の確認)
192
+ - FavoriteButton(UIの状態/クリック挙動)
193
+
194
+ - 結合・システムテスト:
195
+ - ログイン → 商品一覧表示 → ハートを押して追加/削除できる
196
+ - 非ログイン時にはボタンが表示されないこと
197
+
198
+ - テストデータ:
199
+ - ユーザー:ログイン済みのダミーユーザー
200
+ - 商品:product_id = 1〜3 の仮データを用意
201
+
202
+ ## リスクと対策
203
+ - お気に入りの二重登録
204
+ - 対策:DBにユニークインデックスを設定
205
+ - お気に入りの状態同期ミス
206
+ - 対策:非同期APIのレスポンスに基づいて状態を確定させる
207
+
208
+ ## タイムライン
209
+ - 実装期間の目安: 2025-07-22 〜 2025-07-24
210
+ - 各ステップの予想時間(単位: 時間):
211
+ - ステップ1: 1.5h
212
+ - ステップ2: 2.0h
213
+ - ステップ3: 1.5h
214
+ - ステップ4: 2.0h
215
+ - ステップ5: 1.0h
216
+ - テスト&検証: 1.5h
217
+ ```
@@ -0,0 +1,133 @@
1
+ ---
2
+ allowed-tools: Bash, Read, Write, Edit, MultiEdit, Grep, Glob, LS
3
+ description: "Review and merge a Pull Request"
4
+ ---
5
+
6
+ # Review Plan
7
+
8
+ As a QA engineer, your task is to review the Pull Request (PR) associated with the specified Issue and evaluate whether it meets all quality standards.
9
+
10
+ ## Context
11
+
12
+ - Specification Driven Development: @.claude/osoba/docs/spacification_driven_development.md
13
+ - Target Issue number: $ARGUMENTS
14
+
15
+
16
+ ## Workflow
17
+
18
+ ### 1. Check the Issue
19
+
20
+ - Run `GH_PAGER= gh issue view <issue number>` to understand the context and requirements
21
+ - Identify the corresponding PR number
22
+
23
+ - Run `GH_PAGER= gh issue view <issue number>`
24
+ → Confirm the **issue content and requirements**
25
+
26
+ - Run `GH_PAGER= gh issue view <issue number> --comments`
27
+ → Review the **design document and task list**
28
+
29
+ ⚠️ **Note**: When using `--comments`, the issue body may not be displayed correctly.
30
+ Be sure to run the version *without* `--comments` first to understand the requirements.
31
+
32
+ ### 2. Check the PR
33
+
34
+ - Run `GH_PAGER= gh pr view <PR number>` to review the purpose, changes, and description of the PR
35
+ - Ensure the implementation satisfies the original requirements
36
+
37
+ ### 3. Check for Conflicts
38
+
39
+ - Run `GH_PAGER= gh pr view <PR number> --json mergeable,mergeStateStatus` to check merge status
40
+ - If conflicts exist (mergeable=false or mergeStateStatus=CONFLICTING):
41
+ - The PR needs to be rebased against the base branch
42
+ - Include this in the review feedback
43
+
44
+ ### 4. Review Code Changes
45
+
46
+ - Run `GH_PAGER= gh pr diff <PR number>` to check the code diff
47
+ - Evaluate the changes with the following criteria:
48
+ - Compliance with coding standards
49
+ - Presence and adequacy of test cases
50
+ - Security concerns and potential vulnerabilities
51
+ - Unnecessary diffs (e.g., debug code, commented-out lines)
52
+
53
+ ### 5. Check CI Results (MANDATORY - MUST WAIT FOR COMPLETION)
54
+
55
+ - **⚠️ CRITICAL: You MUST wait for CI to complete before providing review results**
56
+ - **NEVER provide review results while CI is still running or pending**
57
+ - Run `GH_PAGER= gh pr checks <PR number>` to verify CI status
58
+ - All checks must ✅ pass
59
+ - If checks are still running, wait and retry until completed
60
+ - ⚠️ **Note**: CI can take over 5 minutes to complete. Be patient and ensure all checks are fully finished before proceeding
61
+ - To wait for CI completion, you can use:
62
+ ```bash
63
+ gh pr checks <PR number> --watch # timeout 600000ms
64
+ ```
65
+ or repeatedly check status:
66
+ ```bash
67
+ while true; do
68
+ gh pr checks <PR number>
69
+ sleep 30
70
+ done # timeout 600000ms
71
+ ```
72
+ - **ABSOLUTE REQUIREMENT**: CI completion, merge capability check, and code review ALL must be complete before providing review results
73
+
74
+ ### 6. Post Review Result (ONLY AFTER CI COMPLETION)
75
+
76
+ - **⚠️ PREREQUISITE**: Only proceed if ALL of the following are complete:
77
+ 1. CI has fully completed (not pending or running)
78
+ 2. Merge capability has been verified
79
+ 3. Code review has been completed
80
+ - **NEVER post review results if CI is not complete**
81
+ - Post the review result using:
82
+ `GH_PAGER= gh pr comment <PR number> --body "$(cat ./.tmp/review-result-<issue number>.md)"`
83
+ - Use the following template for `./.tmp/review-result-<issue number>.md`:
84
+
85
+ ```markdown
86
+ ## Review Result
87
+
88
+ - Issue: #<issue number>
89
+ - PR: #<PR number>
90
+
91
+ ### ✅ Verdict
92
+ - [ ] Approved (LGTM)
93
+ - [ ] Requires changes
94
+
95
+ ### 🔄 Merge Status
96
+ - [ ] No conflicts - ready to merge
97
+ - [ ] Has conflicts - needs rebase
98
+
99
+ ### 👍 Positive Notes
100
+ - [List of strengths in the implementation]
101
+
102
+ ### 🛠 Suggestions for Improvement
103
+ - [List of specific recommendations]
104
+
105
+ ### 🔍 Additional Notes
106
+ - [Optional remarks if any]
107
+ ```
108
+
109
+ ### 7. Update Labels
110
+
111
+ After posting the review result, update the labels based on the verdict:
112
+
113
+ #### If Approved (LGTM):
114
+ 1. Keep `status:reviewing` label on the Issue (Issue lifecycle ends here)
115
+ 2. Remove `status:requires-changes` label from the Pull Request (if exists) and add `status:lgtm` label:
116
+ ```bash
117
+ gh pr edit <PR number> --remove-label "status:requires-changes" --add-label "status:lgtm"
118
+ ```
119
+
120
+ #### If Requires Changes:
121
+ 1. Keep `status:reviewing` label on the Issue (Issue remains in review state)
122
+ 2. Add `status:requires-changes` label to the Pull Request:
123
+ ```bash
124
+ gh pr edit <PR number> --add-label "status:requires-changes"
125
+ ```
126
+
127
+ ## Basic Rules
128
+
129
+ - Ensure compliance with coding conventions
130
+ - Confirm the implementation fully meets the issue requirements
131
+ - Check for any potential security issues
132
+ - All tests and CI checks must pass
133
+ - Review comments must be clear and constructive