Skip to content

Conversation

@GreenHacker420
Copy link
Contributor

Summary

Add the ability to copy environment variables from one project to another, enabling efficient configuration management across multiple environments.

Features Added

  • Selective copying: Use table row selection to choose specific variables to copy
  • Target project selection: Choose any project as the destination
  • Duplicate handling: Skip or overwrite existing variables in target project
  • Bulk operations: Copy multiple variables at once
  • Visual feedback: See detailed results (copied, updated, skipped counts)
  • Audit tracking: All copy operations logged in audit history

Use Cases

  • Multi-environment setup: Quickly duplicate configs from dev to staging/prod
  • Project templates: Copy common variables to new projects
  • Configuration sharing: Share standard variables across team projects
  • Environment migration: Move variables between different project setups

Technical Implementation

Backend

  • Added envvars:copy-to-project IPC handler in ipc-handlers.js
  • Validates source and target projects exist
  • Handles encryption/decryption during copy
  • Implements conflict resolution (skip/overwrite)
  • Creates audit log entries for all operations

Frontend

  • CopyToProjectModal: New modal component with:

    • Target project dropdown with search
    • Overwrite toggle for existing keys
    • Visual summary of source/target projects
    • Detailed operation notes and warnings
  • ProjectView enhancements:

    • Added row selection to environment variables table
    • "Copy to Project" button appears when rows are selected
    • Shows count of selected variables
    • Clears selection after successful copy
  • Dashboard updates:

    • Passes all projects to ProjectView for target selection

User Experience

  1. Select one or more variables using checkboxes
  2. Click "Copy to Project" button
  3. Choose target project from dropdown
  4. Toggle overwrite mode if needed
  5. Click "Copy Variables" to execute
  6. See detailed results of the operation

Security

  • All copied values remain encrypted
  • Uses the same master key for encryption
  • Maintains data integrity during transfer
  • Audit logs track all copy operations

Testing

  • Tested copying single and multiple variables
  • Verified skip mode (preserves existing values)
  • Verified overwrite mode (updates existing values)
  • Confirmed encryption is maintained
  • Checked audit log entries are created
  • Tested with empty target projects
  • Tested with projects having conflicts

Screenshots

The feature adds:

  • Checkbox selection in the variables table
  • "Copy to Project (N)" button when variables are selected
  • Modal with target project selection and options
  • Success messages with operation details

- Add copy-to-project IPC handler with conflict resolution
- Support selective copying with row selection in table
- Add CopyToProjectModal with target project selection
- Handle duplicate keys with skip/overwrite options
- Track all copy operations in audit logs
- Show detailed feedback (copied, updated, skipped counts)
- Enable bulk operations for efficient workflow
- Maintain encryption during copy operations
Copy link
Contributor

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 adds functionality to copy environment variables from one project to another, enabling efficient configuration management across multiple environments. The feature provides selective copying with duplicate handling and audit tracking.

Key changes:

  • Added table row selection to choose specific variables for copying
  • Implemented copy-to-project modal with target selection and overwrite options
  • Created backend IPC handler for secure variable copying with encryption preservation

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/components/ProjectView.jsx Added row selection, copy button, and CopyToProjectModal integration
src/components/Dashboard.jsx Passed allProjects prop to ProjectView for target selection
src/components/CopyToProjectModal.jsx New modal component for target project selection and copy operations
electron/preload.js Added copyToProject API exposure to renderer process
electron/ipc-handlers.js Implemented envvars:copy-to-project handler with validation and audit logging

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@@ -0,0 +1,190 @@
import { useState, useEffect } from 'react';
import { Modal, Select, Switch, message, Alert, Tag, Space } from 'antd';
import { Copy } from 'lucide-react';
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

Mixed icon libraries usage. The component uses Ant Design icons elsewhere in the codebase (like SwapOutlined in ProjectView), but imports Copy from lucide-react. Consider using CopyOutlined from @ant-design/icons for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +79 to +82
<div className="flex items-center gap-2">
<Copy className="w-5 h-5" />
<span>Copy Variables to Another Project</span>
</div>
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

Using Tailwind CSS classes alongside Ant Design components. This project appears to use Ant Design's styling system, so consider using Ant Design's Space component and theme tokens instead of Tailwind classes for consistency.

Suggested change
<div className="flex items-center gap-2">
<Copy className="w-5 h-5" />
<span>Copy Variables to Another Project</span>
</div>
<Space align="center">
<Copy style={{ width: 20, height: 20 }} />
<span>Copy Variables to Another Project</span>
</Space>

Copilot uses AI. Check for mistakes.
width={550}
destroyOnClose
>
<div className="space-y-4">
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

Using Tailwind CSS classes alongside Ant Design components. This project appears to use Ant Design's styling system, so consider using Ant Design's Space component and theme tokens instead of Tailwind classes for consistency.

Copilot uses AI. Check for mistakes.
<label className="block text-sm font-medium mb-2">
Source Project
</label>
<div className="p-3 bg-gray-800 rounded-lg">
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

Using Tailwind CSS classes alongside Ant Design components. This project appears to use Ant Design's styling system, so consider using Ant Design's Space component and theme tokens instead of Tailwind classes for consistency.

Copilot uses AI. Check for mistakes.
Comment on lines +347 to +349
// Decrypt and re-encrypt (in case keys are different, though they're not in this app)
const value = decrypt(envVar.encryptedValue, masterKey);
const encryptedValue = encrypt(value, masterKey);
Copy link

Copilot AI Oct 11, 2025

Choose a reason for hiding this comment

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

Unnecessary decrypt/encrypt cycle when using the same master key. Since the comment acknowledges keys are the same, you can directly copy the encryptedValue without decryption/re-encryption to improve performance.

Suggested change
// Decrypt and re-encrypt (in case keys are different, though they're not in this app)
const value = decrypt(envVar.encryptedValue, masterKey);
const encryptedValue = encrypt(value, masterKey);
// Keys are the same, so we can directly copy the encryptedValue for better performance
const encryptedValue = envVar.encryptedValue;

Copilot uses AI. Check for mistakes.
@GreenHacker420
Copy link
Contributor Author

Closing this PR due to conflicts. Will recreate based on the Node.js migration branch (PR #7).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants