Skip to content

Commit f187e11

Browse files
committed
Add docstrings
1 parent 547344b commit f187e11

7 files changed

Lines changed: 1527 additions & 264 deletions

File tree

AGENTS.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
Build and test
2+
3+
- Install deps: clj (tools.deps), Zig v0.13.0 required for native bits.
4+
- Build native libs and jar: bin/jextract-libs.sh && clj -T:build compile-app && clj -T:build jar
5+
- Run all Clojure tests (Kaocha): clj -M:test
6+
- Run a single test file (Kaocha): clj -M:test test/vybe/flecs_test.clj
7+
- Run OS-specific dev profile: clj -M:osx:dev -m vybe.raylib (change alias: :linux, :win)
8+
9+
Lint & format
10+
11+
- Lint with clj-kondo: clj-kondo --lint "src,src-java,test" (install clj-kondo separately)
12+
- Format with zprint or cljfmt if available: zprint :reformat src test
13+
14+
Code style (for agents)
15+
16+
- Namespace and imports: require namespaces with aliases and qualify long names. Keep :require lists grouped and aligned.
17+
- Naming: use kebab-case for functions and vars, PascalCase for records/protocol types if needed, UPPER_SNAKE for constants only when interoping with C.
18+
- Types & specs: annotate public functions with simple docstrings; prefer Malli/schema or clojure.spec for complex data shapes when present.
19+
- Small functions: prefer small, pure functions. Keep side-effects isolated (init/start/! functions clearly mark mutation).
20+
- Error handling: catch specific exceptions, log useful context, rethrow when caller must handle. Prefer non-fatal fallbacks and fail-fast for invalid invariants.
21+
- Formatting: follow 2-space indenting for Clojure forms, keep expressions short (<= 80-100 chars when reasonable).
22+
- Imports/interop: when calling native code, validate arguments and handle nils/invalid pointers gracefully; centralize FFI glue in dedicated namespaces (e.g. vybe.panama, vybe.c).
23+
- Tests: write deterministic tests, mock native interactions where possible, and use Kaocha metadata selectors to run focused suites.
24+
25+
Docstrings
26+
27+
- When adding or improving docstrings, edit only the string literal directly under the target `defn`/`defmacro`; never touch the surrounding code path.
28+
- Focus on public functions unless explicitly instructed; describe purpose, accepted inputs, return values, and edge cases when the behavior is subtle.
29+
- Docstrings for functions that accept option maps MUST document all supported option keys and their expected values or shapes (for example `:rt`, `:shaders`, `:frag`, `:uniforms`, etc.). This helps callers and automated tooling understand supported configurations.
30+
- Be cautious with patches so that embedded documentation maps or commented examples are not modified inadvertently; always re-read the diff around automated replacements.
31+
- Preserve balanced delimiters and existing quoting/escaping—docstring work must not introduce syntax changes.
32+
33+
REPL Usage (for agents)
34+
35+
- To evaluate Clojure code in the running REPL, use the clojure_evaluate_code tool specifying the code, namespace, and session key (usually 'clj').
36+
- To check the output of recent REPL evaluations, use the clojure_repl_output_log tool, starting with since-line=0 and incrementing as needed.
37+
- Example: To evaluate (+ 5 3) in the vybe.flecs namespace, call clojure_evaluate_code with code '(+ 5 3)', namespace 'vybe.flecs', replSessionKey 'clj'.
38+
- Always check the output tool for application logs, errors, or printed results after evaluation.
39+
- For more details, see the workspace attachments or ask for the latest REPL output if unsure about the current state.
40+
41+
When in doubt, mimic existing patterns in the repository (namespaces under `src/vybe`, test layout under `test/vybe`).

src-java/org/vybe/flecs/flecs.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9092,13 +9092,13 @@ public static long __DARWIN_C_LEVEL() {
90929092
}
90939093
/**
90949094
* {@snippet lang=c :
9095-
* #define __ASSERT_FILE_NAME "jextract$846603624491920567.h"
9095+
* #define __ASSERT_FILE_NAME "jextract$15484068087188406599.h"
90969096
* }
90979097
*/
90989098
public static MemorySegment __ASSERT_FILE_NAME() {
90999099
class Holder {
91009100
static final MemorySegment __ASSERT_FILE_NAME
9101-
= flecs.LIBRARY_ARENA.allocateFrom("jextract$846603624491920567.h");
9101+
= flecs.LIBRARY_ARENA.allocateFrom("jextract$15484068087188406599.h");
91029102
}
91039103
return Holder.__ASSERT_FILE_NAME;
91049104
}

0 commit comments

Comments
 (0)