|
1 | | -# Contributing to VIBEE |
| 1 | +# Contributing to Trinity |
| 2 | + |
| 3 | +Thank you for your interest in contributing to Trinity! |
| 4 | + |
| 5 | +--- |
| 6 | + |
| 7 | +## Quick Links |
| 8 | + |
| 9 | +- [Development Setup](#development-setup) |
| 10 | +- [Code Style](#code-style) |
| 11 | +- [Pull Request Process](#pull-request-process) |
| 12 | +- [Testing](#testing) |
| 13 | +- [Documentation](#documentation) |
| 14 | + |
| 15 | +--- |
| 16 | + |
| 17 | +## Development Setup |
| 18 | + |
| 19 | +### Prerequisites |
| 20 | + |
| 21 | +- **Zig 0.13.0** (required version) |
| 22 | +- **Git** for version control |
| 23 | +- **Make** (optional, for convenience scripts) |
| 24 | + |
| 25 | +### Installation |
| 26 | + |
| 27 | +```bash |
| 28 | +# Clone the repository |
| 29 | +git clone https://github.com/gHashTag/trinity.git |
| 30 | +cd trinity |
| 31 | + |
| 32 | +# Verify Zig version |
| 33 | +zig version # Should show 0.13.0 |
| 34 | + |
| 35 | +# Build |
| 36 | +zig build |
| 37 | + |
| 38 | +# Run tests |
| 39 | +zig build test |
| 40 | +``` |
| 41 | + |
| 42 | +See [docs/getting-started/DEVELOPMENT_SETUP.md](docs/getting-started/DEVELOPMENT_SETUP.md) for detailed setup instructions. |
| 43 | + |
| 44 | +--- |
2 | 45 |
|
3 | 46 | ## Development Workflow |
4 | 47 |
|
5 | | -1. **Fork** the repository |
6 | | -2. **Create** a feature branch: `git checkout -b feature/my-feature` |
7 | | -3. **Write specification first** — Create `.vibee` file before implementation |
8 | | -4. **Generate code** — Use `vibeec gen` to generate implementation |
9 | | -5. **Test** — Run `zig test` on generated code |
10 | | -6. **Commit** — Follow conventional commits |
11 | | -7. **Submit** pull request |
| 48 | +### Golden Chain Methodology |
| 49 | + |
| 50 | +Trinity follows the **specification-first** development approach: |
| 51 | + |
| 52 | +1. **Create specification** — Write `.vibee` file first |
| 53 | +2. **Generate code** — `./bin/vibee gen spec.vibee` |
| 54 | +3. **Test** — `zig test trinity/output/module.zig` |
| 55 | +4. **Write TOXIC VERDICT** — Self-criticism of implementation |
| 56 | +5. **Propose TECH TREE** — 3 options for next iteration |
12 | 57 |
|
13 | | -## Specification-First Development |
| 58 | +```bash |
| 59 | +# View methodology |
| 60 | +./bin/vibee koschei |
| 61 | +``` |
| 62 | + |
| 63 | +### Branch Naming |
| 64 | + |
| 65 | +| Prefix | Use | |
| 66 | +|--------|-----| |
| 67 | +| `feature/` | New features | |
| 68 | +| `fix/` | Bug fixes | |
| 69 | +| `docs/` | Documentation | |
| 70 | +| `refactor/` | Code refactoring | |
| 71 | +| `test/` | Test additions | |
| 72 | + |
| 73 | +Example: `feature/vsa-similarity-metrics` |
14 | 74 |
|
15 | | -All new features must start with a `.vibee` specification: |
| 75 | +--- |
| 76 | + |
| 77 | +## Code Style |
| 78 | + |
| 79 | +### Zig Code |
| 80 | + |
| 81 | +- Follow [Zig Style Guide](https://ziglang.org/documentation/master/#Style-Guide) |
| 82 | +- Use 4-space indentation |
| 83 | +- Max line length: 120 characters |
| 84 | +- Add doc comments for public functions |
| 85 | + |
| 86 | +```zig |
| 87 | +/// Binds two vectors via element-wise multiplication. |
| 88 | +/// Properties: |
| 89 | +/// - bind(a, a) = all +1 (self-inverse) |
| 90 | +/// - bind(a, bind(a, b)) = b (unbind) |
| 91 | +pub fn bind(a: *HybridBigInt, b: *HybridBigInt) HybridBigInt { |
| 92 | + // Implementation |
| 93 | +} |
| 94 | +``` |
| 95 | + |
| 96 | +### Specification Files |
| 97 | + |
| 98 | +- Use 2-space indentation in YAML |
| 99 | +- Include version and module name |
| 100 | +- Document all behaviors |
16 | 101 |
|
17 | 102 | ```yaml |
18 | | -# specs/my_feature.vibee |
19 | | -name: my_feature |
| 103 | +name: module_name |
20 | 104 | version: "1.0.0" |
21 | 105 | language: zig |
22 | | -module: my_feature |
| 106 | +module: module_name |
23 | 107 |
|
24 | 108 | behaviors: |
25 | | - - name: feature_behavior |
| 109 | + - name: function_name |
26 | 110 | given: Precondition |
27 | 111 | when: Action |
28 | 112 | then: Expected result |
29 | 113 | ``` |
30 | 114 |
|
31 | | -## Code Style |
| 115 | +### Commit Messages |
| 116 | +
|
| 117 | +Use [Conventional Commits](https://www.conventionalcommits.org/): |
| 118 | +
|
| 119 | +| Type | Description | |
| 120 | +|------|-------------| |
| 121 | +| `feat:` | New feature | |
| 122 | +| `fix:` | Bug fix | |
| 123 | +| `docs:` | Documentation | |
| 124 | +| `refactor:` | Code refactoring | |
| 125 | +| `test:` | Test changes | |
| 126 | +| `chore:` | Build/tooling | |
| 127 | + |
| 128 | +Example: |
| 129 | +``` |
| 130 | +feat: Add cosine similarity to VSA module |
| 131 | +
|
| 132 | +- Implement normalized dot product |
| 133 | +- Add SIMD acceleration |
| 134 | +- Include tests for edge cases |
| 135 | +``` |
| 136 | + |
| 137 | +--- |
| 138 | + |
| 139 | +## Pull Request Process |
| 140 | + |
| 141 | +### Before Submitting |
| 142 | + |
| 143 | +1. **Run tests:** |
| 144 | + ```bash |
| 145 | + zig build test |
| 146 | + zig test src/vsa.zig # Specific module |
| 147 | + ``` |
32 | 148 |
|
33 | | -- **Zig**: Follow Zig style guide |
34 | | -- **Specifications**: Use 2-space indentation in YAML |
35 | | -- **Commits**: Use conventional commits (`feat:`, `fix:`, `docs:`) |
| 149 | +2. **Check formatting:** |
| 150 | + ```bash |
| 151 | + zig fmt src/ |
| 152 | + ``` |
| 153 | + |
| 154 | +3. **Update documentation** if changing public APIs |
| 155 | + |
| 156 | +### PR Template |
| 157 | + |
| 158 | +```markdown |
| 159 | +## Description |
| 160 | +Brief description of changes. |
| 161 | +
|
| 162 | +## Type of Change |
| 163 | +- [ ] Bug fix |
| 164 | +- [ ] New feature |
| 165 | +- [ ] Documentation |
| 166 | +- [ ] Refactoring |
36 | 167 |
|
37 | 168 | ## Testing |
| 169 | +How was this tested? |
| 170 | +
|
| 171 | +## Checklist |
| 172 | +- [ ] Tests pass |
| 173 | +- [ ] Documentation updated |
| 174 | +- [ ] Follows code style |
| 175 | +``` |
| 176 | + |
| 177 | +### Review Process |
| 178 | + |
| 179 | +1. Create PR against `main` branch |
| 180 | +2. Automated tests run via CI |
| 181 | +3. Maintainer reviews code |
| 182 | +4. Address feedback |
| 183 | +5. Merge when approved |
| 184 | + |
| 185 | +--- |
| 186 | + |
| 187 | +## Testing |
| 188 | + |
| 189 | +### Running Tests |
38 | 190 |
|
39 | 191 | ```bash |
40 | | -cd src/vibeec |
41 | | -zig test parser.zig |
42 | | -zig test codegen.zig |
| 192 | +# All tests |
| 193 | +zig build test |
| 194 | +
|
| 195 | +# Specific module |
| 196 | +zig test src/vsa.zig |
| 197 | +zig test src/vm.zig |
| 198 | +zig test src/hybrid.zig |
| 199 | +
|
| 200 | +# With verbose output |
| 201 | +zig test src/vsa.zig --verbose |
| 202 | +
|
| 203 | +# Specific test |
| 204 | +zig test src/vsa.zig --filter "bind" |
| 205 | +``` |
| 206 | + |
| 207 | +### Writing Tests |
| 208 | + |
| 209 | +```zig |
| 210 | +test "function description" { |
| 211 | + // Arrange |
| 212 | + var a = HybridBigInt.random(100); |
| 213 | + var b = HybridBigInt.random(100); |
| 214 | +
|
| 215 | + // Act |
| 216 | + const result = bind(&a, &b); |
| 217 | +
|
| 218 | + // Assert |
| 219 | + try std.testing.expect(result.trit_len == 100); |
| 220 | +} |
43 | 221 | ``` |
44 | 222 |
|
45 | | -## Pull Request Guidelines |
| 223 | +### Test Coverage |
| 224 | + |
| 225 | +- All public functions must have tests |
| 226 | +- Test edge cases (empty, max size, etc.) |
| 227 | +- Include performance tests for critical paths |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +## Documentation |
| 232 | + |
| 233 | +### What to Document |
| 234 | + |
| 235 | +- Public API functions |
| 236 | +- Configuration options |
| 237 | +- Examples and tutorials |
| 238 | +- Architecture decisions |
| 239 | + |
| 240 | +### Documentation Style |
| 241 | + |
| 242 | +- Use Markdown |
| 243 | +- Include code examples |
| 244 | +- Add "See Also" cross-references |
| 245 | + |
| 246 | +### Building Docs |
| 247 | + |
| 248 | +Documentation is in `docs/` directory: |
| 249 | +- `docs/INDEX.md` — Main navigation |
| 250 | +- `docs/api/` — API reference |
| 251 | +- `docs/getting-started/` — Tutorials |
| 252 | + |
| 253 | +--- |
| 254 | + |
| 255 | +## Getting Help |
| 256 | + |
| 257 | +- **Issues:** https://github.com/gHashTag/trinity/issues |
| 258 | +- **Discussions:** GitHub Discussions |
| 259 | +- **Documentation:** `docs/INDEX.md` |
| 260 | + |
| 261 | +--- |
46 | 262 |
|
47 | | -1. Reference related issue |
48 | | -2. Include specification file |
49 | | -3. Add tests for new behaviors |
50 | | -4. Update documentation if needed |
| 263 | +## Recognition |
51 | 264 |
|
52 | | -## Questions |
| 265 | +Contributors are recognized in: |
| 266 | +- Git commit history |
| 267 | +- Release notes |
| 268 | +- CONTRIBUTORS.md (for significant contributions) |
53 | 269 |
|
54 | | -Open an issue for questions or discussions. |
| 270 | +Thank you for contributing to Trinity! |
0 commit comments