Plugin configuration
cordis.yml.Complete your first plugin first. Replace the absolute path below with your checkout path, as in that tutorial; a patch does not change the directory used to resolve plugin modules.
Define the Config type
Export a Config type and a same-named Schemastery schema. Put defaults directly on the schema fields:
Add the configuration to the inserted local plugin row in scratch-plugin/cordis.yml:
When loading the plugin, Cordis uses the exported schema to validate configuration and fill defaults. Do not export a plain object as Config; it does not implement the Standard Schema interface required by Cordis.
Schema validation
Use Schemastery to express stricter validation:
The schema runs while the plugin loads. Invalid configuration fails the load with an actionable error.
Design principles
Do not hardcode tunable values
Harness requires anything that two deployments may want to set differently to be a configuration field.
The test is whether cordis.yml can change the value without a code edit.
Fail loudly on invalid configuration
Express self-contained constraints in the schema so invalid configuration fails while the plugin loads. References to services or registered resources require dependency injection; the services tutorial introduces that contract.
Apply and verify
Stop the tutorial command and restart it after changing the source or patch. With the example above, the terminal prints Hi there. Replace maxRetries: 5 with maxRetries: wrong-type, restart, and inspect the plugin-load validation error. Restore the valid value before continuing. This workflow does not rely on automatic source or overlay reloading.
Next steps
- Package and install a plugin — ship the plugin as an installable package
- Plugins and lifecycle — understand the full plugin lifecycle
- Services and dependencies — provide a service to other plugins