|
| 1 | +#Homebridge GitHub Organization Configuration Repository |
| 2 | + |
| 3 | +This repository contains GitHub organization configuration files, reusable workflows, community health files, and npm version management scripts for the Homebridge organization. It is NOT a traditional application or library - it contains no source code to build or run. |
| 4 | + |
| 5 | +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. |
| 6 | + |
| 7 | +##Working Effectively |
| 8 | + |
| 9 | +**CRITICAL**: This repository has NO traditional build process. There is no package.json, no source code compilation, and no application to run. Instead, focus on validating configuration files and scripts. |
| 10 | + |
| 11 | +###Prerequisites and Dependencies |
| 12 | +- Node.js 20.19.4+ (verify with`node --version`) |
| 13 | +- npm 10.8.2+ (verify with`npm --version`) |
| 14 | +- yamllint (for YAML validation) |
| 15 | +- markdownlint-cli (install with`npm install -g markdownlint-cli`) |
| 16 | + |
| 17 | +###Repository Structure Validation |
| 18 | +- Validate YAML workflow files:`yamllint .github/workflows/*.yml` -- takes 1-2 seconds. NEVER CANCEL. |
| 19 | +- Validate JavaScript syntax:`node -c .github/npm-version-script.js && node -c .github/npm-version-script-esm.js` -- takes 1-2 seconds. |
| 20 | +- Validate Markdown files:`markdownlint *.md profile/*.md` -- takes 1-2 seconds. |
| 21 | + |
| 22 | +###Testing NPM Version Scripts |
| 23 | +```bash |
| 24 | +# Test CommonJS version |
| 25 | +cd /tmp&& mkdir test-npm-script&&cd test-npm-script |
| 26 | +echo'{"name": "@homebridge/test", "version": "1.0.0"}'> package.json |
| 27 | +echo'{"version": "1.0.0"}'> package-lock.json |
| 28 | +node /path/to/.github/npm-version-script.js refs/heads/beta-1.2.3 beta |
| 29 | + |
| 30 | +# Test ESM version |
| 31 | +cd /tmp&& mkdir test-npm-script-esm&&cd test-npm-script-esm |
| 32 | +echo'{"name": "@homebridge/test-esm", "version": "2.0.0", "type": "module"}'> package.json |
| 33 | +echo'{"version": "2.0.0"}'> package-lock.json |
| 34 | +node /path/to/.github/npm-version-script-esm.js refs/heads/alpha-2.1.0 alpha |
| 35 | +``` |
| 36 | +Time expectation: 1-2 seconds each. NEVER CANCEL. |
| 37 | + |
| 38 | +##Validation Requirements |
| 39 | + |
| 40 | +**CRITICAL VALIDATION**: Before making any changes to workflow files or scripts: |
| 41 | + |
| 42 | +1.**YAML Syntax Check**:`yamllint .github/workflows/*.yml` |
| 43 | +- Expected warnings: missing document start, line length violations |
| 44 | +- Expected errors: indentation issues, trailing spaces |
| 45 | +- Time: 1-2 seconds. NEVER CANCEL. |
| 46 | + |
| 47 | +2.**JavaScript Syntax Check**:`node -c .github/npm-version-script.js && node -c .github/npm-version-script-esm.js` |
| 48 | +- Should exit with code 0 (success) |
| 49 | +- Time: 1-2 seconds. NEVER CANCEL. |
| 50 | + |
| 51 | +3.**Markdown Validation**:`markdownlint *.md profile/*.md` |
| 52 | +- Expected warnings: line length violations, HTML elements |
| 53 | +- Time: 1-2 seconds. NEVER CANCEL. |
| 54 | + |
| 55 | +###Manual Testing Scenarios |
| 56 | +After making changes to npm version scripts: |
| 57 | +1. Create a temporary test directory with dummy package.json |
| 58 | +2. Run the script with test branch name format:`refs/heads/beta-1.2.3` |
| 59 | +3. Verify the script processes the branch name correctly |
| 60 | +4. Check that version updates are applied to package.json |
| 61 | + |
| 62 | +##Repository Contents |
| 63 | + |
| 64 | +###Reusable GitHub Workflows (`.github/workflows/`) |
| 65 | +-`nodejs-build-and-test.yml` - Node.js build and test workflow |
| 66 | +-`eslint.yml` - ESLint linting workflow |
| 67 | +-`npm-publish.yml` - NPM package publishing workflow |
| 68 | +-`npm-publish-esm.yml` - NPM ESM package publishing workflow |
| 69 | +-`lint-docs.yml` - TypeDoc documentation linting |
| 70 | +- And 9 additional specialized workflows |
| 71 | + |
| 72 | +###Community Health Files |
| 73 | +-`README.md` - Organization overview and workflow usage examples |
| 74 | +-`CONTRIBUTING.md` - Contribution guidelines (Node 20 LTS requirement) |
| 75 | +-`SECURITY.md` - Security reporting instructions |
| 76 | +-`profile/README.md` - GitHub organization profile |
| 77 | + |
| 78 | +###NPM Version Management Scripts |
| 79 | +-`.github/npm-version-script.js` - CommonJS version script |
| 80 | +-`.github/npm-version-script-esm.js` - ESM version script |
| 81 | + |
| 82 | +###Issue Templates (`.github/ISSUE_TEMPLATE/`) |
| 83 | +- Bug report, feature request, support request, and experimental change templates |
| 84 | + |
| 85 | +##Key Validation Points |
| 86 | + |
| 87 | +**CRITICAL FILE COUNTS**: |
| 88 | +- Total files: 32 (excluding .git directory) |
| 89 | +- Workflow files: 14 |
| 90 | +- .github directory files: 27 (includes workflows, templates, scripts) |
| 91 | +- Do NOT expect significantly more files than this |
| 92 | + |
| 93 | +**TIMING EXPECTATIONS**: |
| 94 | +- YAML validation: 1-2 seconds. NEVER CANCEL. |
| 95 | +- JavaScript validation: 1-2 seconds. NEVER CANCEL. |
| 96 | +- Markdown validation: 1-2 seconds. NEVER CANCEL. |
| 97 | +- NPM script testing: 1-2 seconds. NEVER CANCEL. |
| 98 | + |
| 99 | +**KNOWN VALIDATION ISSUES** (these are expected and do not indicate problems): |
| 100 | +- YAML files have line length violations and missing document starts |
| 101 | +- Markdown files have line length violations and HTML elements |
| 102 | +- NPM version scripts will show 404 errors when testing with non-existent packages (this is normal) |
| 103 | +- Expected stderr messages: "Failed to query the npm registry" and "404 Not Found" when testing scripts |
| 104 | +- YAML lint will report~100+ style violations - these are expected and don't break functionality |
| 105 | + |
| 106 | +##Making Changes |
| 107 | + |
| 108 | +###When Modifying Workflows |
| 109 | +1. Always validate YAML syntax first:`yamllint .github/workflows/[modified-file].yml` |
| 110 | +2. Check that workflow references are valid |
| 111 | +3. Ensure input/output specifications are correct |
| 112 | +4. Verify job dependencies and matrix configurations |
| 113 | + |
| 114 | +###When Modifying NPM Scripts |
| 115 | +1. Validate JavaScript syntax:`node -c .github/npm-version-script.js` |
| 116 | +2. Test with dummy parameters as shown above |
| 117 | +3. Ensure both CommonJS and ESM versions are kept in sync |
| 118 | +4. Verify error handling for missing packages |
| 119 | + |
| 120 | +###Before Committing |
| 121 | +Always run the complete validation suite: |
| 122 | +```bash |
| 123 | +# Full validation (takes 3-5 seconds total) |
| 124 | +yamllint .github/workflows/*.yml |
| 125 | +node -c .github/npm-version-script.js&& node -c .github/npm-version-script-esm.js |
| 126 | +markdownlint*.md profile/*.md |
| 127 | +``` |
| 128 | + |
| 129 | +**NEVER CANCEL** any of these validation commands - they complete in seconds. |
| 130 | + |
| 131 | +##Common Tasks Reference |
| 132 | + |
| 133 | +###Repository Root Contents |
| 134 | +``` |
| 135 | +.github/ # GitHub configuration and workflows |
| 136 | +CONTRIBUTING.md # Contribution guidelines |
| 137 | +README.md # Organization overview |
| 138 | +SECURITY.md # Security reporting |
| 139 | +profile/ # Organization profile |
| 140 | +.gitignore # Git ignore rules |
| 141 | +``` |
| 142 | + |
| 143 | +###Workflow File Dependencies |
| 144 | +All workflows expect: |
| 145 | +- Node.js (configurable version, default 20-22) |
| 146 | +- npm ci installation |
| 147 | +- Standard npm scripts (build, test, lint) |
| 148 | + |
| 149 | +###NPM Script Branch Patterns |
| 150 | +The version scripts expect branch names matching:`[TAG]-[VERSION]` |
| 151 | +- Example:`beta-1.2.3`,`alpha-0.5.0` |
| 152 | +- Pattern:`/^([A-Z]+)-(\d+\.\d+\.\d+)$/i` |