AI Draft
AI-assisted draft. This page is the quick map for the entity package and its role in the Slingshot platform.
Summary
Section titled “Summary”@lastshotlabs/slingshot-entity is the entity-definition and code-generation package for Slingshot. It gives package authors a DSL for declaring entities and operations, plus the tooling that turns those declarations into types, schemas, adapters, routes, and migrations. It also publishes definePackage-aware runtime factories so feature packages can author entities directly inside their createXxxPackage() factory.
This package lives between core contracts and real feature packages. Core owns the shared types. Entity turns those types into authoring tools and runtime wiring. Feature packages such as community consume the DSL and the package-authoring helpers.
Main Capabilities
Section titled “Main Capabilities”defineEntity()and field builders for entity definitionsdefineOperations()andop.*()builders for declarative operationsentity()anddefinePackage()runtime composition (re-exported from core)generate()for pure source generation- migration diffing and snapshot support
createEntityPlugin()— lower-level escape hatch invoked internally bycompilePackages()runPackageLifecycle()andcreateLazyMiddleware()test/runtime helpers
Two Modes
Section titled “Two Modes”The package has both developer-time and runtime responsibilities.
Developer-time
Section titled “Developer-time”- declare entities
- declare operations
- generate source output
- plan migrations
Runtime
Section titled “Runtime”- build bare entity routes
- apply route config
- assemble entity-aware package lifecycles via
compilePackages() - wire cascades and channel forwarding
Why This Package Matters
Section titled “Why This Package Matters”This is the main bridge between Slingshot’s definePackage(...) authoring story and real feature packages. If a feature can be expressed cleanly with this package, Slingshot gets closer to a world where routes, policies, and side effects are declared once and reused.
Reading Order
Section titled “Reading Order”src/defineEntity.tssrc/defineOperations.tssrc/generate.tssrc/createEntityPlugin.tssrc/packageAuthoring.tssrc/migrations/
Good Follow-Ups
Section titled “Good Follow-Ups”- Use the human guide for the non-negotiable invariants around purity and framework boundaries.
- Pair this package with
slingshot-coredocs to understand where contracts end and tooling begins. - Look at
slingshot-communityfor the main production consumer pattern.