Initiatives
Initiatives track long-running codebase improvements as engineer-defined numeric counts. You decide what one item means. Dev Herald stores each count against the commit it was measured on and shows how it changes.
What to count
Each initiative has one or more metrics. A metric is a named count with a label, an optional unit, a target, and a direction (lower or higher is better).
Two counts cover most migrations:
- Affected files — how widely the remaining work is spread. A file with 40 legacy usages and a file with one usage each count as one file.
- Remaining occurrences — how many individual things still need changing, such as legacy component usages, API calls, or
@ts-ignoredirectives.
Other counts use the same fields. Skipped tests, or workspaces still on an old build, are just another named count. They are not separate product features.
Remaining work is the default story. A metric that aims down toward zero is shown as 412 → 388 occurrences remaining and 24 removed. Dev Herald does not show a percentage of the migration completed, because the size of the repository can change.
Create an initiative
Open a project in the dashboard and choose Initiatives. Give it a name and a slug. The slug is what the health action sends, and it stays fixed once the first snapshot exists.
Example metrics for moving off Emotion:
| Label | Key | Unit | Target | Direction |
|---|---|---|---|---|
| Affected files | files | files | 0 | Lower is better |
| Remaining occurrences | usages | occurrences | 0 | Lower is better |
Post a baseline snapshot
On the default branch, post the counts with dev-herald/health. Run it on a schedule or on every push to that branch. Those counts are the baseline snapshot pull requests are compared against.
Copy the slug and each metric key from the dashboard. Every metric key defined on a named initiative must be present. Initiatives you omit are left unchanged. Set initiatives (inline YAML or JSON) or initiatives-path (a JSON or YAML file). The action accepts one of those inputs. Omit both to skip measurements. Sending the same commit again replaces that snapshot.
- name: Upload health data
uses: dev-herald/health@v1
with:
api-key: ${{ secrets.DEV_HERALD_API_KEY }}
initiatives: |
emotion-to-panda:
files: 12
usages: 96A run that only sends counts sets the action status output to measured. A run that also uploads health signals creates the report first (created) and shares one timestamp with the snapshot.
Official history is these default-branch snapshots. The progress page charts each metric and draws the target. Health Reports include the latest snapshot at or before that report, with a link to the progress page.
Your script decides how to count. Dev Herald only stores and compares the numbers.
Compare a pull request
On the pull request, send the branch’s current counts with dev-herald/comment and template: INITIATIVE. Dev Herald compares those numbers to the latest snapshot and posts the change.
- name: Post initiative progress
uses: dev-herald/comment@v1
with:
api-key: ${{ secrets.DEV_HERALD_API_KEY }}
pr-number: ${{ github.event.pull_request.number }}
template: INITIATIVE
sticky-id: initiatives
template-data: |
{
"initiatives": {
"emotion-to-panda": { "files": 10, "usages": 80 }
}
}Without a snapshot on the default branch, the comment says a measurement is required before it can show how the pull request changes the count. See Initiative comparison for the template fields.
Custom CI
dev-herald/health posts snapshots to POST /api/v1/initiatives/measurements with the project API key. A custom runner can call that endpoint directly. The body is the commit, the time, and slug-keyed counts. Unknown slugs, unknown metric keys, and archived initiatives fail the request. See the API Reference for the schema.