red64-cli 0.3.0 → 0.6.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.
- package/README.md +194 -338
- package/dist/cli/parseArgs.d.ts.map +1 -1
- package/dist/cli/parseArgs.js +5 -13
- package/dist/cli/parseArgs.js.map +1 -1
- package/dist/components/init/types.d.ts +0 -2
- package/dist/components/init/types.d.ts.map +1 -1
- package/dist/components/screens/HelpScreen.d.ts.map +1 -1
- package/dist/components/screens/HelpScreen.js +0 -2
- package/dist/components/screens/HelpScreen.js.map +1 -1
- package/dist/components/screens/InitScreen.d.ts.map +1 -1
- package/dist/components/screens/InitScreen.js +5 -8
- package/dist/components/screens/InitScreen.js.map +1 -1
- package/dist/components/screens/StartScreen.d.ts.map +1 -1
- package/dist/components/screens/StartScreen.js +29 -8
- package/dist/components/screens/StartScreen.js.map +1 -1
- package/dist/components/screens/StatusScreen.d.ts.map +1 -1
- package/dist/components/screens/StatusScreen.js +16 -1
- package/dist/components/screens/StatusScreen.js.map +1 -1
- package/dist/services/AgentInvoker.d.ts.map +1 -1
- package/dist/services/AgentInvoker.js +76 -37
- package/dist/services/AgentInvoker.js.map +1 -1
- package/dist/services/ClaudeErrorDetector.d.ts +1 -1
- package/dist/services/ClaudeErrorDetector.d.ts.map +1 -1
- package/dist/services/ClaudeErrorDetector.js +1 -0
- package/dist/services/ClaudeErrorDetector.js.map +1 -1
- package/dist/services/ClaudeHealthCheck.d.ts +7 -0
- package/dist/services/ClaudeHealthCheck.d.ts.map +1 -1
- package/dist/services/ClaudeHealthCheck.js +76 -12
- package/dist/services/ClaudeHealthCheck.js.map +1 -1
- package/dist/services/ConfigService.d.ts +1 -0
- package/dist/services/ConfigService.d.ts.map +1 -1
- package/dist/services/ConfigService.js.map +1 -1
- package/dist/services/DockerRunner.js +1 -1
- package/dist/services/DockerRunner.js.map +1 -1
- package/dist/services/PhaseExecutor.d.ts.map +1 -1
- package/dist/services/PhaseExecutor.js +2 -1
- package/dist/services/PhaseExecutor.js.map +1 -1
- package/dist/services/TaskRunner.d.ts.map +1 -1
- package/dist/services/TaskRunner.js +2 -1
- package/dist/services/TaskRunner.js.map +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.d.ts.map +1 -1
- package/dist/services/index.js +1 -1
- package/dist/services/index.js.map +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/framework/stacks/c/code-quality.md +326 -0
- package/framework/stacks/c/coding-style.md +347 -0
- package/framework/stacks/c/conventions.md +513 -0
- package/framework/stacks/c/error-handling.md +350 -0
- package/framework/stacks/c/feedback.md +158 -0
- package/framework/stacks/c/memory-safety.md +408 -0
- package/framework/stacks/c/tech.md +122 -0
- package/framework/stacks/c/testing.md +472 -0
- package/framework/stacks/cpp/code-quality.md +282 -0
- package/framework/stacks/cpp/coding-style.md +363 -0
- package/framework/stacks/cpp/conventions.md +420 -0
- package/framework/stacks/cpp/error-handling.md +264 -0
- package/framework/stacks/cpp/feedback.md +104 -0
- package/framework/stacks/cpp/memory-safety.md +351 -0
- package/framework/stacks/cpp/tech.md +160 -0
- package/framework/stacks/cpp/testing.md +323 -0
- package/framework/stacks/java/code-quality.md +357 -0
- package/framework/stacks/java/coding-style.md +400 -0
- package/framework/stacks/java/conventions.md +437 -0
- package/framework/stacks/java/error-handling.md +408 -0
- package/framework/stacks/java/feedback.md +180 -0
- package/framework/stacks/java/tech.md +126 -0
- package/framework/stacks/java/testing.md +485 -0
- package/framework/stacks/javascript/async-patterns.md +216 -0
- package/framework/stacks/javascript/code-quality.md +182 -0
- package/framework/stacks/javascript/coding-style.md +293 -0
- package/framework/stacks/javascript/conventions.md +268 -0
- package/framework/stacks/javascript/error-handling.md +216 -0
- package/framework/stacks/javascript/feedback.md +80 -0
- package/framework/stacks/javascript/tech.md +114 -0
- package/framework/stacks/javascript/testing.md +209 -0
- package/framework/stacks/loco/code-quality.md +156 -0
- package/framework/stacks/loco/coding-style.md +247 -0
- package/framework/stacks/loco/error-handling.md +225 -0
- package/framework/stacks/loco/feedback.md +35 -0
- package/framework/stacks/loco/loco.md +342 -0
- package/framework/stacks/loco/structure.md +193 -0
- package/framework/stacks/loco/tech.md +129 -0
- package/framework/stacks/loco/testing.md +211 -0
- package/framework/stacks/rust/code-quality.md +370 -0
- package/framework/stacks/rust/coding-style.md +475 -0
- package/framework/stacks/rust/conventions.md +430 -0
- package/framework/stacks/rust/error-handling.md +399 -0
- package/framework/stacks/rust/feedback.md +152 -0
- package/framework/stacks/rust/memory-safety.md +398 -0
- package/framework/stacks/rust/tech.md +121 -0
- package/framework/stacks/rust/testing.md +528 -0
- package/package.json +14 -2
|
@@ -0,0 +1,513 @@
|
|
|
1
|
+
# Development Conventions
|
|
2
|
+
|
|
3
|
+
General development practices, workflow, and operational standards for C projects.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Philosophy
|
|
8
|
+
|
|
9
|
+
- **Predictable process**: Consistent workflows reduce friction and errors
|
|
10
|
+
- **Automated enforcement**: clang-tidy and CI catch what humans miss
|
|
11
|
+
- **Build reproducibility**: Lock dependencies, pin toolchains, use presets
|
|
12
|
+
- **Documentation as code**: Keep docs next to the code they describe
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Git Workflow
|
|
17
|
+
|
|
18
|
+
### Branch Strategy
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
main # Production-ready, always builds
|
|
22
|
+
|-- feat/... # Feature branches (short-lived)
|
|
23
|
+
|-- fix/... # Bug fix branches
|
|
24
|
+
|-- chore/... # Maintenance, dependency updates
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Branch Naming
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
feat/add-user-authentication
|
|
31
|
+
fix/buffer-overflow-in-parser
|
|
32
|
+
chore/upgrade-libcurl-to-8
|
|
33
|
+
refactor/extract-http-module
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Pattern**: `{type}/{short-description}` with lowercase and hyphens.
|
|
37
|
+
|
|
38
|
+
### Workflow
|
|
39
|
+
|
|
40
|
+
1. Create branch from `main`
|
|
41
|
+
2. Make small, focused commits
|
|
42
|
+
3. Open PR when ready for review
|
|
43
|
+
4. Squash merge into `main`
|
|
44
|
+
5. Delete branch after merge
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Commit Conventions
|
|
49
|
+
|
|
50
|
+
### Conventional Commits
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
feat: add JWT token validation
|
|
54
|
+
fix: prevent buffer overflow in JSON parser
|
|
55
|
+
refactor: extract HTTP client into separate module
|
|
56
|
+
test: add fuzz tests for config parser
|
|
57
|
+
docs: update CMake build instructions
|
|
58
|
+
chore: upgrade vcpkg baseline to 2025.01
|
|
59
|
+
ci: add ASan/UBSan to test matrix
|
|
60
|
+
perf: use arena allocator for request parsing
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Format
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
{type}: {short description}
|
|
67
|
+
|
|
68
|
+
{optional body explaining why, not what}
|
|
69
|
+
|
|
70
|
+
{optional footer: BREAKING CHANGE, Closes #123}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### Types
|
|
74
|
+
|
|
75
|
+
| Type | Description |
|
|
76
|
+
|---|---|
|
|
77
|
+
| `feat` | New feature or capability |
|
|
78
|
+
| `fix` | Bug fix |
|
|
79
|
+
| `refactor` | Code change that neither fixes nor adds |
|
|
80
|
+
| `test` | Adding or updating tests |
|
|
81
|
+
| `docs` | Documentation only |
|
|
82
|
+
| `chore` | Maintenance, dependencies, tooling |
|
|
83
|
+
| `ci` | CI/CD configuration changes |
|
|
84
|
+
| `perf` | Performance improvement |
|
|
85
|
+
|
|
86
|
+
**Rule**: One logical change per commit. If the commit message needs "and", split it.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## CMake Project Structure
|
|
91
|
+
|
|
92
|
+
### Standard Layout
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
myproject/
|
|
96
|
+
CMakeLists.txt # Root CMakeLists
|
|
97
|
+
CMakePresets.json # Build presets
|
|
98
|
+
vcpkg.json # Dependency manifest (vcpkg)
|
|
99
|
+
conanfile.txt # Dependency manifest (Conan alternative)
|
|
100
|
+
.clang-format # Formatting config
|
|
101
|
+
.clang-tidy # Static analysis config
|
|
102
|
+
cmake/
|
|
103
|
+
CompilerWarnings.cmake # Shared warning flags
|
|
104
|
+
Sanitizers.cmake # Sanitizer build options
|
|
105
|
+
include/
|
|
106
|
+
myproject/ # Public headers
|
|
107
|
+
user.h
|
|
108
|
+
config.h
|
|
109
|
+
error.h
|
|
110
|
+
src/
|
|
111
|
+
user.c
|
|
112
|
+
config.c
|
|
113
|
+
error.c
|
|
114
|
+
main.c
|
|
115
|
+
internal/ # Private headers
|
|
116
|
+
parser_internal.h
|
|
117
|
+
tests/
|
|
118
|
+
CMakeLists.txt
|
|
119
|
+
unit/
|
|
120
|
+
test_user.c
|
|
121
|
+
test_config.c
|
|
122
|
+
integration/
|
|
123
|
+
test_database.c
|
|
124
|
+
fuzz/
|
|
125
|
+
fuzz_parser.c
|
|
126
|
+
vendor/ # Vendored dependencies (Unity, etc.)
|
|
127
|
+
unity/
|
|
128
|
+
unity.c
|
|
129
|
+
unity.h
|
|
130
|
+
unity_internals.h
|
|
131
|
+
docs/
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Root CMakeLists.txt
|
|
135
|
+
|
|
136
|
+
```cmake
|
|
137
|
+
cmake_minimum_required(VERSION 3.25)
|
|
138
|
+
project(myproject VERSION 1.0.0 LANGUAGES C)
|
|
139
|
+
|
|
140
|
+
set(CMAKE_C_STANDARD 17)
|
|
141
|
+
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
142
|
+
set(CMAKE_C_EXTENSIONS OFF)
|
|
143
|
+
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
144
|
+
|
|
145
|
+
# Library target
|
|
146
|
+
add_library(myproject_lib
|
|
147
|
+
src/user.c
|
|
148
|
+
src/config.c
|
|
149
|
+
src/error.c
|
|
150
|
+
)
|
|
151
|
+
target_include_directories(myproject_lib
|
|
152
|
+
PUBLIC include
|
|
153
|
+
PRIVATE src/internal
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
# Executable target
|
|
157
|
+
add_executable(myproject src/main.c)
|
|
158
|
+
target_link_libraries(myproject PRIVATE myproject_lib)
|
|
159
|
+
|
|
160
|
+
# Tests
|
|
161
|
+
option(BUILD_TESTING "Build tests" ON)
|
|
162
|
+
if(BUILD_TESTING)
|
|
163
|
+
enable_testing()
|
|
164
|
+
add_subdirectory(tests)
|
|
165
|
+
endif()
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### CMakePresets.json
|
|
169
|
+
|
|
170
|
+
```json
|
|
171
|
+
{
|
|
172
|
+
"version": 6,
|
|
173
|
+
"configurePresets": [
|
|
174
|
+
{
|
|
175
|
+
"name": "default",
|
|
176
|
+
"binaryDir": "${sourceDir}/build",
|
|
177
|
+
"generator": "Ninja",
|
|
178
|
+
"cacheVariables": {
|
|
179
|
+
"CMAKE_C_STANDARD": "17",
|
|
180
|
+
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"name": "debug",
|
|
185
|
+
"inherits": "default",
|
|
186
|
+
"cacheVariables": {
|
|
187
|
+
"CMAKE_BUILD_TYPE": "Debug"
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
"name": "release",
|
|
192
|
+
"inherits": "default",
|
|
193
|
+
"cacheVariables": {
|
|
194
|
+
"CMAKE_BUILD_TYPE": "Release"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"name": "relwithdebinfo",
|
|
199
|
+
"inherits": "default",
|
|
200
|
+
"cacheVariables": {
|
|
201
|
+
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"name": "asan",
|
|
206
|
+
"inherits": "debug",
|
|
207
|
+
"cacheVariables": {
|
|
208
|
+
"CMAKE_C_FLAGS": "-fsanitize=address,undefined -fno-omit-frame-pointer -fno-sanitize-recover=all"
|
|
209
|
+
}
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
"name": "tsan",
|
|
213
|
+
"inherits": "debug",
|
|
214
|
+
"cacheVariables": {
|
|
215
|
+
"CMAKE_C_FLAGS": "-fsanitize=thread"
|
|
216
|
+
}
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
"name": "coverage",
|
|
220
|
+
"inherits": "debug",
|
|
221
|
+
"cacheVariables": {
|
|
222
|
+
"CMAKE_C_FLAGS": "--coverage"
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
],
|
|
226
|
+
"buildPresets": [
|
|
227
|
+
{"name": "default", "configurePreset": "default"},
|
|
228
|
+
{"name": "debug", "configurePreset": "debug"},
|
|
229
|
+
{"name": "release", "configurePreset": "release"},
|
|
230
|
+
{"name": "asan", "configurePreset": "asan"},
|
|
231
|
+
{"name": "coverage", "configurePreset": "coverage"}
|
|
232
|
+
],
|
|
233
|
+
"testPresets": [
|
|
234
|
+
{
|
|
235
|
+
"name": "default",
|
|
236
|
+
"configurePreset": "default",
|
|
237
|
+
"output": {"outputOnFailure": true}
|
|
238
|
+
}
|
|
239
|
+
]
|
|
240
|
+
}
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
---
|
|
244
|
+
|
|
245
|
+
## Build Types
|
|
246
|
+
|
|
247
|
+
| Type | Purpose | Use Case |
|
|
248
|
+
|---|---|---|
|
|
249
|
+
| `Debug` | No optimization, full debug symbols (`-O0 -g`) | Day-to-day development |
|
|
250
|
+
| `Release` | Full optimization, no debug info (`-O3 -DNDEBUG`) | Production builds |
|
|
251
|
+
| `RelWithDebInfo` | Optimization with debug symbols (`-O2 -g -DNDEBUG`) | Production profiling, crash analysis |
|
|
252
|
+
| `MinSizeRel` | Optimize for binary size (`-Os -DNDEBUG`) | Embedded or size-constrained targets |
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
## Dependency Management
|
|
257
|
+
|
|
258
|
+
### vcpkg Manifest Mode (Preferred)
|
|
259
|
+
|
|
260
|
+
```json
|
|
261
|
+
{
|
|
262
|
+
"name": "myproject",
|
|
263
|
+
"version-string": "1.0.0",
|
|
264
|
+
"dependencies": [
|
|
265
|
+
"cjson",
|
|
266
|
+
"libcurl",
|
|
267
|
+
"libuv",
|
|
268
|
+
"libsodium"
|
|
269
|
+
],
|
|
270
|
+
"builtin-baseline": "a1a1cbc975e450accd1f5b7e4530e1378575f291"
|
|
271
|
+
}
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
```cmake
|
|
275
|
+
# In CMakePresets.json or command line
|
|
276
|
+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Conan 2 Alternative
|
|
280
|
+
|
|
281
|
+
```ini
|
|
282
|
+
# conanfile.txt
|
|
283
|
+
[requires]
|
|
284
|
+
cjson/1.7.17
|
|
285
|
+
libcurl/8.5.0
|
|
286
|
+
libuv/1.48.0
|
|
287
|
+
|
|
288
|
+
[generators]
|
|
289
|
+
CMakeDeps
|
|
290
|
+
CMakeToolchain
|
|
291
|
+
|
|
292
|
+
[layout]
|
|
293
|
+
cmake_layout
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
conan install . --build=missing
|
|
298
|
+
cmake --preset conan-release
|
|
299
|
+
cmake --build build/Release
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
### CMake FetchContent (For Small Dependencies)
|
|
303
|
+
|
|
304
|
+
```cmake
|
|
305
|
+
include(FetchContent)
|
|
306
|
+
|
|
307
|
+
FetchContent_Declare(
|
|
308
|
+
unity
|
|
309
|
+
GIT_REPOSITORY https://github.com/ThrowTheSwitch/Unity.git
|
|
310
|
+
GIT_TAG v2.6.0
|
|
311
|
+
)
|
|
312
|
+
FetchContent_MakeAvailable(unity)
|
|
313
|
+
|
|
314
|
+
target_link_libraries(test_user PRIVATE unity)
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
### Dependency Rules
|
|
318
|
+
|
|
319
|
+
- Use manifest mode (`vcpkg.json` or `conanfile.txt`), not ad-hoc installs
|
|
320
|
+
- Pin versions and baselines
|
|
321
|
+
- Update dependencies regularly (monthly or per sprint)
|
|
322
|
+
- Vendor test frameworks (Unity is a single .c/.h) when simplicity matters
|
|
323
|
+
- Prefer libraries with minimal transitive dependencies
|
|
324
|
+
|
|
325
|
+
---
|
|
326
|
+
|
|
327
|
+
## Header vs Source Organization
|
|
328
|
+
|
|
329
|
+
### Public vs Private Headers
|
|
330
|
+
|
|
331
|
+
```
|
|
332
|
+
include/myproject/ # Public API headers (installed with library)
|
|
333
|
+
user.h # Declarations only, minimal includes
|
|
334
|
+
config.h
|
|
335
|
+
error.h
|
|
336
|
+
src/
|
|
337
|
+
user.c # Implementations
|
|
338
|
+
config.c
|
|
339
|
+
internal/ # Private headers (not installed, not in public include path)
|
|
340
|
+
parser_internal.h
|
|
341
|
+
buffer_pool.h
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
### Include Order
|
|
345
|
+
|
|
346
|
+
```c
|
|
347
|
+
/* 1. Corresponding header (for .c files) */
|
|
348
|
+
#include "myproject/user.h"
|
|
349
|
+
|
|
350
|
+
/* 2. C standard library */
|
|
351
|
+
#include <stdio.h>
|
|
352
|
+
#include <stdlib.h>
|
|
353
|
+
#include <string.h>
|
|
354
|
+
|
|
355
|
+
/* 3. POSIX / system headers */
|
|
356
|
+
#include <unistd.h>
|
|
357
|
+
|
|
358
|
+
/* 4. Third-party libraries */
|
|
359
|
+
#include <cJSON.h>
|
|
360
|
+
|
|
361
|
+
/* 5. Project headers */
|
|
362
|
+
#include "myproject/config.h"
|
|
363
|
+
#include "myproject/error.h"
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
---
|
|
367
|
+
|
|
368
|
+
## Library vs Executable Targets
|
|
369
|
+
|
|
370
|
+
```cmake
|
|
371
|
+
# GOOD: Separate library from executable for testability
|
|
372
|
+
add_library(myproject_lib
|
|
373
|
+
src/user.c
|
|
374
|
+
src/config.c
|
|
375
|
+
src/error.c
|
|
376
|
+
)
|
|
377
|
+
target_include_directories(myproject_lib PUBLIC include PRIVATE src/internal)
|
|
378
|
+
|
|
379
|
+
# Main executable links against library
|
|
380
|
+
add_executable(myproject src/main.c)
|
|
381
|
+
target_link_libraries(myproject PRIVATE myproject_lib)
|
|
382
|
+
|
|
383
|
+
# Tests link against library (not executable)
|
|
384
|
+
add_executable(test_user tests/unit/test_user.c)
|
|
385
|
+
target_link_libraries(test_user PRIVATE myproject_lib unity)
|
|
386
|
+
add_test(NAME unit_user COMMAND test_user)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
```c
|
|
390
|
+
/* BAD: All code in main.c -- untestable */
|
|
391
|
+
int main(int argc, char *argv[]) {
|
|
392
|
+
/* 500 lines of business logic mixed with I/O */
|
|
393
|
+
}
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
---
|
|
397
|
+
|
|
398
|
+
## Documentation with Doxygen
|
|
399
|
+
|
|
400
|
+
### Function Documentation
|
|
401
|
+
|
|
402
|
+
```c
|
|
403
|
+
/**
|
|
404
|
+
* @brief Create a new user in the repository.
|
|
405
|
+
*
|
|
406
|
+
* Validates email uniqueness and allocates a new user record.
|
|
407
|
+
* Caller is responsible for freeing the user with user_free().
|
|
408
|
+
*
|
|
409
|
+
* @param[in] repo User repository handle.
|
|
410
|
+
* @param[in] req User creation request (name and email required).
|
|
411
|
+
* @param[out] out Populated user on success.
|
|
412
|
+
* @return ERR_OK on success, ERR_ALREADY_EXISTS if email is taken,
|
|
413
|
+
* ERR_NOMEM if allocation fails.
|
|
414
|
+
*
|
|
415
|
+
* @see user_free
|
|
416
|
+
* @see user_find_by_email
|
|
417
|
+
*/
|
|
418
|
+
int user_create(user_repo_t *repo, const create_request_t *req, user_t *out);
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Doxyfile Essentials
|
|
422
|
+
|
|
423
|
+
```bash
|
|
424
|
+
# Generate Doxygen config
|
|
425
|
+
doxygen -g
|
|
426
|
+
|
|
427
|
+
# Key settings
|
|
428
|
+
PROJECT_NAME = "MyProject"
|
|
429
|
+
INPUT = include/ src/
|
|
430
|
+
FILE_PATTERNS = *.h *.c
|
|
431
|
+
RECURSIVE = YES
|
|
432
|
+
EXTRACT_ALL = NO
|
|
433
|
+
EXTRACT_STATIC = NO
|
|
434
|
+
GENERATE_LATEX = NO
|
|
435
|
+
WARN_NO_PARAMDOC = YES
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
### When to Write Documentation
|
|
439
|
+
|
|
440
|
+
| Element | Documentation Required? |
|
|
441
|
+
|---|---|
|
|
442
|
+
| Public API function (in header) | Yes -- @brief, @param, @return |
|
|
443
|
+
| Opaque types | Yes -- describe purpose and ownership |
|
|
444
|
+
| Static (file-local) function | Only if non-obvious |
|
|
445
|
+
| Struct members | Yes if meaning not obvious from name |
|
|
446
|
+
| Macros | Yes -- document parameters and side effects |
|
|
447
|
+
| Test functions | No (test name is the doc) |
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## PR Review Checklist
|
|
452
|
+
|
|
453
|
+
### Author Checklist (Before Requesting Review)
|
|
454
|
+
|
|
455
|
+
- [ ] Tests pass locally (`ctest --test-dir build`)
|
|
456
|
+
- [ ] clang-tidy passes (`run-clang-tidy -p build`)
|
|
457
|
+
- [ ] clang-format applied (`clang-format -i ...`)
|
|
458
|
+
- [ ] No compiler warnings with `-Wall -Wextra -Werror`
|
|
459
|
+
- [ ] New features have tests
|
|
460
|
+
- [ ] No secrets or credentials committed
|
|
461
|
+
- [ ] PR description explains WHY, not just what
|
|
462
|
+
- [ ] All malloc/calloc calls have corresponding free paths
|
|
463
|
+
|
|
464
|
+
### Reviewer Checklist
|
|
465
|
+
|
|
466
|
+
- [ ] Code follows project naming conventions (snake_case, _t suffix)
|
|
467
|
+
- [ ] Error cases handled (return codes checked, goto cleanup used)
|
|
468
|
+
- [ ] No buffer overflows (bounds checked, snprintf over sprintf)
|
|
469
|
+
- [ ] No memory leaks (every allocation has a free path)
|
|
470
|
+
- [ ] Const correctness for pointer parameters
|
|
471
|
+
- [ ] Static for file-local functions
|
|
472
|
+
- [ ] Tests cover happy path and edge cases
|
|
473
|
+
|
|
474
|
+
---
|
|
475
|
+
|
|
476
|
+
## .gitignore
|
|
477
|
+
|
|
478
|
+
```gitignore
|
|
479
|
+
# Build artifacts
|
|
480
|
+
build/
|
|
481
|
+
build-*/
|
|
482
|
+
out/
|
|
483
|
+
|
|
484
|
+
# IDE
|
|
485
|
+
.vscode/settings.json
|
|
486
|
+
.idea/
|
|
487
|
+
*.swp
|
|
488
|
+
*~
|
|
489
|
+
|
|
490
|
+
# vcpkg
|
|
491
|
+
vcpkg_installed/
|
|
492
|
+
|
|
493
|
+
# Conan
|
|
494
|
+
CMakeUserPresets.json
|
|
495
|
+
|
|
496
|
+
# Coverage
|
|
497
|
+
*.gcda
|
|
498
|
+
*.gcno
|
|
499
|
+
coverage-report/
|
|
500
|
+
coverage.info
|
|
501
|
+
|
|
502
|
+
# Compiled objects
|
|
503
|
+
*.o
|
|
504
|
+
*.obj
|
|
505
|
+
*.a
|
|
506
|
+
*.so
|
|
507
|
+
*.dylib
|
|
508
|
+
*.exe
|
|
509
|
+
```
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
_Conventions reduce cognitive load. Follow them consistently so the team can focus on solving problems, not debating style._
|