docs-stale-watcher — Turn stale-content events into GitHub Issues
Workflow#
- Verify MCP transport — call
list_workspacesas a connectivity probe. If it fails, print the MCP connection command and exit gracefully. - Resolve staleness threshold — accept a configurable number of days (default 180). Pages untouched for longer than this threshold will trigger an event.
- Generate the handler workflow — produce a GitHub Actions workflow that fires on
repository_dispatchwithevent_type: docsbook.content.outdated. For each page path in the payload, the workflow opens a GitHub Issue linking to the source file and explaining the staleness criterion. - Write the workflow file — place it at
.github/workflows/docsbook-stale-handler.yml, creating the directory if needed. Overwrite if the file already exists. - Register the webhook — generate or use the provided HMAC secret and call
register_webhook_content_outdatedwith the target URL pointing to the GitHub repository dispatches endpoint. - Report — print a summary of the workflow path, webhook target, staleness threshold, secret handling instructions, and a note about the backend dependency.
Guardrails#
- If
register_webhook_content_outdatedreturns anot_implementedorplan_restrictederror, surface the error verbatim and stop — do not delete the workflow file already written to disk. - Never delete a partially written workflow file on webhook registration failure — the file is useful once the backend ships the event.
- The webhook delivery depends on the Docsbook backend emitting
content.outdatedevents. Make this dependency explicit in the output so the user understands the file is ready but events may not arrive yet. - Keep the HMAC secret instruction clear: the user must add it as a repository secret to verify incoming payloads.
MCP Tools#
| Tool | Purpose |
|---|---|
list_workspaces |
Probe MCP transport liveness |
register_webhook_content_outdated |
Register the content.outdated webhook on the workspace |
Acceptance Criteria#
- MCP transport verified before any mutation
- Staleness threshold applied (default 180 days or user-supplied value)
- Workflow file written to
.github/workflows/docsbook-stale-handler.yml - Workflow triggers on
repository_dispatchwith the correctevent_type - Webhook registered with an HMAC secret; secret surfaced once to the user
- Registration failure (
not_implemented/plan_restricted) reported verbatim without deleting the workflow file - Backend dependency noted clearly in the output
- Output includes workflow path, webhook target, threshold, and secret instructions