Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions docs/resources/(resources)/env-file.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
title: env-file
description: A reference page for the env-file resource
---

The env-file resource manages a single `.env` file at a specified directory. It supports writing key-value pairs directly or syncing the file from Codify cloud. The resource is marked sensitive and will not be automatically imported.

## Parameters

- **dir** *(string, required)*: The directory where the env file is located.
- **name** *(string, optional)*: The filename. Defaults to `.env`. Use this to manage files like `.env.local`, `.dev.vars`, or `.env.production`.
- **contents** *(array[object], optional)*: Key-value pairs to write into the file. Each entry has `key` (string) and `value` (string). Mutually exclusive with `remoteFile`.
- **remoteFile** *(string, optional)*: A Codify cloud file reference (`codify://<documentId>:<fileName>`). The file is downloaded and written on each apply. Mutually exclusive with `contents`.

## Example usage

### Declare env file contents

```json title="codify.jsonc"
[
{
"type": "env-file",
"dir": "~/projects/my-app",
"contents": [
{ "key": "DATABASE_URL", "value": "postgres://localhost:5432/mydb" },
{ "key": "API_KEY", "value": "<Replace me here!>" },
{ "key": "DEBUG", "value": "false" }
]
}
]
```

### Use a named env file

```json title="codify.jsonc"
[
{
"type": "env-file",
"dir": "~/projects/my-worker",
"name": ".dev.vars",
"contents": [
{ "key": "API_TOKEN", "value": "<Replace me here!>" }
]
}
]
```

### Sync from Codify cloud

```json title="codify.jsonc"
[
{
"type": "env-file",
"dir": "~/projects/my-app",
"name": ".env.local",
"remoteFile": "codify://<documentId>:<fileName>"
}
]
```

## Notes

- The resource is marked as **sensitive**: values in `contents` are not shown in plan output.
- Import is disabled (`preventImport: true`) — existing `.env` files on the system are never automatically imported.
- Both `contents` and `remoteFile` cannot be specified at the same time.
- Multiple `env-file` resources can coexist in the same directory as long as they use different `name` values.
72 changes: 72 additions & 0 deletions docs/resources/(resources)/env-files.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
title: env-files
description: A reference page for the env-files resource
---

The env-files resource manages multiple `.env` files inside a single directory. It is useful for projects that rely on several env files at once (e.g. `.env`, `.env.local`, `.dev.vars`). The resource is marked sensitive and will not be automatically imported.

## Parameters

- **dir** *(string, required)*: The directory containing the env files.
- **envFiles** *(array[object], required)*: The env files to manage. Each entry has:
- **name** *(string, required)*: The filename (e.g. `.env`, `.env.local`, `.dev.vars`).
- **contents** *(array[object], optional)*: Key-value pairs written into the file. Each entry has `key` and `value` strings. Mutually exclusive with `remoteFile`.
- **remoteFile** *(string, optional)*: A Codify cloud file reference (`codify://<documentId>:<fileName>`). Mutually exclusive with `contents`.

## Example usage

### Manage multiple Cloudflare Worker env files

```json title="codify.jsonc"
[
{
"type": "env-files",
"dir": "~/projects/my-worker",
"envFiles": [
{
"name": ".dev.vars",
"contents": [
{ "key": "API_TOKEN", "value": "<Replace me here!>" },
{ "key": "ENVIRONMENT", "value": "development" }
]
},
{
"name": ".env.production",
"contents": [
{ "key": "API_TOKEN", "value": "<Replace me here!>" },
{ "key": "ENVIRONMENT", "value": "production" }
]
}
]
}
]
```

### Sync multiple env files from Codify cloud

```json title="codify.jsonc"
[
{
"type": "env-files",
"dir": "~/projects/my-app",
"envFiles": [
{
"name": ".env",
"remoteFile": "codify://<documentId>:<fileName>"
},
{
"name": ".env.local",
"remoteFile": "codify://<documentId>:<fileName>"
}
]
}
]
```

## Notes

- The resource is marked as **sensitive**: values in `contents` are not shown in plan output.
- Import is disabled (`preventImport: true`) — existing env files on the system are never automatically imported.
- Only one `env-files` resource per directory is allowed. Use multiple `env-file` resources if you prefer managing files individually.
- Within each `envFiles` entry, `contents` and `remoteFile` cannot both be specified.
- When an entry is removed from `envFiles` during modify, the corresponding file is deleted from disk.
6 changes: 4 additions & 2 deletions docs/resources/(resources)/macos-settings.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ All sections and their sub-keys are optional. You only need to declare the setti
| `position` | `"left"` \| `"bottom"` \| `"right"` | `"bottom"` | Position of the Dock on screen. |
| `iconSize` | integer (16–128) | `48` | Dock icon size in pixels. |
| `autohide` | boolean | `false` | Automatically hide and show the Dock when the cursor moves near the screen edge. |
| `autohideDelay` | number | `0.2` | Seconds to wait before showing the Dock when it is hidden. Set to `0` for instant reveal. |
| `hoverDelay` | number | `0.2` | Seconds to wait before the Dock appears when hovering near the screen edge. Set to `0` for instant reveal. |
| `animationSpeed` | number | `0.5` | Duration in seconds of the Dock slide-in/out animation. Set to `0` to disable the animation entirely. |
| `showRecents` | boolean | `true` | Show recently opened apps in a dedicated section of the Dock. |
| `minimizeEffect` | `"genie"` \| `"scale"` \| `"suck"` | `"genie"` | Window minimize animation style. |

Expand All @@ -62,7 +63,8 @@ The table below shows the underlying `defaults` key used for each friendly param
| dock | `position` | `com.apple.dock` | `orientation` |
| dock | `iconSize` | `com.apple.dock` | `tilesize` |
| dock | `autohide` | `com.apple.dock` | `autohide` |
| dock | `autohideDelay` | `com.apple.dock` | `autohide-delay` |
| dock | `hoverDelay` | `com.apple.dock` | `autohide-delay` |
| dock | `animationSpeed` | `com.apple.dock` | `autohide-time-modifier` |
| dock | `showRecents` | `com.apple.dock` | `show-recents` |
| dock | `minimizeEffect` | `com.apple.dock` | `mineffect` |

Expand Down
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "default",
"version": "1.5.0",
"version": "1.6.0",
"description": "Default plugin for Codify - provides 50+ declarative resources for managing development tools and system configuration across macOS and Linux",
"main": "dist/index.js",
"scripts": {
Expand Down Expand Up @@ -41,7 +41,7 @@
"license": "ISC",
"type": "module",
"dependencies": {
"@codifycli/plugin-core": "1.2.0",
"@codifycli/plugin-core": "1.2.2",
"@codifycli/schemas": "1.2.0",
"ajv": "^8.18.0",
"ajv-formats": "^2.1.1",
Expand Down
4 changes: 4 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import { AwsProfileResource } from './resources/aws-cli/profile/aws-profile.js';
import { DnfResource } from './resources/dnf/dnf.js';
import { GoenvResource } from './resources/go/goenv/goenv.js';
import { DockerResource } from './resources/docker/docker.js';
import { EnvFileResource } from './resources/file/env-file/env-file-resource.js';
import { EnvFilesResource } from './resources/file/env-file/env-files-resource.js';
import { FileResource } from './resources/file/file.js';
import { RemoteFileResource } from './resources/file/remote-file.js';
import { GitResource } from './resources/git/git/git-resource.js';
Expand Down Expand Up @@ -98,6 +100,8 @@ runPlugin(Plugin.create(
new ActionResource(),
new FileResource(),
new RemoteFileResource(),
new EnvFileResource(),
new EnvFilesResource(),
new Virtualenv(),
new VirtualenvProject(),
new Pnpm(),
Expand Down
Loading
Loading