DartCodeAI Plugin Authoring
This guide covers the backend plugin authoring surface used by Enterprise and Enhanced DartCodeAI teams.
Lifecycle
-
Choose a template from
dartcodeai/backend/suite/plugin_templates. -
Run
dart pub getin the template repository. -
Generate or edit
plugin.yaml. -
Validate with
dartcodeai plugins manifest validate plugin.yaml. -
Run locally with
dartcodeai plugins dev --watch. -
Test with
dart testanddartcodeai plugins test-harness run. -
Publish with
dartcodeai plugins publish --manifest plugin.yaml --bundle ..
SDK
Plugin authors import package:dartcodeai_plugin/dartcodeai_plugin.dart.
The SDK exposes:
-
PluginEntrypointwithFuture<void> onEvent(PluginEvent event, PluginContext ctx). -
PluginContextwithworkspaceId,repoId,installId,scopes, and a short-livedjwt. -
PluginLoggerfor structured runtime logs. -
PluginMetricsfor counters, gauges, and histograms. -
PluginArtifactsfor runtime artifactput()andget(). -
PluginSecrets.getRef()for resolving runtime secret references without persistence. -
DcaiHttpClientfor allowlisted Enterprise egress. -
ConfigSchemafor simple required-field checks.
Scopes
Scopes are declared in plugin.yaml and enforced by the runtime:
-
repo:read -
runs:read -
artifacts:read -
artifacts:write -
reports:write -
events:read -
webhooks:write -
secrets:read -
logs:write -
metrics:write
Use the narrowest scopes possible. Runtime credentials are short-lived and should not be stored by plugins.
Events
Common event names:
-
qa.run.requested -
qa.run.completed -
coverage.report.ready -
release.gate.failed -
sync.requested
Events contain a type string and an arbitrary JSON payload.
Manifest Init
The CLI module exposes POST /cli/plugins/manifest/init for the manifest wizard
backend. The response includes a normalized manifest map and a pluginYaml
string that can be written to plugin.yaml.
Required manifest fields:
-
name -
version -
type -
entrypoint -
visibility -
scopes
Troubleshooting
-
If
plugins manifest validatefails, fix the reportedpathentries before running or publishing. -
If
plugins dev --watchfails immediately, check the entrypoint command and package dependencies. -
If publish returns
pending_signature, provide a KMS-backed signature or use a public visibility manifest that does not require signing. -
If a plugin cannot reach an external service, confirm the destination host is allowlisted for the tenant.
Cookbook
Slack Notifier
-
Start from
plugin-notifier-template. -
Add
webhookUrltoconfigSchema.required. -
Subscribe to
qa.run.completed. -
In
onEvent, format a short message and send it through the runtime HTTP client once the Slack host is allowlisted.