Revise README for surf-api documentation#333
Merged
twisti-dev merged 1 commit intoversion/26.1from May 2, 2026
Merged
Conversation
Updated README to provide a comprehensive overview of surf-api, including module structure, key concepts, getting started instructions, and notable dependencies.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR replaces the minimal existing README with a comprehensive introduction to surf-api, documenting its purpose, module layout, key architectural concepts (service discovery + component system), build commands, conventions, and notable dependencies.
Changes:
- Expanded README with project overview, module structure, and key concepts (ServiceLoader bridges + KSP-discovered components).
- Added “Getting Started” build/run commands and repository conventions (Kotlin features, logging, shading, package layout).
- Documented dependency highlights and contribution guidelines.
Comment on lines
+54
to
+58
| │ ├── surf-api-shared-public # Public shared annotations (@ComponentMeta, etc.) | ||
| │ └── surf-api-shared-internal # Internal shared utilities | ||
| │ | ||
| ├── surf-api-gradle-plugin # Gradle convention plugins & KSP processor | ||
| │ └── surf-api-processor # KSP processor — discovers @ComponentMeta at compile time |
|
|
||
| #### 2. Component System — Lifecycle-managed components | ||
|
|
||
| Classes annotated with `@ComponentMeta` (or the meta-annotations `@Service` / `@Repository`) are |
Comment on lines
+63
to
+65
| > **API/Implementation split:** `-api` modules define public interfaces consumed by downstream | ||
| > projects. `-server` modules contain implementations that are shaded into the final JAR and never | ||
| > exposed as a public API dependency. |
Comment on lines
+225
to
+230
| - **API changes** go in `-api` modules. **Never** expose `-server` types in the public API. | ||
| - **Implementations** go in `-server` modules. | ||
| - **New components**: annotate with `@ComponentMeta` / `@Service` / `@Repository` and implement the | ||
| appropriate lifecycle methods. | ||
| - **New NMS bridges**: declare the interface in `-api`, implement in `-server`, register via | ||
| `@AutoService`, and call `checkInstantiationByServiceLoader()` in the `init` block. |
Comment on lines
+54
to
+58
| │ ├── surf-api-shared-public # Public shared annotations (@ComponentMeta, etc.) | ||
| │ └── surf-api-shared-internal # Internal shared utilities | ||
| │ | ||
| ├── surf-api-gradle-plugin # Gradle convention plugins & KSP processor | ||
| │ └── surf-api-processor # KSP processor — discovers @ComponentMeta at compile time |
|
|
||
| Classes annotated with `@ComponentMeta` (or the meta-annotations `@Service` / `@Repository`) are | ||
| discovered at compile-time by the KSP processor, which writes JSON metadata to | ||
| `META-INF/surfapi/components/`. At runtime, `ComponentService`: |
Comment on lines
+83
to
+98
| interface SurfBukkitNmsCommonBridge { | ||
| fun nextEntityId(): Int | ||
|
|
||
| companion object : SurfBukkitNmsCommonBridge by requiredService() | ||
| } | ||
|
|
||
| // In -server: provide the implementation | ||
| @AutoService(SurfBukkitNmsCommonBridge::class) | ||
| class SurfBukkitNmsCommonBridgeImpl : SurfBukkitNmsCommonBridge { | ||
| init { checkInstantiationByServiceLoader() } | ||
|
|
||
| override fun nextEntityId(): Int = TODO() | ||
| } | ||
|
|
||
| // Usage — callers go through the companion, unaware of the implementation | ||
| val id = SurfBukkitNmsCommonBridge.nextEntityId() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Updated README to provide a comprehensive overview of surf-api, including module structure, key concepts, getting started instructions, and notable dependencies.