feat(cli): maintenance-windows topic + monitors test --config#31
Merged
feat(cli): maintenance-windows topic + monitors test --config#31
Conversation
Maintenance windows are a state-only resource (intentionally not exposed in `devhelm.yml` or as a Terraform resource) used to suppress alerts during planned changes. Wires the existing `/api/v1/maintenance-windows` endpoints into five oclif commands and registers a topic description in package.json. The list command supports the server-supported `--status active|upcoming` filter and a `--monitor <id>` filter. Create accepts `--start`, `--end`, `--reason`, and either `--monitor <id>` or `--org-wide` (the API stores a single monitorId, with null meaning org-wide). Update fetches the current window and back-fills timestamps when the user provides a partial change, so `update <id> --reason "Rescheduled"` works without re-passing start/end. Cancel maps to DELETE with the same confirmation prompt as the generic delete factory. Adds shared `buildMaintenanceWindowBody` plus unit tests, and threads the two new request DTOs into `extract-descriptions.mjs` so flag descriptions track the OpenAPI spec. Co-authored-by: Cursor <cursoragent@cursor.com>
…dation Today `devhelm monitors test <id>` runs a probe against an existing monitor. This adds a sibling entry point: `devhelm monitors test --config <file>` reads a YAML or JSON file, validates it against the generated `CreateMonitorRequest` Zod schema, and (when validation passes) dispatches the test subset to the existing `/api/v1/monitors/test` ad-hoc endpoint so the user sees a real probe result before deciding to save the monitor. The id arg is now optional so the same command supports both flows. Passing both an id and `--config` errors out — there's no scenario where a live test against an existing monitor and a dry-run of a proposed config make sense in one shot. Validation errors print with field paths so `name`, `managedBy`, and config-discriminator failures all surface a clear actionable message instead of bouncing off a server 400. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two CLI features for v1 launch, both touching only the CLI repo (no
SDK / MCP / mono changes).
1.
devhelm maintenance-windowstopic — NEWMaintenance windows let users suppress alerts during planned downtime.
Per the v1 launch decision, they're state, not infrastructure: imperative
CLI commands only. Intentionally not added to
devhelm.yml/config-loader, and intentionally not a Terraform resource — this PR
does not touch
src/lib/yaml/**or any deploy-YAML schema.Five new commands wire the existing
/api/v1/maintenance-windowsendpoints:maintenance-windows listGET /api/v1/maintenance-windowsmaintenance-windows get <id>GET .../{id}maintenance-windows createPOST .../maintenance-windows update <id>PUT .../{id}maintenance-windows cancel <id>DELETE .../{id}Divergence from the original task spec (constrained by the API):
monitorIdper window (ornullfor org-wide), so--monitoris single-value and we added--org-wideinstead of repeatableflags. There's no
--componentbecause the API doesn't model that.active|upcoming(the only values the server understands).cancelleddoesn't apply (cancel = DELETE → 404 on the list endpoint).CreateMaintenanceWindowRequesthas nomanagedByfield on the wire,so we don't synthesise one client-side.
The package.json
oclif.topicsentry uses the requested copy:2.
devhelm monitors test --config <file>— NEW flagmonitors test <id>already runs a live probe against an existing monitor.This adds the sibling flow:
CreateMonitorRequestpayload.field-path error messages.
MonitorTestRequestsubset to the existing/api/v1/monitors/testendpoint so the user sees a real probe result for the proposed config.
<id>and--configis a hard error.Sample invocations
Test plan
npm run typecheckcleannpm run lintcleannpm test— 36 files / 998 tests pass (20 new tests across 3 new files)npm run build && oclif manifest— manifest registers all 5maintenance-windows:*commands--helpagainstbin/dev.jsfor each new command + themodified
monitors testmalformed config files, missing config files, invalid Zod payloads —
all produce clear actionable errors
Constraints honoured
src/lib/yaml/**(deploy YAML / config-loader untouched)apiSchemas.generated.tsshape — only fed two existingrequest DTOs into
extract-descriptions.mjsso flag help text tracksthe OpenAPI spec
cli/— no SDK, MCP, or mono changesMade with Cursor