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
@@ -0,0 +1,176 @@
1
+ ---
2
+ allowed-tools: TodoRead, TodoWrite, Bash, Read, Write, Edit, MultiEdit, Grep, Glob, LS
3
+ description: "Revise implementation based on review feedback"
4
+ ---
5
+
6
+ ## Overview
7
+
8
+ You are a skilled developer responsible for addressing review feedback and fixing issues found during the code review process.
9
+ In this phase, you will review the PR comments, understand the feedback, make necessary corrections, and ensure the implementation meets all quality standards.
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 Pull Request exists with review comments
26
+ - The PR has "status:requires-changes" label
27
+ - Acceptance criteria remain unchanged
28
+
29
+ ---
30
+
31
+ ## Rules
32
+
33
+ 1. Always read and understand ALL review comments before making changes
34
+ 2. Address each review comment systematically
35
+ 3. Follow TDD when adding or modifying tests
36
+ 4. Respect the existing design and architecture
37
+ 5. After addressing all feedback, the PR should be ready for re-review
38
+ 6. Update the Issue label to "status:review-requested" when complete
39
+ 7. If the current directory is under `.git/osoba/`, this is a dedicated codebase created using git worktree
40
+ 8. **Work carefully and thoroughly until all issues are resolved, without worrying about time constraints or context compression**
41
+ 9. **Code Collective Ownership**: Take responsibility for the entire codebase and proactively fix issues even if they seem unrelated to your changes
42
+ 10. **Time Constraints**: Do not fear time constraints or context compression. Work calmly and thoroughly, prioritizing quality above speed
43
+
44
+ ---
45
+
46
+ ## Instructions
47
+
48
+ ### **⚠️ CI Success is Mandatory ⚠️**
49
+
50
+ **Passing CI is an absolute prerequisite for task completion.**
51
+
52
+ - Even if CI failures are "unrelated to your current changes", **you must make every effort to fix those issues**
53
+ - All CI problems must be resolved, including test failures, build errors, and lint errors
54
+ - Never mark a task as complete while CI is failing
55
+
56
+ ### Workflow (Overview)
57
+
58
+ 1. Check the PR and review comments
59
+ 2. Understand all feedback points
60
+ 3. Make necessary corrections
61
+ 4. Run tests to verify fixes
62
+ 5. **Ensure CI passes completely**
63
+ 6. Commit changes with clear messages
64
+ 7. Post a summary of changes made
65
+ 8. Update Issue labels
66
+
67
+ ---
68
+
69
+ ## Detailed Steps
70
+
71
+ 1. **Check the Pull Request and review comments**
72
+ - Run `gh pr list --author @me --state open` to find your PR
73
+ - Run `gh pr view <PR number>` to see PR details
74
+ - Run `gh pr view <PR number> --comments` to read all review comments
75
+ - Make a list of all feedback points that need to be addressed
76
+
77
+ 2. **Understand the feedback**
78
+ - Categorize feedback into:
79
+ - Code quality issues
80
+ - Bug fixes
81
+ - Test coverage gaps
82
+ - Documentation updates
83
+ - Style/formatting issues
84
+ - Prioritize critical issues first
85
+
86
+ 3. **Make corrections systematically**
87
+ - Address each feedback point one by one
88
+ - Write/update tests as needed
89
+ - Ensure each change maintains backward compatibility
90
+ - Commit frequently with descriptive messages like:
91
+ ```
92
+ fix: address review feedback on error handling
93
+ refactor: improve variable naming as suggested
94
+ test: add missing test cases for edge conditions
95
+ ```
96
+
97
+ 4. **Run tests and verify (MANDATORY)**
98
+ - **⚠️ CRITICAL: All tests in the entire codebase must pass - this is an absolute requirement for acceptance**
99
+ - Run the full test suite (`bin/rails spec` - NO ARGUMENTS) to ensure nothing is broken # timeout 600000ms
100
+ - **ABSOLUTE REQUIREMENT**: Never mark as complete without running the full test suite
101
+ - Verify that all review points have been addressed
102
+ - Check that the code still meets the original requirements
103
+ - **Ensure CI passes completely**
104
+ - If CI fails, fix the issues regardless of their cause
105
+ - **IMPORTANT**: Execute `bin/rails spec` without any arguments to test the entire codebase
106
+
107
+ 5. **Post a summary comment**
108
+ - Create a comment on the PR summarizing what was changed:
109
+ ```bash
110
+ gh pr comment <PR number> --body "## レビュー指摘対応完了
111
+
112
+ 以下の指摘事項に対応しました:
113
+ - ✅ [対応した項目1]
114
+ - ✅ [対応した項目2]
115
+ - ✅ [対応した項目3]
116
+
117
+ 全てのテストがパスすることを確認済みです。
118
+ 再レビューをお願いいたします。"
119
+ ```
120
+
121
+ 6. **Update Issue labels**
122
+ - Remove "status:revising" label
123
+ - Add "status:review-requested" label
124
+ ```bash
125
+ gh issue edit <issue number> \
126
+ --remove-label "status:revising" \
127
+ --add-label "status:review-requested"
128
+ ```
129
+
130
+ ---
131
+
132
+ ## Common Review Feedback Types
133
+
134
+ ### Code Quality
135
+ - Variable/function naming improvements
136
+ - Code duplication removal
137
+ - Complex logic simplification
138
+ - Error handling improvements
139
+
140
+ ### Testing
141
+ - Missing test cases
142
+ - Edge case coverage
143
+ - Test data improvements
144
+ - Mock simplification
145
+
146
+ ### Documentation
147
+ - Missing or unclear comments
148
+ - API documentation updates
149
+ - README updates
150
+
151
+ ### Performance
152
+ - Inefficient algorithms
153
+ - Unnecessary database queries
154
+ - Memory leak risks
155
+
156
+ ---
157
+
158
+ ## Best Practices
159
+
160
+ 1. **Be thorough**: Address ALL feedback, not just the easy ones
161
+ 2. **Be communicative**: If you disagree with feedback, explain why
162
+ 3. **Be proactive**: Look for similar issues elsewhere in the code
163
+ 4. **Be respectful**: Thank reviewers for their feedback
164
+ 5. **Be complete**: Ensure all tests pass before marking as ready
165
+
166
+ ---
167
+
168
+ ## Important Notes
169
+
170
+ - **Never mark as "ready for review" if CI is failing**
171
+ - **If CI is failing, you must attempt to fix it even if the cause is unrelated to your current changes**
172
+ - If you cannot address certain feedback, explain why in the PR comments
173
+ - Keep the commit history clean and meaningful
174
+ - Always verify the changes work as expected before updating labels
175
+ - **Task completion requirement: CI must pass completely**
176
+ - **CRITICAL: Always update Issue labels upon task completion, regardless of any circumstances. This is an essential rule to keep the workflow moving forward without interruption.**
@@ -0,0 +1,88 @@
1
+ ---
2
+ allowed-tools: TodoRead, TodoWrite, Bash, Read, Write, Edit, MultiEdit, Grep, Glob
3
+ description: "TDDによる実装とPR作成"
4
+ ---
5
+
6
+ ## 概要
7
+
8
+ 実装計画に基づいてTDDで開発を進め、Pull Requestを作成します。
9
+
10
+ ---
11
+
12
+ ## 前提条件
13
+
14
+ - Issueコメントに実装計画が存在
15
+ - ラベルは `soba:doing` の状態
16
+
17
+ ---
18
+
19
+ ## ルール
20
+
21
+ 1. **実装計画を必ず確認し従う**
22
+ 2. **TDD実践(テストファースト)**
23
+ 3. **既存設計・アーキテクチャを尊重**
24
+ 4. **実装完了後はPRを作成**
25
+ 5. **全テストのパスが必須条件**
26
+
27
+ ---
28
+
29
+ ## 実行手順
30
+
31
+ 1. **Issue・計画確認**
32
+ - `gh issue view <番号>` で内容確認
33
+ - `gh issue view <番号> --comments` でコメント確認
34
+
35
+ 2. **テスト作成**
36
+ - 計画に基づくテストケース作成
37
+ - Red → Green → Refactor
38
+
39
+ 3. **実装**
40
+ - 小さな単位でコミット
41
+ - 意味のあるコミットメッセージ
42
+
43
+ 4. **テスト実行**
44
+ - 単体テスト実行
45
+ - 全体テスト実行(必須)
46
+
47
+ 5. **PRテンプレート作成**
48
+ - `./.tmp/pull-request-<番号>.md` 作成
49
+
50
+ 6. **PR作成**
51
+ ```bash
52
+ gh pr create \
53
+ --title "feat: [機能名] (#<Issue番号>)" \
54
+ --body-file ./.tmp/pull-request-<番号>.md \
55
+ --base main
56
+ ```
57
+
58
+ 7. **Issueコメント**
59
+ - 「PR #<番号> を作成しました」
60
+
61
+ 8. **ラベル更新**
62
+ ```bash
63
+ gh issue edit <番号> \
64
+ --remove-label "soba:doing" \
65
+ --add-label "soba:review-requested"
66
+ ```
67
+
68
+ ---
69
+
70
+ ## PRテンプレート
71
+
72
+ ```markdown
73
+ ## 実装完了
74
+
75
+ fixes #<番号>
76
+
77
+ ### 変更内容
78
+ - [主要な変更点]
79
+
80
+ ### テスト結果
81
+ - 単体テスト: ✅ パス
82
+ - 全体テスト: ✅ パス
83
+
84
+ ### 確認事項
85
+ - [ ] 実装計画に沿った実装
86
+ - [ ] テストカバレッジ確保
87
+ - [ ] 既存機能への影響なし
88
+ ```
@@ -0,0 +1,93 @@
1
+ ---
2
+ allowed-tools: TodoWrite, TodoRead, Bash, Read, Grep, Glob
3
+ description: "GitHub Issueの実装計画を策定"
4
+ ---
5
+
6
+ ## 概要
7
+
8
+ GitHub Issueに対する実装計画を策定し、Issueコメントとして投稿します。
9
+
10
+ ---
11
+
12
+ ## 前提条件
13
+
14
+ - ラベルは `soba:planning` の状態
15
+
16
+ ---
17
+
18
+ ## ルール
19
+
20
+ 1. **コード修正は行わず、計画策定に専念**
21
+ 2. **TDDを前提とした計画設計**
22
+ 3. **既存アーキテクチャに従う**
23
+ 4. **実行可能な単位にステップ分割**
24
+ 5. **テンプレート形式で計画作成**
25
+ 6. **完了後ラベルを `soba:ready` に更新**
26
+
27
+ ---
28
+
29
+ ## 実行手順
30
+
31
+ 1. **Issue確認**
32
+ - `gh issue view <番号>` で内容確認
33
+ - `gh issue view <番号> --comments` でコメント確認
34
+
35
+ 2. **コードベース調査**
36
+ - 関連ファイル・過去実装を確認
37
+ - 影響範囲と依存関係を特定
38
+
39
+ 3. **技術選定**
40
+ - 使用ライブラリ・パターンを決定
41
+ - 選定理由を明確化
42
+
43
+ 4. **実装ステップ定義**
44
+ - テスト可能な単位に分割
45
+ - 関連ファイル・副作用を記載
46
+
47
+ 5. **テスト・リスク・スケジュール策定**
48
+ - テスト計画(単体・統合)
49
+ - リスクと対策
50
+ - 実装期間の見積もり
51
+
52
+ 6. **計画ファイル作成**
53
+ - `./.tmp/plan-[slug].md` に保存
54
+
55
+ 7. **コメント投稿**
56
+ - `gh issue comment <番号> --body-file ./.tmp/plan-[slug].md`
57
+
58
+ 8. **ラベル更新**
59
+ - `gh issue edit <番号> --remove-label "soba:planning" --add-label "soba:ready"`
60
+
61
+ ---
62
+
63
+ ## テンプレート
64
+
65
+ ```markdown
66
+ # 実装計画: [タイトル]
67
+
68
+ ## 要件概要
69
+ - [目的と背景]
70
+ - [機能要件]
71
+ - [受け入れ条件]
72
+
73
+ ## 設計方針
74
+ - [技術選定と理由]
75
+ - [アーキテクチャ上の考慮点]
76
+
77
+ ## 実装ステップ
78
+ 1. [ステップ名]
79
+ - 作業内容: [詳細]
80
+ - 関連ファイル: [ファイルパス]
81
+
82
+ ## テスト計画
83
+ - 単体テスト: [対象とケース]
84
+ - 統合テスト: [シナリオ]
85
+
86
+ ## リスクと対策
87
+ - リスク: [内容]
88
+ 対策: [方法]
89
+
90
+ ## スケジュール
91
+ - 見積もり: 合計[X]時間
92
+ - ステップ別: 各[Y]時間
93
+ ```
@@ -0,0 +1,91 @@
1
+ ---
2
+ allowed-tools: Bash, Read, Write, Edit, MultiEdit, Grep, Glob, LS
3
+ description: "Review a Pull Request for a soba Issue"
4
+ ---
5
+
6
+ # Review PR
7
+
8
+ PRレビューを実施します。
9
+
10
+ ## Context
11
+
12
+ - Issue番号: $ARGUMENTS
13
+
14
+ ## Workflow
15
+
16
+ ### 1. Issue確認
17
+
18
+ ```bash
19
+ GH_PAGER= gh issue view <issue-number>
20
+ GH_PAGER= gh issue view <issue-number> --comments
21
+ ```
22
+
23
+ ### 2. PR確認
24
+
25
+ ```bash
26
+ GH_PAGER= gh pr view <PR-number>
27
+ GH_PAGER= gh pr view <PR-number> --json mergeable,mergeStateStatus
28
+ ```
29
+
30
+ ### 3. コード変更確認
31
+
32
+ ```bash
33
+ GH_PAGER= gh pr diff <PR-number>
34
+ ```
35
+
36
+ レビュー観点:
37
+ - コーディング規約への準拠
38
+ - テストの実装状況
39
+ - セキュリティ上の懸念
40
+ - 不要な差分の有無
41
+
42
+ ### 4. CI確認(必須・完了まで待機)
43
+
44
+ ```bash
45
+ gh pr checks <PR-number> --watch # Timeout 600000
46
+ ```
47
+
48
+ ⚠️ **重要**: CI完了前にレビュー結果を投稿しないこと
49
+
50
+ ### 5. レビュー結果投稿
51
+
52
+ `./.tmp/review-result-<issue-number>.md`を作成:
53
+
54
+ ```markdown
55
+ ## レビュー結果
56
+
57
+ - Issue: #<issue-number>
58
+ - PR: #<PR-number>
59
+
60
+ ### ✅ 判定
61
+ - [ ] 承認(LGTM)
62
+ - [ ] 修正要求
63
+
64
+ ### 🔄 マージ状態
65
+ - [ ] コンフリクトなし
66
+ - [ ] コンフリクトあり(要リベース)
67
+
68
+ ### 👍 良い点
69
+ - [実装の良い点]
70
+
71
+ ### 🛠 改善提案
72
+ - [具体的な改善点]
73
+ ```
74
+
75
+ 投稿:
76
+ ```bash
77
+ gh pr comment <PR-number> --body "$(cat ./.tmp/review-result-<issue-number>.md)"
78
+ ```
79
+
80
+ ### 6. ラベル更新
81
+
82
+ 承認の場合:
83
+ ```bash
84
+ gh issue edit <issue-number> --remove-label "soba:reviewing" --add-label "soba:done"
85
+ gh pr edit <PR-number> --add-label "soba:lgtm"
86
+ ```
87
+
88
+ 修正要求の場合:
89
+ ```bash
90
+ gh issue edit <issue-number> --remove-label "soba:reviewing" --add-label "soba:requires-changes"
91
+ ```
@@ -0,0 +1,76 @@
1
+ ---
2
+ allowed-tools: Bash, Read, Write, Edit, MultiEdit, Grep, Glob, LS
3
+ description: "Revise implementation based on review feedback"
4
+ ---
5
+
6
+ # Revise PR
7
+
8
+ レビュー指摘事項に対応します。
9
+
10
+ ## Context
11
+
12
+ - Issue番号: $ARGUMENTS
13
+
14
+ ## Workflow
15
+
16
+ ### 1. PR確認
17
+
18
+ ```bash
19
+ GH_PAGER= gh pr list --search "linked:$ARGUMENTS" --state open --json number --jq '.[0].number'
20
+ ```
21
+
22
+ ### 2. レビューコメント確認
23
+
24
+ ```bash
25
+ GH_PAGER= gh pr view <PR-number> --comments
26
+ ```
27
+
28
+ ### 3. 指摘事項への対応
29
+
30
+ レビューコメントに基づいて修正を実施:
31
+ - コード品質の改善
32
+ - テストの追加・修正
33
+ - エラーハンドリングの改善
34
+ - 不要な差分の削除
35
+
36
+ ### 4. テスト実行
37
+
38
+ ```bash
39
+ bundle exec rspec # Timeout 600000
40
+ ```
41
+
42
+ ### 5. 修正内容のコミット
43
+
44
+ ```bash
45
+ git add -A
46
+ git commit -m "fix: レビュー指摘事項への対応
47
+
48
+ - [修正内容の要約]
49
+ "
50
+ git push
51
+ ```
52
+
53
+ ### 6. 対応完了コメント
54
+
55
+ `./.tmp/revise-complete-<issue-number>.md`を作成:
56
+
57
+ ```markdown
58
+ ## レビュー指摘対応完了
59
+
60
+ 以下の指摘事項に対応しました:
61
+ - ✅ [対応項目]
62
+
63
+ 全てのテストがパスすることを確認済みです。
64
+ 再レビューをお願いいたします。
65
+ ```
66
+
67
+ 投稿:
68
+ ```bash
69
+ gh pr comment <PR-number> --body "$(cat ./.tmp/revise-complete-<issue-number>.md)"
70
+ ```
71
+
72
+ ### 7. ラベル更新
73
+
74
+ ```bash
75
+ gh issue edit <issue-number> --remove-label "soba:revising" --add-label "soba:review-requested"
76
+ ```
@@ -0,0 +1,2 @@
1
+ RUBY_VERSION=3.4.5
2
+ COMPOSE_PROJECT_NAME=soba-cli
@@ -0,0 +1,3 @@
1
+ # Ruby 3.4 for soba CLI project
2
+ FROM mcr.microsoft.com/devcontainers/ruby:3.4
3
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Sho DOUHASHI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,85 @@
1
+ # Rails DevContainer
2
+
3
+ A fully-featured development container configuration for Ruby on Rails projects with integrated tools and services.
4
+
5
+ ## Features
6
+
7
+ - Pre-configured Ruby on Rails development environment
8
+ - Docker Compose setup with Selenium for system testing
9
+ - GitHub CLI, Node.js, Python, and AWS CLI pre-installed
10
+ - Automatic Ruby version synchronization
11
+ - MCP (Model Context Protocol) server integration
12
+ - Volume mounts for SSH, AWS, GitHub, and Claude configurations
13
+
14
+ ## Requirements
15
+
16
+ - Docker Desktop or Docker Engine
17
+ - Visual Studio Code with Dev Containers extension
18
+ - Git
19
+
20
+ ## Quick Start
21
+
22
+ 1. In your Rails project directory, add this repository as a git subtree:
23
+ ```bash
24
+ git subtree add --prefix=.devcontainer --squash git@github.com:douhashi/devcontainer-rails.git main
25
+ ```
26
+
27
+ ### Visual Studio Code
28
+
29
+ 2. Open your Rails project in VS Code:
30
+ ```bash
31
+ code .
32
+ ```
33
+
34
+ 3. When prompted, click "Reopen in Container" or run the command "Dev Containers: Reopen in Container"
35
+
36
+ 4. Wait for the container to build and post-create scripts to complete
37
+
38
+ ### DevContainer CLI
39
+
40
+ 2. Rebuild and start the development container:
41
+ ```bash
42
+ .devcontainer/bin/rebuild
43
+ .devcontainer/bin/up
44
+ ```
45
+
46
+ 3. The container will build and start with all configured services
47
+
48
+ ## Updating DevContainer
49
+
50
+ To update the DevContainer configuration with the latest changes from the upstream repository:
51
+
52
+ ```bash
53
+ git subtree pull --prefix=.devcontainer --squash git@github.com:douhashi/devcontainer-rails.git main
54
+ ```
55
+
56
+ ## Configuration
57
+
58
+ ### Ruby Version
59
+
60
+ The Ruby version is automatically synchronized from `.tool-versions` file. To change it:
61
+ 1. Update `.tool-versions` in your Rails project
62
+ 2. Run `sync-ruby-version.sh` to update the DevContainer configuration
63
+ 3. Rebuild the container
64
+
65
+ ### Services
66
+
67
+ - **App**: Main Rails application container (ports 5100, 3036)
68
+ - **Selenium**: Chrome browser for system tests (port 4444)
69
+
70
+ ### Environment Variables
71
+
72
+ - `KAMAL_REGISTRY_USERNAME`: Docker registry username for Kamal deployments
73
+ - `KAMAL_REGISTRY_PASSWORD`: Docker registry password for Kamal deployments
74
+ - `VITE_RUBY_HOST`: Vite development server host (default: 0.0.0.0)
75
+ - `SELENIUM_URL`: Selenium server URL for system tests
76
+
77
+ ## Scripts
78
+
79
+ - `post-create.sh`: Runs after container creation (installs packages, tools, Rails setup)
80
+ - `post-attach.sh`: Runs each time you attach to the container
81
+ - `sync-ruby-version.sh`: Updates DevContainer Ruby version from .tool-versions
82
+
83
+ ## License
84
+
85
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,50 @@
1
+ #!/bin/bash
2
+
3
+ # Sync environment variables from .tool-versions to .devcontainer/.env
4
+ sync_envs() {
5
+ local script_path=".devcontainer/sync-envs.sh"
6
+ if [ -f "$script_path" ]; then
7
+ echo "Syncing environment variables..."
8
+ bash "$script_path"
9
+ else
10
+ echo "Warning: $script_path not found, skipping environment sync"
11
+ fi
12
+ }
13
+
14
+ # Function to start devcontainer
15
+ up_devcontainer() {
16
+ local additional_flags="$1"
17
+
18
+ # Sync environment variables before starting devcontainer
19
+ sync_envs
20
+
21
+ # Get the tmux config path
22
+ tmux_config_path=~/.config/tmux
23
+ tmux_resolved_config_path=$(readlink -f "$tmux_config_path")
24
+ echo "Resolved config path: $tmux_resolved_config_path"
25
+
26
+ # Construct the command to run the devcontainer
27
+ command="devcontainer up $additional_flags"
28
+
29
+ # Add mount options
30
+ command+=" --mount type=bind,source=$tmux_resolved_config_path,target=/home/vscode/.config/tmux"
31
+
32
+ # Add additional features
33
+ command+=" --additional-features='{ \
34
+ \"ghcr.io/duduribeiro/devcontainer-features/tmux:1\": {} \
35
+ }'"
36
+
37
+ # Add workspace folder
38
+ command+=" --workspace-folder ."
39
+
40
+ eval "$command"
41
+ }
42
+
43
+ # Function to connect to devcontainer
44
+ exec_devcontainer() {
45
+ # Prepare exec command with environment variables
46
+ exec_command="devcontainer exec"
47
+ exec_command+=" --workspace-folder . /bin/bash"
48
+
49
+ eval "$exec_command"
50
+ }