fix: type safety overhaul, bug fixes, and hardening#3
Closed
Conversation
Type safety:
- Regenerate api.generated.ts from latest spec (actor param removed, /auth/me added)
- Remove all `as any` from standalone commands — full typed paths and responses
- Confine remaining `as any` to CRUD factory (crud-commands.ts) with documented rationale
Bug fixes:
- Notification policy update: only send explicitly passed fields (was sending "undefined")
- Alert channel --config: wrap JSON.parse in try/catch with user-friendly error
- Corrupt contexts.json: graceful fallback instead of crash
- Remove default org/workspace ID '1' fallback — only send when explicitly set
- Wire up handleApiError for structured AuthError/DevhelmError with proper exit codes
- Add MCP_SERVER to validate.ts VALID_TYPES
- Fix monitors/results field names to match DTO (responseTimeMs, timestamp, passed)
- Fix data/services path param {slug} → {slugOrId}
- Fix api-keys/revoke path param type (string → number)
Hardening:
- auth context create: validate token before saving (--skip-validation to bypass)
- File permissions: contexts.json 0o600, .devhelm/ dir 0o700
- Init template: interval → frequency to match CLI flags
- Fix environment color flag description (was pulling from wrong schema)
- Consistent token prefix examples (dh_live_...)
- data/services/uptime: period and granularity options match spec enums
CI:
- spec-check.yml: add JSON validation step, include descriptions.generated.ts in auto-PR
Made-with: Cursor
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
as anyfrom standalone commands (20 files). Only the CRUD factory (crud-commands.ts) retains 5 intentional casts for dynamic path construction, documented.handleApiErrornow routes throughcheckedFetchfor properAuthError/DevhelmErrorexit codes.descriptions.generated.tsin auto-PR.Test plan
npm run build— cleannpm run lint— 0 errors (1 pre-existing warning in output.ts)npm test— 2/2 passnpx tsc --noEmit— cleandevhelm auth login,devhelm monitors list,devhelm statusMade with Cursor