Skip to content

feat: add ek import command#77

Merged
SiebeBaree merged 2 commits into
mainfrom
feature/v0.4.2
May 30, 2026
Merged

feat: add ek import command#77
SiebeBaree merged 2 commits into
mainfrom
feature/v0.4.2

Conversation

@SiebeBaree
Copy link
Copy Markdown
Member

@SiebeBaree SiebeBaree commented May 29, 2026

Summary by CodeRabbit

  • New Features

    • Import secrets: CLI command to import .env files into a workspace with guided interactive selection/creation of workspace, project, and environment; supports robust dotenv parsing (quotes, escapes, comments) and prompts to delete the source file after import
    • Local configuration: per-project .enkryptify.json files honored when resolving project config
  • Chores

    • Package version bumped to 0.4.2
  • Tests

    • Added and expanded unit and integration tests for import flow and local config handling

Review Change Stack

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 29, 2026

Walkthrough

This PR adds an import feature: a CLI import command plus parseDotenvContent to parse dotenv files (including quoted, multiline, and escaped values), client methods to select/create workspaces/projects/environments and POST secrets, local per-project config discovery via .enkryptify.json, command registration, and comprehensive unit and integration tests.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested reviewers

  • alizamili00
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.56% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title clearly and accurately describes the main feature added: a new import command for the CLI tool.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/v0.4.2

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/unit/import.test.ts`:
- Around line 47-49: The test currently reads a machine-specific absolute path;
change the fs.readFile call in tests/unit/import.test.ts to load a committed
fixture using a repo-relative path (build the path using __dirname and path.join
to a fixtures/test.env file) so the test reads the fixture cross-machine; keep
the rest of the test (parseDotenvContent usage) unchanged and ensure the fixture
file is committed under the test fixtures directory referenced.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9c532422-0ce8-4fac-8522-f725a4fdd96c

📥 Commits

Reviewing files that changed from the base of the PR and between 58a1729 and e397f7e.

📒 Files selected for processing (10)
  • package.json
  • src/api/client.ts
  • src/cmd/import.ts
  • src/cmd/index.ts
  • src/lib/config.ts
  • tests/helpers/fixtures.ts
  • tests/helpers/mock-api.ts
  • tests/integration/config.test.ts
  • tests/integration/import-command.test.ts
  • tests/unit/import.test.ts

Comment thread tests/unit/import.test.ts
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@tests/fixtures/test.env`:
- Line 14: Replace the credential-shaped secret value assigned to
STRIPE_SECRET_KEY with an obviously fake placeholder (e.g., use a clearly marked
token like sk_test_FAKE_PLACEHOLDER) and similarly replace any other
real-looking API keys or secrets in this fixture with parser-compatible fake
values; search for tokens that match secret patterns (e.g., STRIPE_SECRET_KEY
and other env entries in the same file) and update them to non-sensitive,
clearly fake placeholders while preserving the original formatting/quoting so
parsers/tests still exercise the same code paths.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 12385aeb-2b32-4e73-94ce-b0c26f5f4bbc

📥 Commits

Reviewing files that changed from the base of the PR and between e397f7e and 5ddba5f.

📒 Files selected for processing (2)
  • tests/fixtures/test.env
  • tests/unit/import.test.ts

Comment thread tests/fixtures/test.env
@SiebeBaree SiebeBaree merged commit d163c95 into main May 30, 2026
9 of 10 checks passed
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