Kennel Base Utilities
OpenPets SDK now includes shared kennel utilities so host-specific kennels can reuse config and read-only logic instead of duplicating it.
Exports
The SDK exposes:
createKennel(config)loadPetConfig(targetDir)savePetConfig(targetDir, config)setEnvForPet(petId, envVars, targetDir)setReadOnlyMode(petId, enabled, targetDir)discoverPets(targetDir)
Minimal kennel entry point
Use createKennel to declare host compatibility and keep entry points small.
ts
import { createPlugin } from "openpets-sdk"
import { createKennel, discoverPets, loadPetConfig } from "../../src/sdk/kennel"
const kennel = createKennel({
name: "my-host",
compatibleHosts: ["my-host"]
})
export default async function MyHostKennel() {
const targetDir = kennel.projectDir
const pets = discoverPets(targetDir)
const config = loadPetConfig(targetDir)
return createPlugin([
// host-specific tools
])
}Refactoring pattern
When migrating an existing kennel:
- Replace local
.pets/config.jsonparsing withloadPetConfig/savePetConfig - Replace per-kennel env writers with
setEnvForPet - Replace per-kennel read-only setters/checks with
setReadOnlyMode - Replace ad-hoc enabled/disabled discovery with
discoverPets
This keeps kennel-specific code focused on host behavior instead of shared config plumbing.