Custom Package
What you’ll build: A JS package that adds a custom hello bin to fishbowl.
Prerequisites: Hello World →
What is a package?
Section titled “What is a package?”A fishbowl package is an ESM bundle that exports an Extension — a plain object describing bins, fileservers, mounts, and init services to wire into a system image when the package is installed.
Write the extension
Section titled “Write the extension”Extensions are isomorphic — the same code runs in Node.js and the browser.
import type { Extension } from '@fishnet/core'
export default function myPackage(): Extension { return { bins: { hello: async (proc) => { const name = proc.argv[1] ?? 'world' await proc.stdout.write(`Hello, ${name}!\n`) return 0 }, }, }}Use it directly
Section titled “Use it directly”import { Unix } from '@fishnet/core'import { stdSystem } from '@fishnet/core/presets'import { nodeRuntime } from '@fishnet/runtime/platform/node'import myPackage from './src/index.ts'
const image = Unix().use(stdSystem()).use(myPackage()).build()const instance = await image.boot(nodeRuntime())// hello Alice → "Hello, Alice!"Publish to a registry
Section titled “Publish to a registry”Coming soon — the registry tooling is in active development. For now, packages can be embedded directly or served from a static HTTP server using the registry-tools package.
Further reading
Section titled “Further reading”- Extension interface → — Full Extension type reference
- Packages architecture → — Registry, resolver, evaluator internals
ProcContext→ — The interface bins receive