jp_address_complement 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 (181) hide show
  1. checksums.yaml +7 -0
  2. data/.agent/rules/specify-rules.md +29 -0
  3. data/.agent/workflows/speckit.analyze.md +184 -0
  4. data/.agent/workflows/speckit.checklist.md +294 -0
  5. data/.agent/workflows/speckit.clarify.md +181 -0
  6. data/.agent/workflows/speckit.constitution.md +84 -0
  7. data/.agent/workflows/speckit.implement.md +135 -0
  8. data/.agent/workflows/speckit.plan.md +90 -0
  9. data/.agent/workflows/speckit.specify.md +258 -0
  10. data/.agent/workflows/speckit.tasks.md +137 -0
  11. data/.agent/workflows/speckit.taskstoissues.md +30 -0
  12. data/.claude/commands/speckit.analyze.md +184 -0
  13. data/.claude/commands/speckit.checklist.md +294 -0
  14. data/.claude/commands/speckit.clarify.md +181 -0
  15. data/.claude/commands/speckit.constitution.md +84 -0
  16. data/.claude/commands/speckit.implement.md +135 -0
  17. data/.claude/commands/speckit.plan.md +90 -0
  18. data/.claude/commands/speckit.specify.md +258 -0
  19. data/.claude/commands/speckit.tasks.md +137 -0
  20. data/.claude/commands/speckit.taskstoissues.md +30 -0
  21. data/.cursor/commands/speckit.analyze.md +184 -0
  22. data/.cursor/commands/speckit.checklist.md +294 -0
  23. data/.cursor/commands/speckit.clarify.md +181 -0
  24. data/.cursor/commands/speckit.constitution.md +84 -0
  25. data/.cursor/commands/speckit.implement.md +135 -0
  26. data/.cursor/commands/speckit.plan.md +90 -0
  27. data/.cursor/commands/speckit.specify.md +258 -0
  28. data/.cursor/commands/speckit.tasks.md +137 -0
  29. data/.cursor/commands/speckit.taskstoissues.md +30 -0
  30. data/.cursor/rules/specify-rules.mdc +32 -0
  31. data/.rubocop.yml +118 -0
  32. data/.specify/memory/constitution.md +130 -0
  33. data/.specify/scripts/bash/check-prerequisites.sh +166 -0
  34. data/.specify/scripts/bash/common.sh +156 -0
  35. data/.specify/scripts/bash/create-new-feature.sh +297 -0
  36. data/.specify/scripts/bash/setup-plan.sh +61 -0
  37. data/.specify/scripts/bash/update-agent-context.sh +810 -0
  38. data/.specify/templates/agent-file-template.md +28 -0
  39. data/.specify/templates/checklist-template.md +40 -0
  40. data/.specify/templates/constitution-template.md +50 -0
  41. data/.specify/templates/plan-template.md +104 -0
  42. data/.specify/templates/spec-template.md +115 -0
  43. data/.specify/templates/tasks-template.md +251 -0
  44. data/CHANGELOG.md +26 -0
  45. data/LICENSE +9 -0
  46. data/README.md +274 -0
  47. data/Rakefile +19 -0
  48. data/Steepfile +9 -0
  49. data/examples/rails/jp_address_complement_demo/.gitignore +15 -0
  50. data/examples/rails/jp_address_complement_demo/.ruby-version +1 -0
  51. data/examples/rails/jp_address_complement_demo/Gemfile +22 -0
  52. data/examples/rails/jp_address_complement_demo/Gemfile.lock +252 -0
  53. data/examples/rails/jp_address_complement_demo/README.md +57 -0
  54. data/examples/rails/jp_address_complement_demo/Rakefile +6 -0
  55. data/examples/rails/jp_address_complement_demo/app/assets/images/.keep +0 -0
  56. data/examples/rails/jp_address_complement_demo/app/assets/stylesheets/application.css +1 -0
  57. data/examples/rails/jp_address_complement_demo/app/controllers/addresses_controller.rb +59 -0
  58. data/examples/rails/jp_address_complement_demo/app/controllers/application_controller.rb +4 -0
  59. data/examples/rails/jp_address_complement_demo/app/controllers/concerns/.keep +0 -0
  60. data/examples/rails/jp_address_complement_demo/app/helpers/application_helper.rb +2 -0
  61. data/examples/rails/jp_address_complement_demo/app/models/application_record.rb +3 -0
  62. data/examples/rails/jp_address_complement_demo/app/models/concerns/.keep +0 -0
  63. data/examples/rails/jp_address_complement_demo/app/views/addresses/index.html.erb +22 -0
  64. data/examples/rails/jp_address_complement_demo/app/views/addresses/prefecture.html.erb +20 -0
  65. data/examples/rails/jp_address_complement_demo/app/views/addresses/prefix.html.erb +25 -0
  66. data/examples/rails/jp_address_complement_demo/app/views/addresses/reverse.html.erb +30 -0
  67. data/examples/rails/jp_address_complement_demo/app/views/addresses/validate.html.erb +23 -0
  68. data/examples/rails/jp_address_complement_demo/app/views/layouts/application.html.erb +40 -0
  69. data/examples/rails/jp_address_complement_demo/app/views/pwa/manifest.json.erb +22 -0
  70. data/examples/rails/jp_address_complement_demo/app/views/pwa/service-worker.js +26 -0
  71. data/examples/rails/jp_address_complement_demo/bin/ci +6 -0
  72. data/examples/rails/jp_address_complement_demo/bin/dev +2 -0
  73. data/examples/rails/jp_address_complement_demo/bin/rails +4 -0
  74. data/examples/rails/jp_address_complement_demo/bin/rake +4 -0
  75. data/examples/rails/jp_address_complement_demo/bin/setup +35 -0
  76. data/examples/rails/jp_address_complement_demo/config/application.rb +42 -0
  77. data/examples/rails/jp_address_complement_demo/config/boot.rb +3 -0
  78. data/examples/rails/jp_address_complement_demo/config/ci.rb +15 -0
  79. data/examples/rails/jp_address_complement_demo/config/credentials.yml.enc +1 -0
  80. data/examples/rails/jp_address_complement_demo/config/database.yml +31 -0
  81. data/examples/rails/jp_address_complement_demo/config/environment.rb +5 -0
  82. data/examples/rails/jp_address_complement_demo/config/environments/development.rb +54 -0
  83. data/examples/rails/jp_address_complement_demo/config/environments/production.rb +67 -0
  84. data/examples/rails/jp_address_complement_demo/config/environments/test.rb +42 -0
  85. data/examples/rails/jp_address_complement_demo/config/initializers/content_security_policy.rb +29 -0
  86. data/examples/rails/jp_address_complement_demo/config/initializers/filter_parameter_logging.rb +8 -0
  87. data/examples/rails/jp_address_complement_demo/config/initializers/inflections.rb +16 -0
  88. data/examples/rails/jp_address_complement_demo/config/locales/en.yml +31 -0
  89. data/examples/rails/jp_address_complement_demo/config/puma.rb +39 -0
  90. data/examples/rails/jp_address_complement_demo/config/routes.rb +19 -0
  91. data/examples/rails/jp_address_complement_demo/config.ru +6 -0
  92. data/examples/rails/jp_address_complement_demo/db/migrate/20260228083709_create_jp_address_complement_postal_codes.rb +44 -0
  93. data/examples/rails/jp_address_complement_demo/db/schema.rb +33 -0
  94. data/examples/rails/jp_address_complement_demo/db/seeds.rb +24 -0
  95. data/examples/rails/jp_address_complement_demo/lib/tasks/.keep +0 -0
  96. data/examples/rails/jp_address_complement_demo/log/.keep +0 -0
  97. data/examples/rails/jp_address_complement_demo/public/400.html +135 -0
  98. data/examples/rails/jp_address_complement_demo/public/404.html +135 -0
  99. data/examples/rails/jp_address_complement_demo/public/406-unsupported-browser.html +135 -0
  100. data/examples/rails/jp_address_complement_demo/public/422.html +135 -0
  101. data/examples/rails/jp_address_complement_demo/public/500.html +135 -0
  102. data/examples/rails/jp_address_complement_demo/public/icon.png +0 -0
  103. data/examples/rails/jp_address_complement_demo/public/icon.svg +3 -0
  104. data/examples/rails/jp_address_complement_demo/public/robots.txt +1 -0
  105. data/examples/rails/jp_address_complement_demo/script/.keep +0 -0
  106. data/examples/rails/jp_address_complement_demo/storage/.keep +0 -0
  107. data/examples/rails/jp_address_complement_demo/vendor/.keep +0 -0
  108. data/lib/generators/jp_address_complement/install_generator.rb +34 -0
  109. data/lib/generators/jp_address_complement/templates/create_jp_address_complement_postal_codes.rb.erb +45 -0
  110. data/lib/jp_address_complement/address_record.rb +36 -0
  111. data/lib/jp_address_complement/configuration.rb +21 -0
  112. data/lib/jp_address_complement/importers/csv_importer.rb +148 -0
  113. data/lib/jp_address_complement/ken_all_downloader.rb +122 -0
  114. data/lib/jp_address_complement/models/postal_code.rb +21 -0
  115. data/lib/jp_address_complement/normalizer.rb +77 -0
  116. data/lib/jp_address_complement/prefecture.rb +105 -0
  117. data/lib/jp_address_complement/railtie.rb +27 -0
  118. data/lib/jp_address_complement/repositories/active_record_postal_code_repository.rb +78 -0
  119. data/lib/jp_address_complement/repositories/csv_postal_code_repository.rb +200 -0
  120. data/lib/jp_address_complement/repositories/postal_code_repository.rb +36 -0
  121. data/lib/jp_address_complement/searcher.rb +85 -0
  122. data/lib/jp_address_complement/validators/address_validator.rb +41 -0
  123. data/lib/jp_address_complement/version.rb +6 -0
  124. data/lib/jp_address_complement.rb +129 -0
  125. data/lib/tasks/jp_address_complement.rake +32 -0
  126. data/rbs_collection.lock.yaml +380 -0
  127. data/rbs_collection.yaml +19 -0
  128. data/sig/generated/generators/jp_address_complement/install_generator.rbs +18 -0
  129. data/sig/generated/jp_address_complement/configuration.rbs +18 -0
  130. data/sig/generated/jp_address_complement/importers/csv_importer.rbs +78 -0
  131. data/sig/generated/jp_address_complement/ken_all_downloader.rbs +49 -0
  132. data/sig/generated/jp_address_complement/normalizer.rbs +37 -0
  133. data/sig/generated/jp_address_complement/prefecture.rbs +27 -0
  134. data/sig/generated/jp_address_complement/railtie.rbs +8 -0
  135. data/sig/generated/jp_address_complement/repositories/active_record_postal_code_repository.rbs +38 -0
  136. data/sig/generated/jp_address_complement/repositories/csv_postal_code_repository.rbs +100 -0
  137. data/sig/generated/jp_address_complement/repositories/postal_code_repository.rbs +29 -0
  138. data/sig/generated/jp_address_complement/searcher.rbs +43 -0
  139. data/sig/generated/jp_address_complement/validators/address_validator.rbs +24 -0
  140. data/sig/generated/jp_address_complement/version.rbs +5 -0
  141. data/sig/generated/jp_address_complement.rbs +84 -0
  142. data/sig/manual/address_record.rbs +40 -0
  143. data/sig/manual/gem_rubyzip.rbs +17 -0
  144. data/sig/manual/postal_code.rbs +9 -0
  145. data/sig/manual/stdlib_csv_invalid_encoding_error.rbs +5 -0
  146. data/sig/manual/stdlib_net_http.rbs +33 -0
  147. data/sig/manual/stdlib_openuri.rbs +9 -0
  148. data/sig/manual/stdlib_tmpdir.rbs +4 -0
  149. data/specs/001-jp-address-complement-gem/checklists/requirements.md +36 -0
  150. data/specs/001-jp-address-complement-gem/contracts/public-api.md +209 -0
  151. data/specs/001-jp-address-complement-gem/data-model.md +207 -0
  152. data/specs/001-jp-address-complement-gem/plan.md +124 -0
  153. data/specs/001-jp-address-complement-gem/quickstart.md +151 -0
  154. data/specs/001-jp-address-complement-gem/research.md +139 -0
  155. data/specs/001-jp-address-complement-gem/spec.md +153 -0
  156. data/specs/001-jp-address-complement-gem/tasks.md +279 -0
  157. data/specs/002-rbs-type-annotations/checklists/requirements.md +37 -0
  158. data/specs/002-rbs-type-annotations/contracts/rbs-public-api.md +116 -0
  159. data/specs/002-rbs-type-annotations/data-model.md +119 -0
  160. data/specs/002-rbs-type-annotations/plan.md +116 -0
  161. data/specs/002-rbs-type-annotations/quickstart.md +105 -0
  162. data/specs/002-rbs-type-annotations/research.md +173 -0
  163. data/specs/002-rbs-type-annotations/spec.md +125 -0
  164. data/specs/002-rbs-type-annotations/tasks.md +189 -0
  165. data/specs/003-csv-remove-obsolete/checklists/requirements.md +34 -0
  166. data/specs/003-csv-remove-obsolete/contracts/csv-import.md +41 -0
  167. data/specs/003-csv-remove-obsolete/data-model.md +47 -0
  168. data/specs/003-csv-remove-obsolete/plan.md +73 -0
  169. data/specs/003-csv-remove-obsolete/quickstart.md +40 -0
  170. data/specs/003-csv-remove-obsolete/research.md +71 -0
  171. data/specs/003-csv-remove-obsolete/spec.md +85 -0
  172. data/specs/003-csv-remove-obsolete/tasks.md +167 -0
  173. data/specs/004-prefecture-code-reverse-lookup/checklists/requirements.md +34 -0
  174. data/specs/004-prefecture-code-reverse-lookup/contracts/public-api-prefecture-and-reverse.md +122 -0
  175. data/specs/004-prefecture-code-reverse-lookup/data-model.md +81 -0
  176. data/specs/004-prefecture-code-reverse-lookup/plan.md +92 -0
  177. data/specs/004-prefecture-code-reverse-lookup/quickstart.md +91 -0
  178. data/specs/004-prefecture-code-reverse-lookup/research.md +62 -0
  179. data/specs/004-prefecture-code-reverse-lookup/spec.md +120 -0
  180. data/specs/004-prefecture-code-reverse-lookup/tasks.md +190 -0
  181. metadata +451 -0
@@ -0,0 +1,137 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ handoffs:
4
+ - label: Analyze For Consistency
5
+ agent: speckit.analyze
6
+ prompt: Run a project analysis for consistency
7
+ send: true
8
+ - label: Implement Project
9
+ agent: speckit.implement
10
+ prompt: Start the implementation in phases
11
+ send: true
12
+ ---
13
+
14
+ ## User Input
15
+
16
+ ```text
17
+ $ARGUMENTS
18
+ ```
19
+
20
+ You **MUST** consider the user input before proceeding (if not empty).
21
+
22
+ ## Outline
23
+
24
+ 1. **Setup**: Run `.specify/scripts/bash/check-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
25
+
26
+ 2. **Load design documents**: Read from FEATURE_DIR:
27
+ - **Required**: plan.md (tech stack, libraries, structure), spec.md (user stories with priorities)
28
+ - **Optional**: data-model.md (entities), contracts/ (interface contracts), research.md (decisions), quickstart.md (test scenarios)
29
+ - Note: Not all projects have all documents. Generate tasks based on what's available.
30
+
31
+ 3. **Execute task generation workflow**:
32
+ - Load plan.md and extract tech stack, libraries, project structure
33
+ - Load spec.md and extract user stories with their priorities (P1, P2, P3, etc.)
34
+ - If data-model.md exists: Extract entities and map to user stories
35
+ - If contracts/ exists: Map interface contracts to user stories
36
+ - If research.md exists: Extract decisions for setup tasks
37
+ - Generate tasks organized by user story (see Task Generation Rules below)
38
+ - Generate dependency graph showing user story completion order
39
+ - Create parallel execution examples per user story
40
+ - Validate task completeness (each user story has all needed tasks, independently testable)
41
+
42
+ 4. **Generate tasks.md**: Use `.specify/templates/tasks-template.md` as structure, fill with:
43
+ - Correct feature name from plan.md
44
+ - Phase 1: Setup tasks (project initialization)
45
+ - Phase 2: Foundational tasks (blocking prerequisites for all user stories)
46
+ - Phase 3+: One phase per user story (in priority order from spec.md)
47
+ - Each phase includes: story goal, independent test criteria, tests (if requested), implementation tasks
48
+ - Final Phase: Polish & cross-cutting concerns
49
+ - All tasks must follow the strict checklist format (see Task Generation Rules below)
50
+ - Clear file paths for each task
51
+ - Dependencies section showing story completion order
52
+ - Parallel execution examples per story
53
+ - Implementation strategy section (MVP first, incremental delivery)
54
+
55
+ 5. **Report**: Output path to generated tasks.md and summary:
56
+ - Total task count
57
+ - Task count per user story
58
+ - Parallel opportunities identified
59
+ - Independent test criteria for each story
60
+ - Suggested MVP scope (typically just User Story 1)
61
+ - Format validation: Confirm ALL tasks follow the checklist format (checkbox, ID, labels, file paths)
62
+
63
+ Context for task generation: $ARGUMENTS
64
+
65
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
66
+
67
+ ## Task Generation Rules
68
+
69
+ **CRITICAL**: Tasks MUST be organized by user story to enable independent implementation and testing.
70
+
71
+ **Tests are OPTIONAL**: Only generate test tasks if explicitly requested in the feature specification or if user requests TDD approach.
72
+
73
+ ### Checklist Format (REQUIRED)
74
+
75
+ Every task MUST strictly follow this format:
76
+
77
+ ```text
78
+ - [ ] [TaskID] [P?] [Story?] Description with file path
79
+ ```
80
+
81
+ **Format Components**:
82
+
83
+ 1. **Checkbox**: ALWAYS start with `- [ ]` (markdown checkbox)
84
+ 2. **Task ID**: Sequential number (T001, T002, T003...) in execution order
85
+ 3. **[P] marker**: Include ONLY if task is parallelizable (different files, no dependencies on incomplete tasks)
86
+ 4. **[Story] label**: REQUIRED for user story phase tasks only
87
+ - Format: [US1], [US2], [US3], etc. (maps to user stories from spec.md)
88
+ - Setup phase: NO story label
89
+ - Foundational phase: NO story label
90
+ - User Story phases: MUST have story label
91
+ - Polish phase: NO story label
92
+ 5. **Description**: Clear action with exact file path
93
+
94
+ **Examples**:
95
+
96
+ - ✅ CORRECT: `- [ ] T001 Create project structure per implementation plan`
97
+ - ✅ CORRECT: `- [ ] T005 [P] Implement authentication middleware in src/middleware/auth.py`
98
+ - ✅ CORRECT: `- [ ] T012 [P] [US1] Create User model in src/models/user.py`
99
+ - ✅ CORRECT: `- [ ] T014 [US1] Implement UserService in src/services/user_service.py`
100
+ - ❌ WRONG: `- [ ] Create User model` (missing ID and Story label)
101
+ - ❌ WRONG: `T001 [US1] Create model` (missing checkbox)
102
+ - ❌ WRONG: `- [ ] [US1] Create User model` (missing Task ID)
103
+ - ❌ WRONG: `- [ ] T001 [US1] Create model` (missing file path)
104
+
105
+ ### Task Organization
106
+
107
+ 1. **From User Stories (spec.md)** - PRIMARY ORGANIZATION:
108
+ - Each user story (P1, P2, P3...) gets its own phase
109
+ - Map all related components to their story:
110
+ - Models needed for that story
111
+ - Services needed for that story
112
+ - Interfaces/UI needed for that story
113
+ - If tests requested: Tests specific to that story
114
+ - Mark story dependencies (most stories should be independent)
115
+
116
+ 2. **From Contracts**:
117
+ - Map each interface contract → to the user story it serves
118
+ - If tests requested: Each interface contract → contract test task [P] before implementation in that story's phase
119
+
120
+ 3. **From Data Model**:
121
+ - Map each entity to the user story(ies) that need it
122
+ - If entity serves multiple stories: Put in earliest story or Setup phase
123
+ - Relationships → service layer tasks in appropriate story phase
124
+
125
+ 4. **From Setup/Infrastructure**:
126
+ - Shared infrastructure → Setup phase (Phase 1)
127
+ - Foundational/blocking tasks → Foundational phase (Phase 2)
128
+ - Story-specific setup → within that story's phase
129
+
130
+ ### Phase Structure
131
+
132
+ - **Phase 1**: Setup (project initialization)
133
+ - **Phase 2**: Foundational (blocking prerequisites - MUST complete before user stories)
134
+ - **Phase 3+**: User Stories in priority order (P1, P2, P3...)
135
+ - Within each story: Tests (if requested) → Models → Services → Endpoints → Integration
136
+ - Each phase should be a complete, independently testable increment
137
+ - **Final Phase**: Polish & Cross-Cutting Concerns
@@ -0,0 +1,30 @@
1
+ ---
2
+ description: Convert existing tasks into actionable, dependency-ordered GitHub issues for the feature based on available design artifacts.
3
+ tools: ['github/github-mcp-server/issue_write']
4
+ ---
5
+
6
+ ## User Input
7
+
8
+ ```text
9
+ $ARGUMENTS
10
+ ```
11
+
12
+ You **MUST** consider the user input before proceeding (if not empty).
13
+
14
+ ## Outline
15
+
16
+ 1. Run `.specify/scripts/bash/check-prerequisites.sh --json --require-tasks --include-tasks` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute. For single quotes in args like "I'm Groot", use escape syntax: e.g 'I'\''m Groot' (or double-quote if possible: "I'm Groot").
17
+ 1. From the executed script, extract the path to **tasks**.
18
+ 1. Get the Git remote by running:
19
+
20
+ ```bash
21
+ git config --get remote.origin.url
22
+ ```
23
+
24
+ > [!CAUTION]
25
+ > ONLY PROCEED TO NEXT STEPS IF THE REMOTE IS A GITHUB URL
26
+
27
+ 1. For each task in the list, use the GitHub MCP server to create a new issue in the repository that is representative of the Git remote.
28
+
29
+ > [!CAUTION]
30
+ > UNDER NO CIRCUMSTANCES EVER CREATE ISSUES IN REPOSITORIES THAT DO NOT MATCH THE REMOTE URL
@@ -0,0 +1,32 @@
1
+ # jp_address_complement_rb Development Guidelines
2
+
3
+ Auto-generated from all feature plans. Last updated: 2026-02-23
4
+
5
+ ## Active Technologies
6
+ - Ruby 3.0+(3.2 以上推奨) + Rails 7.x 以上(オプション)、RSpec、SimpleCov、RuboCop (004-prefecture-code-reverse-lookup)
7
+ - 都道府県コード⇔名称はメモリ内の定数マッピング。逆引きは既存の `jp_address_complement_postal_codes` テーブルを利用。 (004-prefecture-code-reverse-lookup)
8
+
9
+ - Ruby 3.x(3.2 以上推奨) + Rails 7.x、ActiveRecord、標準庫 CSV (003-csv-remove-obsolete)
10
+
11
+ ## Project Structure
12
+
13
+ ```text
14
+ src/
15
+ tests/
16
+ ```
17
+
18
+ ## Commands
19
+
20
+ # Add commands for Ruby 3.x(3.2 以上推奨)
21
+
22
+ ## Code Style
23
+
24
+ Ruby 3.x(3.2 以上推奨): Follow standard conventions
25
+
26
+ ## Recent Changes
27
+ - 004-prefecture-code-reverse-lookup: Added Ruby 3.0+(3.2 以上推奨) + Rails 7.x 以上(オプション)、RSpec、SimpleCov、RuboCop
28
+
29
+ - 003-csv-remove-obsolete: Added Ruby 3.x(3.2 以上推奨) + Rails 7.x、ActiveRecord、標準庫 CSV
30
+
31
+ <!-- MANUAL ADDITIONS START -->
32
+ <!-- MANUAL ADDITIONS END -->
data/.rubocop.yml ADDED
@@ -0,0 +1,118 @@
1
+ plugins:
2
+ - rubocop-rspec
3
+
4
+ AllCops:
5
+ NewCops: enable
6
+ TargetRubyVersion: 3.2
7
+ SuggestExtensions: false
8
+ Exclude:
9
+ - "bin/**/*"
10
+ - "sig/**/*"
11
+ - "vendor/**/*"
12
+ - "specs/**/*"
13
+ - "examples/**/*"
14
+ - "Gemfile"
15
+
16
+ # Gemspec の development dependency は gemspec 内で管理
17
+ Gemspec/DevelopmentDependencies:
18
+ Enabled: false
19
+
20
+ # 日本語コメントを許容
21
+ Style/AsciiComments:
22
+ Enabled: false
23
+
24
+ # frozen_string_literal は全ファイルで必須
25
+ Style/FrozenStringLiteralComment:
26
+ Enabled: true
27
+ EnforcedStyle: always
28
+
29
+ # プロジェクトの特性上、メソッドの行数制限を緩める
30
+ Metrics/MethodLength:
31
+ Max: 20
32
+
33
+ # CsvImporter のブロック長は許容
34
+ Metrics/BlockLength:
35
+ Exclude:
36
+ - "spec/**/*"
37
+ - "jp_address_complement.gemspec"
38
+
39
+ # モジュール・クラス長の上限を緩める(Repository 実装用)
40
+ Metrics/ClassLength:
41
+ Max: 150
42
+
43
+ # RSpec の describe/context は DSL の性質上緩める
44
+ RSpec/ExampleLength:
45
+ Max: 20
46
+
47
+ RSpec/MultipleExpectations:
48
+ Max: 5
49
+
50
+ RSpec/NestedGroups:
51
+ Max: 5
52
+
53
+ # Generator・タスク・パフォーマンステストはクラス記述不要
54
+ RSpec/DescribeClass:
55
+ Exclude:
56
+ - "spec/generators/**/*"
57
+ - "spec/tasks/**/*"
58
+ - "spec/performance_spec.rb"
59
+
60
+ # RSpec spec パスのディレクトリ構成を許容(spec/ 直下に rb ファイルを置きたい場合)
61
+ RSpec/SpecFilePathFormat:
62
+ Enabled: false
63
+
64
+ RSpec/SpecFilePathSuffix:
65
+ Enabled: false
66
+
67
+ # context の日本語記述の等を許容
68
+ RSpec/ContextWording:
69
+ Prefixes:
70
+ - when
71
+ - with
72
+ - without
73
+ - 正常な
74
+ - 不正な
75
+ - "nil"
76
+ - 先頭
77
+ - 7桁
78
+ - 4桁
79
+ - 8桁
80
+ - 同じ
81
+ - 異なる
82
+
83
+ # AddressRecord は Data.define の返り値で定数名規則を強制できない
84
+ Naming/ConstantName:
85
+ Exclude:
86
+ - "lib/jp_address_complement/address_record.rb"
87
+
88
+ # Gem エントリーポイントはトップレベルドキュメントを必須としない
89
+ Style/Documentation:
90
+ Exclude:
91
+ - "lib/jp_address_complement.rb"
92
+ - "spec/**/*"
93
+
94
+ # rbs-inline の #: Type 注釈は # の直後に : が来るため LeadingCommentSpace と競合(FR-010, T008)
95
+ Layout/LeadingCommentSpace:
96
+ Exclude:
97
+ - "lib/jp_address_complement/configuration.rb"
98
+ - "lib/jp_address_complement/importers/csv_importer.rb"
99
+ - "lib/jp_address_complement/normalizer.rb"
100
+ - "lib/jp_address_complement/version.rb"
101
+
102
+ # マジックコメント直後の空行: rbs_inline: disabled は 1 行で理由まで書くため空行を入れない(T008)
103
+ Layout/EmptyLineAfterMagicComment:
104
+ Exclude:
105
+ - "lib/jp_address_complement/address_record.rb"
106
+
107
+ # CsvImporter の parse_row は列数が多い CSV のパースのためやむを得ず複雑になる
108
+ Metrics/AbcSize:
109
+ Exclude:
110
+ - "lib/jp_address_complement/importers/csv_importer.rb"
111
+
112
+ Metrics/CyclomaticComplexity:
113
+ Exclude:
114
+ - "lib/jp_address_complement/importers/csv_importer.rb"
115
+
116
+ Metrics/PerceivedComplexity:
117
+ Exclude:
118
+ - "lib/jp_address_complement/importers/csv_importer.rb"
@@ -0,0 +1,130 @@
1
+ <!--
2
+ Sync Impact Report
3
+ ==================
4
+ Version change: 1.0.1 → 1.0.2
5
+ Bump type: PATCH(gem名 typo 修正・原則 IV にインポート戦略を追記)
6
+ Modified principles:
7
+ - I. Gem-First: gem名 typo修正 jp_address_Complement → jp_address_complement
8
+ - IV. データ整合性と定期更新: 差分インポート戦略・DB負荷最適化方针を追記
9
+ Added sections: none
10
+ Removed sections: none
11
+ Templates updated:
12
+ - .specify/templates/plan-template.md ✅ updated
13
+ - .specify/templates/spec-template.md ✅ (変更なし)
14
+ - .specify/templates/tasks-template.md ✅ (変更なし)
15
+ Deferred TODOs: none
16
+ -->
17
+
18
+ # JpAddressComplement Constitution
19
+
20
+ ## Core Principles
21
+
22
+ ### I. Gem-First (単一責務 gem 設計)
23
+
24
+ 本プロジェクトは Rails アプリケーションに組み込む単一目的の gem として設計する。
25
+ gem は自己完結し、独立してテスト・ドキュメント化できなければならない。
26
+ 機能追加の際は必ず「この gem の責務か」を問い、責務外の機能は含まない。
27
+
28
+ - gem 名は `jp_address_complement`、名前空間は `JpAddressComplement` に閉じ、外部名前空間を汚染しない。
29
+ - 外部依存は最小限とし、追加する場合は明確な理由を文書化する。
30
+ - Rails への結合は Railtie/Engine 経由のみとし、本体ロジックは Rails 非依存に保つ。
31
+
32
+ ### II. TDD 必須 (NON-NEGOTIABLE)
33
+
34
+ テストを先に書き、失敗を確認してから実装する。Red-Green-Refactor サイクルを厳守する。
35
+
36
+ - 実装コードより先にテストを書く。テストが失敗することを確認してから実装を始める。
37
+ - テストカバレッジは **90% 以上** を維持する(SimpleCov で計測)。
38
+ - ユニットテスト・統合テストを両方用意する。
39
+ - テストは意図を明確に示す記述でなければならない(`describe` / `context` / `it` の適切な使用)。
40
+
41
+ ### III. Rubocop 完全準拠 (NON-NEGOTIABLE)
42
+
43
+ すべてのコードは `rubocop` を 100% パスしなければならない。
44
+
45
+ - `# rubocop:disable` コメントの使用は **禁止**。
46
+ - Rubocop の設定変更(`.rubocop.yml`)で対処する場合は、その理由をコメントで明記する。
47
+ - CI/CD パイプラインで Rubocop チェックを必須ゲートとして設定する。
48
+ - PR マージ前に必ず Rubocop をパスすること。
49
+
50
+ ### IV. データ整合性と定期更新
51
+
52
+ 日本郵便が公開する郵便番号 CSV データを正確に取り込み・管理する。
53
+
54
+ - データソース URL(ZIP): https://www.post.japanpost.jp/zipcode/dl/oogaki/zip/ken_all.zip
55
+ - データの取り込みは冪等(同一データを重複投入してもデータが重複しない)でなければならない。
56
+ - 定期更新の仕組み(Rake タスク等)を提供し、最新データへの追従を可能とする。
57
+ - 文字コード(Shift-JIS → UTF-8 変換)や改行コードの差異を適切に処理する。
58
+
59
+ #### インポート戦略(DB 負荷最適化)
60
+
61
+ **基本方针: 差分インポートを強く推奨するが、負荷・運用コストを考慮して最適な手段を選択する。**
62
+
63
+ 1. **差分インポート(標準)**
64
+ - CSV 全件を読み込み、既存データとの差分(追加・変更・削除)のみ DB へ反映する。
65
+ - `INSERT ... ON CONFLICT DO UPDATE`(upsert)を活用し、変更がない行はスキップする。
66
+ - 削除検出は:削除フラグ列(`deleted_at`)もしくは「現在の全郵便番号セットに含まれない行を削除」で対応する。
67
+ - 大量 upsert はバッチ分割(例: 1,000件/バッチ)で実行し、ロック持続時間を最小化する。
68
+
69
+ 2. **全更新(フォールバック)**
70
+ - 初回セットアップ時、または差分検知機構が利用不可な場合に限り使用する。
71
+ - 全更新時は「一時テーブルへ載せ替え、アトミックに本テーブルと入れ替える」方式を検討する(ダウンタイムなし)。
72
+
73
+ 3. **差分検知の仕組み**
74
+ - 日本郵便が提供する差分データが利用可能な場合はそちらを優先する。
75
+ - 差分判定にはデータのチェックサム(MD5/SHA256)もしくはバージョン情報で変更の有無を判定する。
76
+ - 差分がない場合は DB への書き込みを全スキップする。
77
+
78
+ ### V. 機能要件の厳守
79
+
80
+ 提供する機能は以下の3つに限定し、各機能は明確なインターフェースを持つ。
81
+
82
+ 1. **郵便番号から住所取得**: 7桁の郵便番号(ハイフンあり・なし両対応)から住所を返す。
83
+ 2. **前方一致住所候補取得**: 郵便番号の先頭 4桁以上の入力で、対象となる住所候補一覧を返す。
84
+ 3. **郵便番号と住所の不一致検出**: 郵便番号と住所の組み合わせが正しいかを検証し、不一致の場合はその理由を返す。
85
+
86
+ - 各機能は引数バリデーションを行い、不正入力には明確な例外またはエラーオブジェクトを返す。
87
+ - 戻り値の型は一貫性を持たせる(nil ではなく空配列・Result オブジェクト等)。
88
+
89
+ ### VI. シンプルさ優先
90
+
91
+ 複雑さは価値によって正当化されなければならない。
92
+
93
+ - YAGNI(You Aren't Gonna Need It)原則を適用する。
94
+ - 抽象化は2つ以上のユースケースが存在してから導入する。
95
+ - 設計判断には必ず理由を文書化する。
96
+
97
+ ## Technology Standards
98
+
99
+ - **言語**: Ruby 3.x(3.2 以上を推奨)
100
+ - **対応フレームワーク**: Rails 7.x 以上
101
+ - **テストフレームワーク**: RSpec
102
+ - **カバレッジ計測**: SimpleCov(目標 90% 以上)
103
+ - **Lint**: RuboCop(100% 必須、disable 禁止)
104
+ - **gem 管理**: Bundler
105
+ - **データ形式**: 日本郵便oogaki CSV(Shift-JIS エンコード)
106
+ - **プロジェクト種別**: Ruby gem(Rails Engine)
107
+
108
+ ## Quality Gates
109
+
110
+ 各 PR・マージ前に以下をすべて満たすこと:
111
+
112
+ - [ ] `bundle exec rspec` が全テスト PASS
113
+ - [ ] `bundle exec rubocop` が PASS(警告・エラーゼロ、disable コメントなし)
114
+ - [ ] `SimpleCov` のカバレッジレポートで 90% 以上を確認
115
+ - [ ] 新機能・変更にはテストが付随している(TDD サイクルを経ていること)
116
+ - [ ] 公開 API の変更には CHANGELOG を更新
117
+
118
+ ## Governance
119
+
120
+ - この Constitution はプロジェクトのすべての開発慣行より優先される。
121
+ - 修正には以下が必要:変更内容の文書化・理由の明記・影響するテンプレート/タスクへの反映。
122
+ - 原則 II(TDD)・原則 III(Rubocop)は **絶対要件** であり、例外なく遵守する。
123
+ - すべての PR レビューでこの Constitution への準拠を確認する。
124
+ - 複雑さの追加は必ず正当化し、Complexity Tracking セクションに記録する。
125
+ - バージョニングポリシー:
126
+ - MAJOR: 後方互換性のない原則削除・再定義
127
+ - MINOR: 新原則追加・セクション追加
128
+ - PATCH: 表現の明確化・誤字修正・非意味的な改訂
129
+
130
+ **Version**: 1.0.2 | **Ratified**: 2026-02-22 | **Last Amended**: 2026-02-22
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # Consolidated prerequisite checking script
4
+ #
5
+ # This script provides unified prerequisite checking for Spec-Driven Development workflow.
6
+ # It replaces the functionality previously spread across multiple scripts.
7
+ #
8
+ # Usage: ./check-prerequisites.sh [OPTIONS]
9
+ #
10
+ # OPTIONS:
11
+ # --json Output in JSON format
12
+ # --require-tasks Require tasks.md to exist (for implementation phase)
13
+ # --include-tasks Include tasks.md in AVAILABLE_DOCS list
14
+ # --paths-only Only output path variables (no validation)
15
+ # --help, -h Show help message
16
+ #
17
+ # OUTPUTS:
18
+ # JSON mode: {"FEATURE_DIR":"...", "AVAILABLE_DOCS":["..."]}
19
+ # Text mode: FEATURE_DIR:... \n AVAILABLE_DOCS: \n ✓/✗ file.md
20
+ # Paths only: REPO_ROOT: ... \n BRANCH: ... \n FEATURE_DIR: ... etc.
21
+
22
+ set -e
23
+
24
+ # Parse command line arguments
25
+ JSON_MODE=false
26
+ REQUIRE_TASKS=false
27
+ INCLUDE_TASKS=false
28
+ PATHS_ONLY=false
29
+
30
+ for arg in "$@"; do
31
+ case "$arg" in
32
+ --json)
33
+ JSON_MODE=true
34
+ ;;
35
+ --require-tasks)
36
+ REQUIRE_TASKS=true
37
+ ;;
38
+ --include-tasks)
39
+ INCLUDE_TASKS=true
40
+ ;;
41
+ --paths-only)
42
+ PATHS_ONLY=true
43
+ ;;
44
+ --help|-h)
45
+ cat << 'EOF'
46
+ Usage: check-prerequisites.sh [OPTIONS]
47
+
48
+ Consolidated prerequisite checking for Spec-Driven Development workflow.
49
+
50
+ OPTIONS:
51
+ --json Output in JSON format
52
+ --require-tasks Require tasks.md to exist (for implementation phase)
53
+ --include-tasks Include tasks.md in AVAILABLE_DOCS list
54
+ --paths-only Only output path variables (no prerequisite validation)
55
+ --help, -h Show this help message
56
+
57
+ EXAMPLES:
58
+ # Check task prerequisites (plan.md required)
59
+ ./check-prerequisites.sh --json
60
+
61
+ # Check implementation prerequisites (plan.md + tasks.md required)
62
+ ./check-prerequisites.sh --json --require-tasks --include-tasks
63
+
64
+ # Get feature paths only (no validation)
65
+ ./check-prerequisites.sh --paths-only
66
+
67
+ EOF
68
+ exit 0
69
+ ;;
70
+ *)
71
+ echo "ERROR: Unknown option '$arg'. Use --help for usage information." >&2
72
+ exit 1
73
+ ;;
74
+ esac
75
+ done
76
+
77
+ # Source common functions
78
+ SCRIPT_DIR="$(CDPATH="" cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
79
+ source "$SCRIPT_DIR/common.sh"
80
+
81
+ # Get feature paths and validate branch
82
+ eval $(get_feature_paths)
83
+ check_feature_branch "$CURRENT_BRANCH" "$HAS_GIT" || exit 1
84
+
85
+ # If paths-only mode, output paths and exit (support JSON + paths-only combined)
86
+ if $PATHS_ONLY; then
87
+ if $JSON_MODE; then
88
+ # Minimal JSON paths payload (no validation performed)
89
+ printf '{"REPO_ROOT":"%s","BRANCH":"%s","FEATURE_DIR":"%s","FEATURE_SPEC":"%s","IMPL_PLAN":"%s","TASKS":"%s"}\n' \
90
+ "$REPO_ROOT" "$CURRENT_BRANCH" "$FEATURE_DIR" "$FEATURE_SPEC" "$IMPL_PLAN" "$TASKS"
91
+ else
92
+ echo "REPO_ROOT: $REPO_ROOT"
93
+ echo "BRANCH: $CURRENT_BRANCH"
94
+ echo "FEATURE_DIR: $FEATURE_DIR"
95
+ echo "FEATURE_SPEC: $FEATURE_SPEC"
96
+ echo "IMPL_PLAN: $IMPL_PLAN"
97
+ echo "TASKS: $TASKS"
98
+ fi
99
+ exit 0
100
+ fi
101
+
102
+ # Validate required directories and files
103
+ if [[ ! -d "$FEATURE_DIR" ]]; then
104
+ echo "ERROR: Feature directory not found: $FEATURE_DIR" >&2
105
+ echo "Run /speckit.specify first to create the feature structure." >&2
106
+ exit 1
107
+ fi
108
+
109
+ if [[ ! -f "$IMPL_PLAN" ]]; then
110
+ echo "ERROR: plan.md not found in $FEATURE_DIR" >&2
111
+ echo "Run /speckit.plan first to create the implementation plan." >&2
112
+ exit 1
113
+ fi
114
+
115
+ # Check for tasks.md if required
116
+ if $REQUIRE_TASKS && [[ ! -f "$TASKS" ]]; then
117
+ echo "ERROR: tasks.md not found in $FEATURE_DIR" >&2
118
+ echo "Run /speckit.tasks first to create the task list." >&2
119
+ exit 1
120
+ fi
121
+
122
+ # Build list of available documents
123
+ docs=()
124
+
125
+ # Always check these optional docs
126
+ [[ -f "$RESEARCH" ]] && docs+=("research.md")
127
+ [[ -f "$DATA_MODEL" ]] && docs+=("data-model.md")
128
+
129
+ # Check contracts directory (only if it exists and has files)
130
+ if [[ -d "$CONTRACTS_DIR" ]] && [[ -n "$(ls -A "$CONTRACTS_DIR" 2>/dev/null)" ]]; then
131
+ docs+=("contracts/")
132
+ fi
133
+
134
+ [[ -f "$QUICKSTART" ]] && docs+=("quickstart.md")
135
+
136
+ # Include tasks.md if requested and it exists
137
+ if $INCLUDE_TASKS && [[ -f "$TASKS" ]]; then
138
+ docs+=("tasks.md")
139
+ fi
140
+
141
+ # Output results
142
+ if $JSON_MODE; then
143
+ # Build JSON array of documents
144
+ if [[ ${#docs[@]} -eq 0 ]]; then
145
+ json_docs="[]"
146
+ else
147
+ json_docs=$(printf '"%s",' "${docs[@]}")
148
+ json_docs="[${json_docs%,}]"
149
+ fi
150
+
151
+ printf '{"FEATURE_DIR":"%s","AVAILABLE_DOCS":%s}\n' "$FEATURE_DIR" "$json_docs"
152
+ else
153
+ # Text output
154
+ echo "FEATURE_DIR:$FEATURE_DIR"
155
+ echo "AVAILABLE_DOCS:"
156
+
157
+ # Show status of each potential document
158
+ check_file "$RESEARCH" "research.md"
159
+ check_file "$DATA_MODEL" "data-model.md"
160
+ check_dir "$CONTRACTS_DIR" "contracts/"
161
+ check_file "$QUICKSTART" "quickstart.md"
162
+
163
+ if $INCLUDE_TASKS; then
164
+ check_file "$TASKS" "tasks.md"
165
+ fi
166
+ fi