Document config wizard auto-detect and migration#293
Closed
clcollins wants to merge 14 commits into
Closed
Conversation
Re-escalation uses the incident's own policy — no config needed. Only silencing needs a target policy. Replace the full service-to-policy mapping with a single default_silent_escalation_policy key (1 API call at startup) plus optional custom_service_escalation_policies overrides. --pick-teams now auto-discovers silent policies via ListEscalationPoliciesWithContext and presents them for selection. Old service_escalation_policies config still works with deprecation warning. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ListEscalationPolicies(TeamIDs) misses silent policies not directly tagged on the team. Replace auto-discovery with explicit user prompts: text input for default silent policy ID (validated via API) and optional comma-separated service:policy custom mappings. Remove launchTUI() call after setup to avoid terminal glitch. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Work in progress — merging token/teams/policies into single huh.Form using OptionsFunc for dynamic team loading. Still needs the two-form merge completed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace the standalone huh form in cmd/config.go with an inline config mode inside the srepd TUI, following the existing team picker pattern. The wizard now renders inside the same tea.Program with srepd's styles, header, footer, and help system. Key changes: - Extract pure config functions to pkg/config/ package - Add configMode to TUI model with full huh form (token, teams, silent policy, custom mappings, summary+confirm) - Simplify cmd/config.go to thin launcher that sets configMode flag - Auto-detect missing config file in cmd/root.go and enter wizard - Initialize PD client asynchronously after config save - Forward non-key messages to huh form for proper rendering - Defer config form creation until WindowSizeMsg arrives Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use pointer-based configFormState struct so huh form Value() bindings survive bubbletea's model copying. Previously form writes went to stale model copies, causing teams/silent/custom values to be lost on save. Also fix form completion detection: check StateCompleted in the catch-all message forwarding path, not just the key message handler, since the form may complete on non-key messages. Additionally initialize PD client asynchronously after config save and trigger window resize to render the incident table. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Show "(unchanged)" label on all summary fields, not just token - Uppercase custom policy keys from Viper (which lowercases map keys) - Remove "No config file found" stdout message (invisible under alt-screen) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Fetch team names eagerly in prepareConfigWizardCmd so they display in the summary even when teams are kept (bug #24) - Add token validation via PD API on the token input field — prevents advancing to team selection with an invalid token (bug #27) - Detect old-format config (service_escalation_policies) and force writing new-format keys on save even when values are unchanged, triggering migration to default_silent_escalation_policy and custom_service_escalation_policies (bug #28) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fetch escalation policy names from PD API during wizard preparation. Display team and policy names alongside IDs in keep prompts and summary (e.g., "Silent Test (PCGXUDY)" instead of bare "PCGXUDY"). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Show "Loading configuration..." instead of the incident table while configModeRequested is true but the config form hasn't been built yet. This prevents a brief flash of the empty table view before the wizard appears. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The completion handler cleared configMode but not configModeRequested, causing View() to show "Loading configuration..." permanently after the wizard saved. Now both flags are cleared on completion and abort. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- CommentOutOldPolicies() comments out service_escalation_policies block with a deprecation note when new-format keys are written - BuildSummary shows policy names in custom mappings display (e.g., "P5LAB5Y → DMS Silent Test (PVBANNN)") Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace default huh keymap with one that removes misleading "esc back" help text (esc is disabled in huh) and adds ctrl+q to quit binding. Only shift+tab for back, enter for next — matches actual behavior. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Suppress srepd's own help bar (with "esc back", "h help") while in config mode. The huh form renders its own contextual help internally. After the wizard exits, srepd's normal help bar returns. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each wizard prompt now includes guidance on where to find the required data in PagerDuty: - Token: how to create an API key - Teams: select teams whose incidents you monitor - Silent policy: where to find escalation policy IDs - Custom mappings: where to find service and policy IDs Also set form width to windowSize.Width for proper text wrapping. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.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
service_escalation_policiesformatTest plan
🤖 Generated with Claude Code