Skip to content

feat: snipemgr edit <integration> — open config in $EDITOR #22

Description

@jackvaughanjr

Summary

Add snipemgr edit <integration> to open the installed integration's settings.yaml (or Secret Manager secret) in $EDITOR. A shortcut for users who prefer direct config editing over the interactive wizard.

Motivation

The install wizard is good for first-time setup but cumbersome for small config tweaks. Power users who already know the config structure want to open the file directly and edit it — same as kubectl edit or git config --global -e.

Usage

snipemgr edit github2snipe
# Opens the integration's config in $EDITOR
# On save + quit, updated values are written back to Secret Manager

Behavior

  1. Fetch the current config for github2snipe from Secret Manager
  2. Write it to a temporary file (e.g. /tmp/snipemgr-github2snipe-<pid>.yaml)
  3. Open $EDITOR (fallback: $VISUAL, then vi) with the temp file
  4. On editor exit: diff the temp file against the original
  5. If changed: prompt for confirmation, then write updated values back to Secret Manager
  6. If unchanged: print "no changes" and exit
  7. Always delete the temp file on exit (including on error/interrupt)

Acceptance criteria

  • snipemgr edit <integration> opens the config in $EDITOR / $VISUAL / vi
  • On save + quit, changed values are written back to Secret Manager
  • If the editor exits without changes, no update is made
  • The temp file is always cleaned up, including on Ctrl-C
  • If the updated config fails validation (missing required fields), print the errors and prompt to re-edit or abort
  • If the integration is not installed, print a clear error

Security notes

  • The temp file contains plaintext credentials — write it to a directory with 0700 permissions and use 0600 file mode
  • Delete the temp file with os.Remove in a defer block — ensure cleanup even on panic
  • Do not log the temp file path at INFO level

Implementation notes

  • No external dependency needed — exec.Command($EDITOR, tmpfile) with Stdin/Stdout/Stderr wired to os.Stdin/Stdout/Stderr is sufficient
  • The temp file format should be YAML, matching settings.example.yaml structure

Metadata

Metadata

Assignees

No one assigned

    Labels

    tier-4Nice to have, low priority

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions