Skip to content

feat: Add new edit secret command.#3

Merged
mikaeld merged 1 commit intomainfrom
edit-secrets
May 5, 2025
Merged

feat: Add new edit secret command.#3
mikaeld merged 1 commit intomainfrom
edit-secrets

Conversation

@mikaeld
Copy link
Owner

@mikaeld mikaeld commented May 5, 2025

Description

  • Edit secrets using system's default editor (configurable via EDITOR env var)
  • Content validation to prevent invalid JSON updates
  • Change detection to avoid unnecessary updates
  • Slight refactoring and general clean up, such as moving the preview modal screen to its own module

@mikaeld mikaeld requested a review from Copilot May 5, 2025 16:58
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new "edit secret" command that allows users to update secret values using their system’s default editor. Key changes include new tests in test_helpers for JSON validation and hash verification, new helper functions (validate_json_content and shasum) as well as an added add_secret_version utility in the GCP module, and significant updates to app.py to support secret editing and preview functionality.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/test_utils/test_helpers.py Added tests for JSON content validation and file hash computation
secrets_manager/utils/helpers.py Introduced utility functions for JSON validation and SHA256 checksum
secrets_manager/utils/gcp.py Updated functions to improve secret version listing and added version creation functionality
pyproject.toml Added new dependency "textual-dev"
app.py Added support for editing secrets via an external editor and refactored preview functionality

)
yield Pretty({}, id="pretty-preview")
with self.app.suspend():
os.system(f"{self.EDITOR} {temp_file.name}")
Copy link

Copilot AI May 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider quoting the file path in the os.system call to correctly handle paths with spaces. For example, wrap temp_file.name in quotes.

Suggested change
os.system(f"{self.EDITOR} {temp_file.name}")
os.system(f'{self.EDITOR} "{temp_file.name}"')

Copilot uses AI. Check for mistakes.
@mikaeld
Copy link
Owner Author

mikaeld commented May 5, 2025

image

@mikaeld mikaeld merged commit 7d19893 into main May 5, 2025
2 checks passed
@mikaeld mikaeld deleted the edit-secrets branch May 5, 2025 17:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant