@homebridge-plugins/homebridge-smarthq 0.5.0-beta.4 → 0.5.0-beta.40

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 (145) hide show
  1. package/.github/ISSUE_TEMPLATE/config.yml +1 -1
  2. package/.github/copilot-instructions.md +361 -0
  3. package/.github/scripts/branch-helper.sh +41 -0
  4. package/.github/workflows/beta-release.yml +1 -1
  5. package/.github/workflows/release.yml +53 -17
  6. package/CHANGELOG.md +563 -18
  7. package/MATTER.md +304 -0
  8. package/README.md +15 -0
  9. package/config.schema.json +24 -5
  10. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.d.ts.map +1 -1
  11. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js +3 -1
  12. package/dist/devices/OpalIceMaker/Managers/OpalDescaleSvcManager.js.map +1 -1
  13. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.d.ts.map +1 -1
  14. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js +3 -1
  15. package/dist/devices/OpalIceMaker/Managers/OpalFilterMaintenanceSvcManager.js.map +1 -1
  16. package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js +1 -1
  17. package/dist/devices/OpalIceMaker/Managers/OpalPowerSvcManager.js.map +1 -1
  18. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts +1 -1
  19. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.d.ts.map +1 -1
  20. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js +12 -5
  21. package/dist/devices/OpalIceMaker/Managers/OpalProgressSvcManager.js.map +1 -1
  22. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.d.ts.map +1 -1
  23. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js +4 -2
  24. package/dist/devices/OpalIceMaker/Managers/StatusManagers/OpalStatusBase.js.map +1 -1
  25. package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts +3 -4
  26. package/dist/devices/OpalIceMaker/OpalDeviceBase.d.ts.map +1 -1
  27. package/dist/devices/OpalIceMaker/OpalDeviceBase.js +3 -18
  28. package/dist/devices/OpalIceMaker/OpalDeviceBase.js.map +1 -1
  29. package/dist/devices/advantium.d.ts +10 -0
  30. package/dist/devices/advantium.d.ts.map +1 -0
  31. package/dist/devices/advantium.js +75 -0
  32. package/dist/devices/advantium.js.map +1 -0
  33. package/dist/devices/airConditioner.d.ts +11 -2
  34. package/dist/devices/airConditioner.d.ts.map +1 -1
  35. package/dist/devices/airConditioner.js +111 -17
  36. package/dist/devices/airConditioner.js.map +1 -1
  37. package/dist/devices/beverageCenter.d.ts +10 -0
  38. package/dist/devices/beverageCenter.d.ts.map +1 -0
  39. package/dist/devices/beverageCenter.js +125 -0
  40. package/dist/devices/beverageCenter.js.map +1 -0
  41. package/dist/devices/clothesDryer.d.ts +21 -0
  42. package/dist/devices/clothesDryer.d.ts.map +1 -0
  43. package/dist/devices/clothesDryer.js +273 -0
  44. package/dist/devices/clothesDryer.js.map +1 -0
  45. package/dist/devices/clothesWasher.d.ts +21 -0
  46. package/dist/devices/clothesWasher.d.ts.map +1 -0
  47. package/dist/devices/clothesWasher.js +284 -0
  48. package/dist/devices/clothesWasher.js.map +1 -0
  49. package/dist/devices/coffeeMaker.d.ts +10 -0
  50. package/dist/devices/coffeeMaker.d.ts.map +1 -0
  51. package/dist/devices/coffeeMaker.js +79 -0
  52. package/dist/devices/coffeeMaker.js.map +1 -0
  53. package/dist/devices/device.d.ts +108 -13
  54. package/dist/devices/device.d.ts.map +1 -1
  55. package/dist/devices/device.js +381 -60
  56. package/dist/devices/device.js.map +1 -1
  57. package/dist/devices/dishwasher.d.ts +9 -3
  58. package/dist/devices/dishwasher.d.ts.map +1 -1
  59. package/dist/devices/dishwasher.js +164 -29
  60. package/dist/devices/dishwasher.js.map +1 -1
  61. package/dist/devices/hood.d.ts +41 -0
  62. package/dist/devices/hood.d.ts.map +1 -0
  63. package/dist/devices/hood.js +336 -0
  64. package/dist/devices/hood.js.map +1 -0
  65. package/dist/devices/microwave.d.ts +19 -0
  66. package/dist/devices/microwave.d.ts.map +1 -0
  67. package/dist/devices/microwave.js +147 -0
  68. package/dist/devices/microwave.js.map +1 -0
  69. package/dist/devices/oven.d.ts +9 -2
  70. package/dist/devices/oven.d.ts.map +1 -1
  71. package/dist/devices/oven.js +267 -43
  72. package/dist/devices/oven.js.map +1 -1
  73. package/dist/devices/refrigerator.d.ts +37 -2
  74. package/dist/devices/refrigerator.d.ts.map +1 -1
  75. package/dist/devices/refrigerator.js +583 -34
  76. package/dist/devices/refrigerator.js.map +1 -1
  77. package/dist/devices/waterFilter.d.ts +10 -0
  78. package/dist/devices/waterFilter.d.ts.map +1 -0
  79. package/dist/devices/waterFilter.js +67 -0
  80. package/dist/devices/waterFilter.js.map +1 -0
  81. package/dist/devices/waterHeater.d.ts +19 -0
  82. package/dist/devices/waterHeater.d.ts.map +1 -0
  83. package/dist/devices/waterHeater.js +161 -0
  84. package/dist/devices/waterHeater.js.map +1 -0
  85. package/dist/devices/waterSoftener.d.ts +10 -0
  86. package/dist/devices/waterSoftener.d.ts.map +1 -0
  87. package/dist/devices/waterSoftener.js +67 -0
  88. package/dist/devices/waterSoftener.js.map +1 -0
  89. package/dist/getAccessToken.d.ts.map +1 -1
  90. package/dist/getAccessToken.js +190 -2
  91. package/dist/getAccessToken.js.map +1 -1
  92. package/dist/platform.d.ts +32 -1
  93. package/dist/platform.d.ts.map +1 -1
  94. package/dist/platform.js +853 -151
  95. package/dist/platform.js.map +1 -1
  96. package/dist/platform.test.d.ts +2 -0
  97. package/dist/platform.test.d.ts.map +1 -0
  98. package/dist/platform.test.js +80 -0
  99. package/dist/platform.test.js.map +1 -0
  100. package/dist/settings.d.ts +24 -0
  101. package/dist/settings.d.ts.map +1 -1
  102. package/dist/settings.js +13 -0
  103. package/dist/settings.js.map +1 -1
  104. package/docs/assets/highlight.css +7 -0
  105. package/docs/assets/main.js +5 -5
  106. package/docs/assets/navigation.js +1 -0
  107. package/docs/assets/search.js +1 -0
  108. package/docs/assets/style.css +248 -226
  109. package/docs/classes/SmartHQPlatform.html +54 -56
  110. package/docs/hierarchy.html +1 -0
  111. package/docs/index.html +22 -12
  112. package/docs/interfaces/DeviceOptions.html +2 -3
  113. package/docs/interfaces/SmartHQPlatformConfig.html +6 -17
  114. package/docs/interfaces/SmartHqContext.html +6 -4
  115. package/docs/interfaces/SmartHqERDResponse.html +7 -8
  116. package/docs/interfaces/credentials.html +3 -4
  117. package/docs/interfaces/devicesConfig.html +9 -8
  118. package/docs/interfaces/options.html +7 -8
  119. package/docs/media/copilot-instructions.md +361 -0
  120. package/docs/modules.html +1 -2
  121. package/docs/variables/API_URL.html +1 -2
  122. package/docs/variables/ERD_CODES.html +1 -2
  123. package/docs/variables/ERD_TYPES.html +1 -2
  124. package/docs/variables/KEEPALIVE_TIMEOUT.html +1 -2
  125. package/docs/variables/LOGIN_URL.html +2 -3
  126. package/docs/variables/OAUTH2_CLIENT_ID.html +1 -2
  127. package/docs/variables/OAUTH2_CLIENT_SECRET.html +1 -2
  128. package/docs/variables/OAUTH2_REDIRECT_URI.html +1 -2
  129. package/docs/variables/PLATFORM_NAME.html +2 -3
  130. package/docs/variables/PLUGIN_NAME.html +2 -3
  131. package/docs/variables/SECURE_URL.html +2 -3
  132. package/docs/variables/default.html +1 -0
  133. package/package.json +22 -33
  134. package/typedoc.json +0 -4
  135. package/vitest.config.ts +6 -5
  136. package/.github/workflows/build.yml +0 -18
  137. package/.github/workflows/changerelease.yml +0 -11
  138. package/.github/workflows/labeler.yml +0 -9
  139. package/.github/workflows/release-drafter.yml +0 -14
  140. package/docs/assets/dmt/dmt-component-data.js +0 -1
  141. package/docs/assets/dmt/dmt-components.css +0 -20
  142. package/docs/assets/dmt/dmt-components.js +0 -67
  143. package/docs/assets/dmt/dmt-search.cmp +0 -0
  144. package/docs/assets/dmt/dmt-theme.css +0 -1
  145. package/docs/functions/default.html +0 -2
@@ -1,4 +1,4 @@
1
- blank_issues_enabled: false
1
+ blank_issues_enabled: true
2
2
  contact_links:
3
3
  - name: Homebridge Discord Channel for SmartHQ
4
4
  url: https://discord.gg/8fpZA4S
@@ -0,0 +1,361 @@
1
+ # GitHub Copilot Instructions for homebridge-smarthq
2
+
3
+ Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
4
+
5
+ ## Branch Management and PR Workflow
6
+
7
+ ### Current Project State
8
+
9
+ - **Stable branch**: `latest` (version 0.4.0)
10
+ - **Active beta branch**: `beta-0.5.0` (currently at v0.5.0-beta.4)
11
+ - **Main development**: All new features and non-critical fixes should target `beta-0.5.0`
12
+ - **Critical patches**: For urgent fixes to stable release, may target new `beta-0.4.x` branch
13
+
14
+ ### Branch Targeting Requirements
15
+
16
+ All pull requests **MUST** be directed to a beta branch first, never directly to the main branch (`latest`). This ensures proper testing and gradual release management.
17
+
18
+ ### Beta Branch Creation
19
+
20
+ If no appropriate beta branch exists, create one based on the next possible version using semantic versioning:
21
+
22
+ 1. **Current stable version**: Check `package.json` in the `latest` branch for the current stable version (currently 0.4.0)
23
+ 2. **Current beta version**: Check if `beta-0.5.0` exists and is active (currently has v0.5.0-beta.4)
24
+ 3. **Determine next version** based on change type:
25
+ - **Patch** (bug fixes): If working on 0.4.x patches → create `beta-0.4.1`
26
+ - **Minor** (new features): Use existing `beta-0.5.0` or create next minor version
27
+ - **Major** (breaking changes): 1.0.0 → create `beta-1.0.0`
28
+
29
+ 4. **Create beta branch** from the latest stable branch (if needed):
30
+ ```bash
31
+ git fetch origin
32
+ git checkout latest
33
+ git pull origin latest
34
+ git checkout -b beta-X.Y.Z
35
+ git push origin beta-X.Y.Z
36
+ ```
37
+
38
+ **Current Status**: `beta-0.5.0` branch exists and is active with several beta releases (v0.5.0-beta.1 through v0.5.0-beta.4)
39
+
40
+ ### Required Labels Before Assignment
41
+
42
+ Before assigning any issue to Copilot, the following labels **MUST** be set to determine the semantic version increment:
43
+
44
+ - **`patch`** - For bug fixes, security patches, documentation updates, and other non-feature changes
45
+ - **`minor`** - For new features, enhancements, and backwards-compatible additions
46
+ - **`major`** - For breaking changes, API changes, and backwards-incompatible modifications
47
+
48
+ ### PR Workflow
49
+
50
+ 1. **Check for appropriate beta branch**: Look for existing beta branches that match the intended version
51
+ 2. **Create beta branch if needed**: If no appropriate beta branch exists, create one as described above
52
+ 3. **Target the beta branch**: Always target PRs to the beta branch, not `latest`
53
+ 4. **Use semantic versioning**: Ensure the target beta branch version aligns with the change type (patch/minor/major)
54
+
55
+ ### Branch Naming Convention
56
+
57
+ - Main development branch: `latest`
58
+ - Beta branches: `beta-X.Y.Z` (e.g., `beta-0.5.0`, `beta-0.4.1`, `beta-1.0.0`)
59
+ - Feature branches: Follow standard naming (e.g., `feature/add-support-for-xyz`, `fix/bug-description`)
60
+
61
+ ### Release Process
62
+
63
+ 1. **Beta releases**: PRs merge to beta branches → trigger beta release workflow
64
+ 2. **Stable releases**: Beta branches merge to `latest` → trigger main release workflow
65
+
66
+ ### Examples
67
+
68
+ #### For a Bug Fix (patch):
69
+ - Label: `patch`
70
+ - Target branch: `beta-0.4.1` (for patches to stable 0.4.0) or `beta-0.5.0` (for patches to upcoming 0.5.0)
71
+ - If targeting patches to stable release, create `beta-0.4.1` from `latest`
72
+ - If targeting current development, use existing `beta-0.5.0`
73
+
74
+ #### For a New Feature (minor):
75
+ - Label: `minor`
76
+ - Target branch: `beta-0.5.0` (currently active beta branch)
77
+ - Use existing `beta-0.5.0` branch which is actively receiving minor updates
78
+
79
+ #### For Breaking Changes (major):
80
+ - Label: `major`
81
+ - Target branch: `beta-1.0.0` (if current beta is 0.5.0)
82
+ - Create `beta-1.0.0` from current `beta-0.5.0` or `latest` as appropriate
83
+
84
+ ### Validation
85
+
86
+ Before creating any PR, ensure:
87
+ - [ ] Appropriate label (patch/minor/major) is set on the issue
88
+ - [ ] Target beta branch exists or has been created
89
+ - [ ] Beta branch version matches the semantic version implied by the label
90
+ - [ ] All changes are focused and minimal for the specific issue being addressed
91
+
92
+ This workflow ensures proper version management, thorough testing through beta releases, and maintains stability of the main codebase.
93
+
94
+ ---
95
+
96
+ ## Working Effectively
97
+
98
+ ### Bootstrap, Build, and Test the Repository
99
+
100
+ - Install dependencies: `npm install` -- takes 45 seconds. Wait for completion.
101
+ - Build the plugin: `npm run build` -- takes 6 seconds. NEVER CANCEL. Set timeout to 15+ seconds.
102
+ - Test the plugin: `npm run test` -- takes 2 seconds. NEVER CANCEL. Set timeout to 10+ seconds.
103
+ - Lint the code: `npm run lint` -- takes 3 seconds. NEVER CANCEL. Set timeout to 10+ seconds.
104
+ - Generate documentation: `npm run docs` -- takes 7 seconds. NEVER CANCEL. Set timeout to 15+ seconds.
105
+
106
+ ### Additional Development Commands
107
+
108
+ - Check for outdated dependencies: `npm run check` -- runs install + outdated check
109
+ - Watch mode for development: `npm run watch` -- builds, copies UI files, creates symlink, starts nodemon
110
+ - Test with coverage: `npm run test-coverage` -- runs tests with coverage report
111
+ - Watch tests continuously: `npm run test:watch` -- runs tests in watch mode
112
+ - Lint documentation: `npm run docs:lint` -- validates TypeDoc generation without output
113
+ - Apply docs theme: `npm run docs:theme` -- generates docs with default-modern theme
114
+
115
+ ### Pre-publication Commands (for maintainers)
116
+
117
+ - `npm run prepublishOnly` -- runs full validation: lint + build + UI + docs + docs:lint + docs:theme
118
+ - `npm run postpublish` -- cleans build artifacts after publishing
119
+
120
+ ### Node.js and Environment Requirements
121
+
122
+ - Node.js version: 20+ or 22+ or 24+ (currently using v20.19.4)
123
+ - npm version: 10+ (currently using v10.8.2)
124
+ - Homebridge version: 1.9.0+ or 2.0.0+
125
+ - Platform: Linux/macOS/Windows
126
+
127
+ ## Validation
128
+
129
+ ### Essential Pre-Commit Validation Steps
130
+
131
+ ALWAYS run these commands before committing changes to ensure CI passes:
132
+
133
+ - `npm run lint` -- must pass with zero errors
134
+ - `npm run build` -- must complete successfully
135
+ - `npm run test` -- tests should pass (network errors in sandbox are expected)
136
+
137
+ ### Manual Testing Scenarios
138
+
139
+ After making code changes to the plugin:
140
+
141
+ - Verify the plugin builds without errors: `npm run build`
142
+ - Check that TypeScript compilation produces no errors
143
+ - Ensure UI files are copied to dist/homebridge-ui/public/
144
+ - Validate that the plugin exports are correct in dist/index.js
145
+ - Test that config schema validation works for required credentials
146
+ - Verify plugin registration: check that PLUGIN_NAME and PLATFORM_NAME constants are exported
147
+ - Validate TypeScript declaration files (.d.ts) are generated properly
148
+ - Test path alias resolution works (e.g., @opal/* imports resolve correctly)
149
+
150
+ ### Expected Test Behavior
151
+
152
+ - Tests run with Vitest and should complete in ~2 seconds
153
+ - Network errors (ENOTFOUND accounts.brillion.geappliances.com) are EXPECTED in sandbox environments
154
+ - Tests validate plugin registration and settings functionality
155
+ - Test files: src/index.test.ts, src/settings.test.ts
156
+
157
+ ## Project Structure and Key Locations
158
+
159
+ ### Source Code Organization
160
+
161
+ - `/src/` -- TypeScript source code
162
+ - `/src/index.ts` -- main plugin entry point
163
+ - `/src/platform.ts` -- SmartHQPlatform class (main plugin logic)
164
+ - `/src/settings.ts` -- configuration constants and types
165
+ - `/src/devices/` -- device-specific implementations
166
+ - `/src/homebridge-ui/` -- custom Homebridge UI components
167
+ - `/dist/` -- compiled JavaScript output (generated by build)
168
+ - `/docs/` -- TypeDoc generated documentation
169
+ - `/node_modules/` -- npm dependencies (excluded from git)
170
+
171
+ ### Key Device Types Supported
172
+
173
+ - Opal Ice Maker (primary device with scheduling and notifications)
174
+ - Air Conditioner
175
+ - Dishwasher
176
+ - Oven
177
+ - Refrigerator
178
+
179
+ ### Configuration Files
180
+
181
+ - `package.json` -- project metadata, dependencies, and npm scripts
182
+ - `tsconfig.json` -- TypeScript compiler configuration
183
+ - `eslint.config.js` -- ESLint configuration using @antfu/eslint-config
184
+ - `vitest.config.ts` -- test runner configuration
185
+ - `config.schema.json` -- Homebridge plugin configuration schema
186
+ - `typedoc.json` -- documentation generation settings
187
+
188
+ ### Build System Details
189
+
190
+ - TypeScript compiler (tsc) with path aliases using tsc-alias
191
+ - Path aliases: `@opal/*` maps to `src/devices/OpalIceMaker/*`
192
+ - Output target: ES2022 modules in dist/ directory
193
+ - Source maps and declaration files generated
194
+ - Custom UI files copied from src/homebridge-ui/public/ to dist/homebridge-ui/public/
195
+
196
+ ## Timing Expectations and Timeouts
197
+
198
+ ### Command Timing (Add 50% buffer for timeouts)
199
+
200
+ - `npm install` -- 45 seconds (timeout: 120 seconds)
201
+ - `npm run build` -- 6 seconds (timeout: 15 seconds)
202
+ - `npm run test` -- 2 seconds (timeout: 10 seconds)
203
+ - `npm run lint` -- 3 seconds (timeout: 10 seconds)
204
+ - `npm run docs` -- 7 seconds (timeout: 15 seconds)
205
+ - `npm run clean` -- instant (timeout: 5 seconds)
206
+
207
+ ### CRITICAL TIMEOUT WARNINGS
208
+
209
+ - NEVER CANCEL any build or test command before the specified timeout
210
+ - Build may appear to hang during TypeScript compilation - this is normal
211
+ - Test network errors (DNS failures) are expected in sandbox environments
212
+
213
+ ## Common Troubleshooting
214
+
215
+ ### Build Issues
216
+
217
+ - If build fails, run `npm run clean` first to remove old artifacts
218
+ - Ensure Node.js version meets requirements (20+)
219
+ - Check that all dependencies are installed with `npm install`
220
+
221
+ ### Test Issues
222
+
223
+ - Network errors during tests are expected in restricted environments
224
+ - Focus on test logic validation rather than network connectivity
225
+ - Tests should pass their core assertions despite unhandled network rejections
226
+
227
+ ### Linting Issues
228
+
229
+ - Run `npm run lint:fix` to auto-fix many ESLint issues
230
+ - Common rules: curly braces, import sorting, unused variables
231
+ - Style guide enforces 1TBS brace style and consistent quote props
232
+
233
+ ## Plugin-Specific Development Notes
234
+
235
+ ### Homebridge Integration
236
+
237
+ - Plugin implements DynamicPlatformPlugin interface
238
+ - Registers as platform plugin with name "SmartHQ"
239
+ - Custom UI provided via homebridge-ui subdirectory
240
+ - Configuration schema supports credentials and device options
241
+
242
+ ### SmartHQ API Integration
243
+
244
+ - Connects to GE Appliances SmartHQ cloud service
245
+ - Handles OAuth2 authentication flow
246
+ - Manages WebSocket connections for real-time updates
247
+ - Supports device scheduling and notification management
248
+
249
+ ### Device Implementation Pattern
250
+
251
+ - Base device class in `/src/devices/device.ts`
252
+ - Device-specific classes extend base functionality
253
+ - ERD (Electronic Recipe Data) codes define device capabilities
254
+ - Platform registers accessories dynamically based on discovered devices
255
+
256
+ ## CI/CD Integration
257
+
258
+ ### GitHub Workflows
259
+
260
+ - Build workflow runs on push to latest branch and PRs
261
+ - Uses homebridge organization's reusable workflows
262
+ - Validates: build success, linting compliance, test execution
263
+ - Automated releases via changesets and GitHub Actions
264
+
265
+ ### Quality Gates
266
+
267
+ - ESLint must pass with zero errors
268
+ - TypeScript compilation must succeed
269
+ - All tests must pass (ignoring expected network errors)
270
+ - Documentation generation must complete successfully
271
+
272
+ Always validate your changes against these criteria before pushing to ensure CI success.
273
+
274
+
275
+ ### Current Project State
276
+
277
+ - **Stable branch**: `latest` (version 0.4.0)
278
+ - **Active beta branch**: `beta-0.5.0` (currently at v0.5.0-beta.4)
279
+ - **Main development**: All new features and non-critical fixes should target `beta-0.5.0`
280
+ - **Critical patches**: For urgent fixes to stable release, may target new `beta-0.4.x` branch
281
+
282
+ ### Branch Targeting Requirements
283
+
284
+ All pull requests **MUST** be directed to a beta branch first, never directly to the main branch (`latest`). This ensures proper testing and gradual release management.
285
+
286
+ ### Beta Branch Creation
287
+
288
+ If no appropriate beta branch exists, create one based on the next possible version using semantic versioning:
289
+
290
+ 1. **Current stable version**: Check `package.json` in the `latest` branch for the current stable version (currently 0.4.0)
291
+ 2. **Current beta version**: Check if `beta-0.5.0` exists and is active (currently has v0.5.0-beta.4)
292
+ 3. **Determine next version** based on change type:
293
+ - **Patch** (bug fixes): If working on 0.4.x patches → create `beta-0.4.1`
294
+ - **Minor** (new features): Use existing `beta-0.5.0` or create next minor version
295
+ - **Major** (breaking changes): 1.0.0 → create `beta-1.0.0`
296
+
297
+ 4. **Create beta branch** from the latest stable branch (if needed):
298
+ ```bash
299
+ git fetch origin
300
+ git checkout latest
301
+ git pull origin latest
302
+ git checkout -b beta-X.Y.Z
303
+ git push origin beta-X.Y.Z
304
+ ```
305
+
306
+ **Current Status**: `beta-0.5.0` branch exists and is active with several beta releases (v0.5.0-beta.1 through v0.5.0-beta.4)
307
+
308
+ ### Required Labels Before Assignment
309
+
310
+ Before assigning any issue to Copilot, the following labels **MUST** be set to determine the semantic version increment:
311
+
312
+ - **`patch`** - For bug fixes, security patches, documentation updates, and other non-feature changes
313
+ - **`minor`** - For new features, enhancements, and backwards-compatible additions
314
+ - **`major`** - For breaking changes, API changes, and backwards-incompatible modifications
315
+
316
+ ### PR Workflow
317
+
318
+ 1. **Check for appropriate beta branch**: Look for existing beta branches that match the intended version
319
+ 2. **Create beta branch if needed**: If no appropriate beta branch exists, create one as described above
320
+ 3. **Target the beta branch**: Always target PRs to the beta branch, not `latest`
321
+ 4. **Use semantic versioning**: Ensure the target beta branch version aligns with the change type (patch/minor/major)
322
+
323
+ ### Branch Naming Convention
324
+
325
+ - Main development branch: `latest`
326
+ - Beta branches: `beta-X.Y.Z` (e.g., `beta-0.5.0`, `beta-0.4.1`, `beta-1.0.0`)
327
+ - Feature branches: Follow standard naming (e.g., `feature/add-support-for-xyz`, `fix/bug-description`)
328
+
329
+ ### Release Process
330
+
331
+ 1. **Beta releases**: PRs merge to beta branches → trigger beta release workflow
332
+ 2. **Stable releases**: Beta branches merge to `latest` → trigger main release workflow
333
+
334
+ ### Examples
335
+
336
+ #### For a Bug Fix (patch):
337
+ - Label: `patch`
338
+ - Target branch: `beta-0.4.1` (for patches to stable 0.4.0) or `beta-0.5.0` (for patches to upcoming 0.5.0)
339
+ - If targeting patches to stable release, create `beta-0.4.1` from `latest`
340
+ - If targeting current development, use existing `beta-0.5.0`
341
+
342
+ #### For a New Feature (minor):
343
+ - Label: `minor`
344
+ - Target branch: `beta-0.5.0` (currently active beta branch)
345
+ - Use existing `beta-0.5.0` branch which is actively receiving minor updates
346
+
347
+ #### For Breaking Changes (major):
348
+ - Label: `major`
349
+ - Target branch: `beta-1.0.0` (if current beta is 0.5.0)
350
+ - Create `beta-1.0.0` from current `beta-0.5.0` or `latest` as appropriate
351
+
352
+ ### Validation
353
+
354
+ Before creating any PR, ensure:
355
+ - [ ] Appropriate label (patch/minor/major) is set on the issue
356
+ - [ ] Target beta branch exists or has been created
357
+ - [ ] Beta branch version matches the semantic version implied by the label
358
+ - [ ] All changes are focused and minimal for the specific issue being addressed
359
+
360
+ This workflow ensures proper version management, thorough testing through beta releases, and maintains stability of the main codebase.
361
+
@@ -0,0 +1,41 @@
1
+ #!/bin/bash
2
+
3
+ # Branch Target Helper for homebridge-smarthq
4
+ # This script helps determine which beta branch to target based on change type
5
+
6
+ echo "🏠 Homebridge SmartHQ - Branch Target Helper"
7
+ echo "==========================================="
8
+ echo
9
+
10
+ # Ensure we have the latest remote info
11
+ git fetch origin >/dev/null 2>&1
12
+
13
+ # Get current versions
14
+ STABLE_VERSION=$(git show latest:package.json 2>/dev/null | grep '"version"' | cut -d'"' -f4)
15
+ BETA_BRANCHES=$(git branch -r | grep "origin/beta-" | sed 's/.*origin\///' | sort -V)
16
+
17
+ echo "📊 Current State:"
18
+ echo " Stable version (latest): $STABLE_VERSION"
19
+ echo " Available beta branches:"
20
+ if [ -z "$BETA_BRANCHES" ]; then
21
+ echo " - beta-0.5.0 (active development - v0.5.0-beta.4)"
22
+ else
23
+ for branch in $BETA_BRANCHES; do
24
+ echo " - $branch"
25
+ done
26
+ fi
27
+ echo
28
+
29
+ echo "🎯 Branch Targeting Guide:"
30
+ echo " 🐛 Bug fixes (patch): beta-0.4.1 (patches) or beta-0.5.0 (development)"
31
+ echo " ✨ New features (minor): beta-0.5.0 (active development)"
32
+ echo " 💥 Breaking changes: beta-1.0.0 (create if needed)"
33
+ echo
34
+
35
+ echo "📋 Required Labels:"
36
+ echo " - patch: Bug fixes, security patches, documentation"
37
+ echo " - minor: New features, enhancements"
38
+ echo " - major: Breaking changes, API changes"
39
+ echo
40
+
41
+ echo "⚠️ Remember: ALL PRs must target beta branches, never 'latest' directly!"
@@ -52,4 +52,4 @@ jobs:
52
52
  Version `v${{ needs.publish.outputs.NPM_VERSION }}`
53
53
  url: "https://github.com/homebridge-plugins/homebridge-smarthq/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
54
54
  secrets:
55
- DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA || secrets.DISCORD_WEBHOOK_URL_LATEST }}
55
+ DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_BETA || secrets.DISCORD_WEBHOOK_URL_LATEST }}
@@ -1,35 +1,71 @@
1
- name: Release
1
+ name: Unified Release
2
2
 
3
3
  on:
4
- release:
5
- types: [published]
4
+ push:
5
+ branches:
6
+ #- "alpha-*"
7
+ #- "beta-*"
8
+ - latest
9
+ workflow_dispatch:
6
10
 
7
11
  jobs:
8
- build_and_test:
9
- uses: homebridge/.github/.github/workflows/nodejs-build-and-test.yml@latest
12
+ # 1️⃣ Determine release type, ESM status, and branch name
13
+ determine-release-type:
14
+ uses: homebridge/.github/.github/workflows/determine-release-type.yml@latest
10
15
  with:
11
- enable_coverage: false
12
- secrets:
13
- token: ${{ secrets.GITHUB_TOKEN }}
16
+ ref_name: ${{ github.ref_name }}
17
+
18
+ # 2️⃣ Update version and changelog using the scripts
19
+ update-version:
20
+ needs: determine-release-type
21
+ uses: homebridge/.github/.github/workflows/update-version.yml@latest
22
+ with:
23
+ release_type: ${{ needs.determine-release-type.outputs.release_type }}
24
+ is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
14
25
 
15
- publish:
16
- needs: build_and_test
17
- if: ${{ github.repository == 'homebridge-plugins/homebridge-smarthq' }}
26
+ # 3️⃣ Publish to NPM and create GitHub release
27
+ publish-release:
28
+ needs: [determine-release-type, update-version]
18
29
  permissions:
19
30
  id-token: write
20
- uses: homebridge/.github/.github/workflows/npm-publish-esm.yml@latest
31
+ contents: write
32
+ uses: homebridge/.github/.github/workflows/publish-release.yml@latest
33
+ with:
34
+ release_type: ${{ needs.determine-release-type.outputs.release_type }}
35
+ version: ${{ needs.update-version.outputs.version }}
36
+ is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
21
37
  secrets:
22
- npm_auth_token: ${{ secrets.npm_token }}
38
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39
+
40
+ # 4️⃣ Promote branch if this is a prerelease (alpha/beta)
41
+ promote-branch:
42
+ needs: [determine-release-type, publish-release]
43
+ if: ${{ needs.determine-release-type.outputs.release_type != 'latest' && needs.determine-release-type.outputs.release_type != 'skip' }}
44
+ uses: homebridge/.github/.github/workflows/promote-branch.yml@latest
45
+ with:
46
+ branch_name: ${{ needs.determine-release-type.outputs.branch_name }}
47
+ release_type: ${{ needs.determine-release-type.outputs.release_type }}
48
+ is_esm: ${{ needs.determine-release-type.outputs.is_esm == 'true' }}
49
+
50
+ # 5️⃣ Notify if any previous job fails
51
+ workflow-failure:
52
+ if: ${{ failure() }}
53
+ needs: [determine-release-type, update-version, publish-release, promote-branch]
54
+ uses: homebridge/.github/.github/workflows/report-failure.yml@latest
55
+ with:
56
+ workflow_name: ${{ github.workflow }}
57
+ job_name: ${{ github.job }}
58
+ run_url: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
23
59
 
60
+ # 6️⃣ Post to Discord
24
61
  github-releases-to-discord:
25
62
  name: Discord Webhooks
26
- needs: [build_and_test,publish]
27
- if: ${{ github.repository == 'homebridge-plugins/homebridge-smarthq' }}
63
+ needs: [determine-release-type, update-version, publish-release]
28
64
  uses: homebridge/.github/.github/workflows/discord-webhooks.yml@latest
29
65
  with:
30
66
  title: "SmartHQ Release"
31
67
  description: |
32
- Version `v${{ needs.publish.outputs.NPM_VERSION }}`
33
- url: "https://github.com/homebridge-plugins/homebridge-smarthq/releases/tag/v${{ needs.publish.outputs.NPM_VERSION }}"
68
+ Version `v${{ needs.update-version.outputs.version }}`
69
+ url: "https://github.com/homebridge-plugins/homebridge-smarthq/releases/tag/v${{ needs.update-version.outputs.version }}"
34
70
  secrets:
35
71
  DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_URL_LATEST }}