Toolchain Overview
Kibu Toolchain
Kibu provides a suite of code generation and analysis tools that eliminate boilerplate and enable type-safe communication across your stack.
Core Tools
| Tool | Purpose | Documentation |
|---|---|---|
| kibumod | Service definition analyzer | Reference |
| kibugenv2 | Go plumbing code generator | Reference |
| kibuwire | Wire dependency injection generator | Reference |
| kibugen_ts | TypeScript client generator | Reference |
How It Works
The toolchain follows a pipeline pattern:
Go Source Code │ ▼┌─────────┐│ kibumod │ ← Analyzes interfaces with //kibu: decorators└────┬────┘ │ ▼┌───────────┐ ┌────────────┐│ kibugenv2 │ ──► │ kibuwire │└─────┬─────┘ └─────┬──────┘ │ │ ▼ ▼ *.gen.go kibuwire.gen.go │ ▼┌────────────┐│ kibugen_ts │└─────┬──────┘ │ ▼ *.gen.tsQuick Start
Install the toolchain:
go install github.com/google/wire/cmd/wire@latestgo install github.com/kibu-sh/kibu/internal/toolchain/kibugenv2/cmd/kibugenv2@maingo install github.com/kibu-sh/kibu/internal/toolchain/kibuwire/cmd/kibuwire@maingo install github.com/kibu-sh/kibu/internal/toolchain/kibugen_ts/cmd/kibugen_ts@mainCreate a generate.go file:
package generate
//go:generate kibugenv2 ./...//go:generate kibuwire ./...//go:generate kibugen_ts -output ./frontend/src/api ./...Run generation:
go generate ./...Decorator-Driven Development
Kibu uses comment directives (decorators) to annotate your code:
// UserService handles user operations////kibu:servicetype UserService interface { //kibu:service:method method=GET path=/users/{id} GetUser(ctx context.Context, req GetUserRequest) (GetUserResponse, error)}See the Decorators Reference for all available decorators.
Generated Artifacts
| Tool | Output | Purpose |
|---|---|---|
| kibugenv2 | *.gen.go | Controllers, clients, workflow interfaces |
| kibuwire | kibuwire/kibuwire.gen.go | Wire provider sets |
| kibugen_ts | *.gen.ts | TypeScript types and service clients |
Best Practices
- Don’t edit generated files - They’re overwritten on each generation
- Commit generated files - Include in version control for CI/CD
- Run in order - kibugenv2 before kibuwire, both before kibugen_ts
- Use go:generate - Centralize generation in a single file