Skip to content

Revise README for surf-api documentation#333

Merged
twisti-dev merged 1 commit intoversion/26.1from
twisti-dev-patch-1
May 2, 2026
Merged

Revise README for surf-api documentation#333
twisti-dev merged 1 commit intoversion/26.1from
twisti-dev-patch-1

Conversation

@twisti-dev
Copy link
Copy Markdown
Contributor

Updated README to provide a comprehensive overview of surf-api, including module structure, key concepts, getting started instructions, and notable dependencies.

Updated README to provide a comprehensive overview of surf-api, including module structure, key concepts, getting started instructions, and notable dependencies.
@twisti-dev twisti-dev self-assigned this May 2, 2026
Copilot AI review requested due to automatic review settings May 2, 2026 15:59
@twisti-dev twisti-dev merged commit fa21bd6 into version/26.1 May 2, 2026
6 checks passed
@twisti-dev twisti-dev deleted the twisti-dev-patch-1 branch May 2, 2026 16:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread README.md
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
Comment thread README.md

#### 2. Component System — Lifecycle-managed components

Classes annotated with `@ComponentMeta` (or the meta-annotations `@Service` / `@Repository`) are
Comment thread README.md
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 thread README.md
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 thread README.md
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
Comment thread README.md

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 thread README.md
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()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants