@henkaku-center/chi-base
v0.1.0
Published
Shared coordination infrastructure for Chi Pi extensions.
Readme
Chi Base
Chi Base is the shared coordination package for Chi modules running as Pi extensions. It discovers modules, initializes them in dependency order, stores versioned global/project configuration, and provides a small /chi settings command.
Install
The repository is currently private and Chi Base is not yet published to npm. Authenticate GitHub first with the GitHub CLI, then install it from Git:
gh auth login
gh auth setup-git
pi install https://github.com/henkaku-center/chi-baseSSH is also supported when your SSH key is configured:
pi install git:[email protected]:henkaku-center/chi-baseWhen the package is published, use npm:@henkaku-center/chi-base instead. See the
Pi package installation and update documentation
for package management details.
Update
Update this GitHub package with:
pi update https://github.com/henkaku-center/chi-baseTo update Pi and all installed packages at once, use pi update --all.
Chi Base is installed once. Individual Chi modules listen for the chi:discover event and register with the live registry supplied in that event.
Module authors
Import the contract as types only:
import type { ChiBase } from "@henkaku-center/chi-base/contract";Runtime communication uses the ChiBase object received from discovery. See the Chi concepts glossary, how to write a module, the module contract, configuration and migrations, and the example module.
Configuration
Chi configuration is separate from Pi settings:
- Global: ~/.pi/agent/chi/config.json
- Project: .pi/chi/config.json
Project configuration is used only for trusted projects. Settings changed by
/chi are persisted immediately. Modules with onConfigChange receive the new
effective configuration while running; modules without it can read the latest
value with chi.getConfig(id). Initialization is not repeated.
The /chi editor uses one tab per module. It starts in project mode when the
trusted project has a loaded local override, and otherwise starts in global
mode. It supports p for project scope, arrow keys or h/l for tabs, and
x to reset the selected setting. Its header shows the active scope, and its
custom list uses use default (value) and use global (value) fallback labels
without repeating scope in row names. See configuration and migrations
for the complete behavior.
Scope
Chi Base is intentionally small. It is not a general event bus, storage framework, module loader, or arbitrary settings editor. Modules communicate through direct APIs exposed by the registry.
