|
1 | 1 | ## **AI Agent Instructions for eclipse-thingweb/node-wot** |
2 | 2 |
|
3 | 3 | ### **Repository Context** |
4 | | -- **Project**: Eclipse Thingweb Node-WoT |
5 | | -- **Language**: TypeScript (97.5%), JavaScript (2.4%) |
6 | | -- **Purpose**: A fast and extensible framework to connect any device with your browser and backend applications |
7 | | -- **Standards**: W3C Web of Things (WoT) specifications |
| 4 | + |
| 5 | +- **Project**: Eclipse Thingweb Node-WoT |
| 6 | +- **Language**: TypeScript (97.5%), JavaScript (2.4%) |
| 7 | +- **Purpose**: A fast and extensible framework to connect any device with your browser and backend applications |
| 8 | +- **Standards**: W3C Web of Things (WoT) specifications |
8 | 9 |
|
9 | 10 | --- |
10 | 11 |
|
11 | 12 | ## **WHEN PROVIDING CODE** |
12 | 13 |
|
13 | 14 | ### **Pre-Development Requirements** |
| 15 | + |
14 | 16 | 1. **Read the CONTRIBUTING.md file** at https://github.com/eclipse-thingweb/node-wot/blob/master/CONTRIBUTING.md |
15 | 17 | 2. **Understand the W3C WoT standards** at https://www.w3.org/TR/2023/REC-wot-thing-description11-20231205/ |
16 | 18 | 3. **Verify Eclipse Foundation compliance**: |
17 | | - - Contributor must have an Eclipse Foundation account with GitHub ID linked |
18 | | - - Contributor must have signed the Eclipse Contributor Agreement (ECA) |
| 19 | + - Contributor must have an Eclipse Foundation account with GitHub ID linked |
| 20 | + - Contributor must have signed the Eclipse Contributor Agreement (ECA) |
19 | 21 |
|
20 | 22 | ### **Code Quality Standards** |
| 23 | + |
21 | 24 | 1. **Linting & Formatting**: |
22 | | - - Run `npm run lint` before committing |
23 | | - - Run `npm run format` to automatically fix style issues |
24 | | - - Ensure no ESLint warnings or errors remain |
25 | | - - Follow the strict boolean expressions rule (use `==` or `!=` for null/undefined checks, not `if (var)`) |
| 25 | + |
| 26 | + - Run `npm run lint` before committing |
| 27 | + - Run `npm run format` to automatically fix style issues |
| 28 | + - Ensure no ESLint warnings or errors remain |
| 29 | + - Follow the strict boolean expressions rule (use `==` or `!=` for null/undefined checks, not `if (var)`) |
26 | 30 |
|
27 | 31 | 2. **Scope & Minimal Diffs**: |
28 | | - - Keep changes limited to the specific feature/fix scope |
29 | | - - Do not modify unrelated parts of files |
30 | | - - Strive for the minimum git diff (fewest lines changed) |
31 | | - - Avoid unnecessary refactoring outside the scope of work |
| 32 | + |
| 33 | + - Keep changes limited to the specific feature/fix scope |
| 34 | + - Do not modify unrelated parts of files |
| 35 | + - Strive for the minimum git diff (fewest lines changed) |
| 36 | + - Avoid unnecessary refactoring outside the scope of work |
32 | 37 |
|
33 | 38 | 3. **Testing**: |
34 | | - - Run the full test suite before committing: `npm run test` or equivalent |
35 | | - - Ensure all tests pass |
36 | | - - Add tests for new features or fixes |
| 39 | + |
| 40 | + - Run the full test suite before committing: `npm run test` or equivalent |
| 41 | + - Ensure all tests pass |
| 42 | + - Add tests for new features or fixes |
37 | 43 |
|
38 | 44 | 4. **Special Attention for Core Changes**: |
39 | | - - If modifying `packages/core`, understand that this impacts ALL other packages |
40 | | - - Check if changes contradict the W3C WoT Scripting API specification: https://w3c.github.io/wot-scripting-api/ |
41 | | - - Verify all dependent packages are updated accordingly |
42 | | - - Validate compatibility with existing protocol bindings |
43 | | - |
| 45 | + |
| 46 | + - If modifying `packages/core`, understand that this impacts ALL other packages |
| 47 | + - Check if changes contradict the W3C WoT Scripting API specification: https://w3c.github.io/wot-scripting-api/ |
| 48 | + - Verify all dependent packages are updated accordingly |
| 49 | + - Validate compatibility with existing protocol bindings |
| 50 | + |
44 | 51 | 5. **Bypassing the Problem**: |
45 | 52 |
|
46 | | - - If you do not find a solution to the problem, do not bypass it by typecasting, ignoring the tests etc. |
| 53 | + - If you do not find a solution to the problem, do not bypass it by typecasting, ignoring the tests etc. |
47 | 54 |
|
48 | 55 | 6. **Commit Requirements**: |
49 | | - - **All commits MUST be signed** using the contributor's Eclipse Foundation account email |
50 | | - - Configure git: `git config user.email "<eclipse-account-email>"` |
51 | | - - Commit with `-s` flag: `git commit -s -m "<message>"` |
52 | | - - Follow Conventional Changelog format: |
53 | | - ``` |
54 | | - <type>(<scope>): <subject> |
55 | | - |
56 | | - <body> |
57 | | - |
58 | | - <footer> |
59 | | - ``` |
60 | | - - **Allowed types**: `feat`, `fix`, `refactor`, `perf`, `style`, `test`, `chore`, `docs` |
61 | | - - **Subject**: imperative mood, present tense, lowercase, no period |
62 | | - - **Example**: `feat(binding-coap): add support for observe option` |
| 56 | + - **All commits MUST be signed** using the contributor's Eclipse Foundation account email |
| 57 | + - Configure git: `git config user.email "<eclipse-account-email>"` |
| 58 | + - Commit with `-s` flag: `git commit -s -m "<message>"` |
| 59 | + - Follow Conventional Changelog format: |
| 60 | + |
| 61 | + ``` |
| 62 | + <type>(<scope>): <subject> |
| 63 | +
|
| 64 | + <body> |
| 65 | +
|
| 66 | + <footer> |
| 67 | + ``` |
| 68 | +
|
| 69 | + - **Allowed types**: `feat`, `fix`, `refactor`, `perf`, `style`, `test`, `chore`, `docs` |
| 70 | + - **Subject**: imperative mood, present tense, lowercase, no period |
| 71 | + - **Example**: `feat(binding-coap): add support for observe option` |
63 | 72 |
|
64 | 73 | ### **Pull Request Requirements** |
| 74 | +
|
65 | 75 | 1. **PR Body MUST include**: |
66 | | - - **Explanation of AI assistance used**: Describe how AI tools assisted in generating the code, specific aspects AI helped with, and what human review/validation was performed |
67 | | - - **Concise change description**: Exactly what was changed, why, and technical details |
68 | | - - **Do NOT discuss**: Benefits, impact on users, or general statements about the value of the change |
| 76 | +
|
| 77 | + - **Explanation of AI assistance used**: Describe how AI tools assisted in generating the code, specific aspects AI helped with, and what human review/validation was performed |
| 78 | + - **Concise change description**: Exactly what was changed, why, and technical details |
| 79 | + - **Do NOT discuss**: Benefits, impact on users, or general statements about the value of the change |
69 | 80 |
|
70 | 81 | 2. **Example PR Body**: |
71 | | - ```markdown |
72 | | - ## AI Assistance Summary |
73 | | - This PR was generated with AI assistance for boilerplate code generation and structural |
74 | | - implementation. The AI helped with [specific aspect], while human verification confirmed |
75 | | - [what was validated]. |
76 | | - |
77 | | - ## Changes |
78 | | - - Modified `packages/binding-foo/src/foo-client.ts` to implement ProtocolClient interface |
79 | | - - Added error handling for connection timeouts |
80 | | - - Updated corresponding test file |
81 | | - |
82 | | - Fixes #123 |
83 | | - ``` |
| 82 | +
|
| 83 | + ```markdown |
| 84 | + ## AI Assistance Summary |
| 85 | +
|
| 86 | + This PR was generated with AI assistance for boilerplate code generation and structural |
| 87 | + implementation. The AI helped with [specific aspect], while human verification confirmed |
| 88 | + [what was validated]. |
| 89 | +
|
| 90 | + ## Changes |
| 91 | +
|
| 92 | + - Modified `packages/binding-foo/src/foo-client.ts` to implement ProtocolClient interface |
| 93 | + - Added error handling for connection timeouts |
| 94 | + - Updated corresponding test file |
| 95 | +
|
| 96 | + Fixes #123 |
| 97 | + ``` |
84 | 98 |
|
85 | 99 | 3. **PR Process**: |
86 | | - - Create feature branch from master |
87 | | - - Do NOT merge with master while developing |
88 | | - - If master updates are needed, rebase: `git checkout master && git pull && git checkout - && git rebase master` |
89 | | - - Ensure CI/CD checks pass |
90 | | - - Do NOT force push unless absolutely necessary |
| 100 | + - Create feature branch from master |
| 101 | + - Do NOT merge with master while developing |
| 102 | + - If master updates are needed, rebase: `git checkout master && git pull && git checkout - && git rebase master` |
| 103 | + - Ensure CI/CD checks pass |
| 104 | + - Do NOT force push unless absolutely necessary |
91 | 105 |
|
92 | 106 | --- |
93 | 107 |
|
94 | 108 | ## **WHEN REVIEWING CODE** |
95 | 109 |
|
96 | 110 | ### **Review Scope & Guidelines** |
| 111 | +
|
97 | 112 | 1. **Primary Focus Areas**: |
98 | | - - Code correctness and adherence to W3C WoT standards |
99 | | - - Compliance with repository coding standards (ESLint, Prettier, style guide) |
100 | | - - Proper testing and test coverage |
101 | | - - Commit message quality and signing |
102 | | - - PR description completeness (especially AI assistance disclosure) |
| 113 | +
|
| 114 | + - Code correctness and adherence to W3C WoT standards |
| 115 | + - Compliance with repository coding standards (ESLint, Prettier, style guide) |
| 116 | + - Proper testing and test coverage |
| 117 | + - Commit message quality and signing |
| 118 | + - PR description completeness (especially AI assistance disclosure) |
103 | 119 |
|
104 | 120 | 2. **Avoid Redundancy**: |
105 | | - - Do NOT repeat observations already in the PR author's initial summary/first comment |
106 | | - - Read the PR description first to understand context and intent |
| 121 | +
|
| 122 | + - Do NOT repeat observations already in the PR author's initial summary/first comment |
| 123 | + - Read the PR description first to understand context and intent |
107 | 124 |
|
108 | 125 | 3. **W3C WoT Standards Validation**: |
109 | | - - Verify implementation matches W3C WoT Thing Description specification |
110 | | - - Check W3C WoT Scripting API compliance for any core changes |
111 | | - - Validate protocol binding implementations against expected interfaces |
| 126 | +
|
| 127 | + - Verify implementation matches W3C WoT Thing Description specification |
| 128 | + - Check W3C WoT Scripting API compliance for any core changes |
| 129 | + - Validate protocol binding implementations against expected interfaces |
112 | 130 |
|
113 | 131 | 4. **Ecosystem Impact Assessment**: |
114 | | - - If reviewing core changes: verify impact across all dependent packages |
115 | | - - Check if breaking changes are properly documented in PR body |
116 | | - - Validate that bindings still function correctly |
| 132 | + - If reviewing core changes: verify impact across all dependent packages |
| 133 | + - Check if breaking changes are properly documented in PR body |
| 134 | + - Validate that bindings still function correctly |
117 | 135 |
|
118 | 136 | ### **Comment Management** |
| 137 | +
|
119 | 138 | 1. **Consolidation Rule**: |
120 | | - - If you find yourself writing more than 5 separate comments: |
121 | | - - Consolidate into a single summarized comment |
122 | | - - Organize by category (critical issues, style, suggestions) |
123 | | - - Clearly mark blockers vs. optional improvements |
124 | | - - Ask contributor to review and respond to the summary comment |
| 139 | +
|
| 140 | + - If you find yourself writing more than 5 separate comments: |
| 141 | + - Consolidate into a single summarized comment |
| 142 | + - Organize by category (critical issues, style, suggestions) |
| 143 | + - Clearly mark blockers vs. optional improvements |
| 144 | + - Ask contributor to review and respond to the summary comment |
125 | 145 |
|
126 | 146 | 2. **Comment Examples**: |
127 | | - - ✅ **Good**: Points out specific issue with concrete fix suggestion |
128 | | - - ❌ **Avoid**: Repeating the same point multiple times across different comments |
129 | | - - ✅ **Good**: Consolidating multiple style issues into: "Code style issues found in 3 locations: [list]. Please run `npm run format`" |
| 147 | + - ✅ **Good**: Points out specific issue with concrete fix suggestion |
| 148 | + - ❌ **Avoid**: Repeating the same point multiple times across different comments |
| 149 | + - ✅ **Good**: Consolidating multiple style issues into: "Code style issues found in 3 locations: [list]. Please run `npm run format`" |
130 | 150 |
|
131 | 151 | ### **Approval Criteria** |
132 | | -- [ ] All commits are signed with Eclipse account email |
133 | | -- [ ] Code passes `npm run lint` and `npm run format` |
134 | | -- [ ] All tests pass (`npm run test`) |
135 | | -- [ ] PR body explains AI assistance and changes clearly |
136 | | -- [ ] Conventional commit format followed |
137 | | -- [ ] No unrelated changes to files |
138 | | -- [ ] W3C WoT standards compliance verified |
139 | | -- [ ] If core changes: dependent packages updated/validated |
140 | | -- [ ] No merge conflicts with master |
| 152 | +
|
| 153 | +- [ ] All commits are signed with Eclipse account email |
| 154 | +- [ ] Code passes `npm run lint` and `npm run format` |
| 155 | +- [ ] All tests pass (`npm run test`) |
| 156 | +- [ ] PR body explains AI assistance and changes clearly |
| 157 | +- [ ] Conventional commit format followed |
| 158 | +- [ ] No unrelated changes to files |
| 159 | +- [ ] W3C WoT standards compliance verified |
| 160 | +- [ ] If core changes: dependent packages updated/validated |
| 161 | +- [ ] No merge conflicts with master |
141 | 162 |
|
142 | 163 | --- |
143 | 164 |
|
144 | 165 | ## **Key References for AI Agents** |
145 | 166 |
|
146 | | -| Resource | Purpose | |
147 | | -|----------|---------| |
148 | | -| [CONTRIBUTING.md](https://github.com/eclipse-thingweb/node-wot/blob/master/CONTRIBUTING.md) | Full contribution guidelines | |
149 | | -| [W3C WoT Thing Description](https://www.w3.org/TR/2023/REC-wot-thing-description11-20231205/) | Core specification | |
150 | | -| [W3C WoT Scripting API](https://w3c.github.io/wot-scripting-api/) | Required for core/API changes | |
151 | | -| [Eclipse ECA](http://www.eclipse.org/legal/ECA.php) | Legal requirements | |
152 | | -| [Eclipse Committer Handbook](https://www.eclipse.org/projects/handbook/) | Best practices | |
| 167 | +| Resource | Purpose | |
| 168 | +| --------------------------------------------------------------------------------------------- | ----------------------------- | |
| 169 | +| [CONTRIBUTING.md](https://github.com/eclipse-thingweb/node-wot/blob/master/CONTRIBUTING.md) | Full contribution guidelines | |
| 170 | +| [W3C WoT Thing Description](https://www.w3.org/TR/2023/REC-wot-thing-description11-20231205/) | Core specification | |
| 171 | +| [W3C WoT Scripting API](https://w3c.github.io/wot-scripting-api/) | Required for core/API changes | |
| 172 | +| [Eclipse ECA](http://www.eclipse.org/legal/ECA.php) | Legal requirements | |
| 173 | +| [Eclipse Committer Handbook](https://www.eclipse.org/projects/handbook/) | Best practices | |
153 | 174 |
|
154 | 175 | --- |
155 | 176 |
|
|
0 commit comments