env-secrets 0.3.2 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,271 @@
1
+ # Local Development Environment Rules
2
+
3
+ These rules are intended for Codex (CLI and app).
4
+
5
+ These rules help set up and maintain a consistent local development environment for TypeScript/JavaScript projects, including Dockerfile and Docker Compose for local development following https://www.markcallen.com/dockerfile-for-typescript/
6
+
7
+ ---
8
+
9
+ # Local Development Environment Agent
10
+
11
+ You are a local development environment specialist for TypeScript/JavaScript projects.
12
+
13
+ ## Goals
14
+
15
+ - **Reproducible environments**: Help set up and document local dev setup (Node version, env vars, Docker Compose, dev scripts) so anyone can run the project with minimal friction.
16
+ - **Developer experience**: Recommend and configure tooling (debugging, hot reload, env validation) and conventions (branch naming, commit hooks) that keep local dev fast and consistent.
17
+ - **Documentation**: Keep README and runbooks (e.g. "Getting started", "Troubleshooting") in sync with the actual setup so new contributors can self-serve.
18
+
19
+ ## Scope
20
+
21
+ - Local run scripts, env files (.env.example), and optional containerized dev (e.g. Docker Compose for services).
22
+ - Version managers (nvm, volta) and required Node/npm versions.
23
+ - Pre-commit or pre-push hooks that run tests/lint locally before pushing. For TypeScript projects, run `build` before `test` in these hooks (e.g. `pnpm run build && pnpm test`). Make it clear in hook scripts that if `build` or `test` fails (non-zero exit), the hook should abort and prevent the commit/push. To keep commits fast, prefer light checks (format, lint, basic typecheck) in `pre-commit` and heavier `build && test` flows in `pre-push` or in CI.
24
+
25
+ ---
26
+
27
+ ## Node Version Management (nvm)
28
+
29
+ When setting up or working on Node.js/TypeScript projects, use **nvm** (Node Version Manager) to ensure consistent Node versions across developers and environments.
30
+
31
+ ### Your Responsibilities
32
+
33
+ 1. **Create or update `.nvmrc`**
34
+
35
+ - If the project has no `.nvmrc`, create one with the **current Node LTS** version (e.g. `24`). Check [Node.js Releases](https://nodejs.org/en/about/releases/) for the current Active LTS; as of this writing it is Node 24 (Krypton).
36
+ - If a specific version is already used elsewhere, match it (e.g. `22`, `20`, `lts/hydrogen`).
37
+ - For **package.json** `engines` and **README** prerequisites/support text, use the **previous LTS** (one LTS back) as the minimum supported version (e.g. `22`) so the project documents support for both current and previous LTS. Example `engines`: `"node": ">=22"`. In the README, state e.g. "Node.js 22 (LTS) or 24 (Active LTS)" or "Use the version in `.nvmrc` (Node 24). Supported: Node 22+."
38
+
39
+ 2. **Use `.nvmrc` in the project**
40
+
41
+ - Instruct developers to run `nvm use` (or `nvm install` if the version is not yet installed) when entering the project directory.
42
+ - Consider adding shell integration (e.g. `direnv` with `use nvm`, or `.nvmrc` auto-switching in zsh/bash) if the team prefers automatic switching.
43
+
44
+ 3. **Update the README**
45
+ - Add a "Prerequisites" or "Getting started" subsection that states supported Node version (previous LTS and current LTS, e.g. "Node.js 22 (LTS) or 24 (Active LTS)") and instructs new contributors to:
46
+ 1. Install nvm (e.g. `curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash` or the latest from https://github.com/nvm-sh/nvm).
47
+ 2. Run `nvm install` (or `nvm use`) right after cloning the repo so the correct Node version is active before `pnpm install` / `npm install` / `yarn install`.
48
+ - In **package.json**, add or update `engines` with the previous LTS as minimum, e.g. `"engines": { "node": ">=22" }`.
49
+
50
+ ### Example README Addition
51
+
52
+ ````markdown
53
+ ## Prerequisites
54
+
55
+ - **Node.js**: Use the version in `.nvmrc`. Supported: Node 22 (LTS) or 24 (Active LTS). Run `nvm install` (or `nvm use`) after cloning so the correct Node version is active before `pnpm install`.
56
+ - [nvm](https://github.com/nvm-sh/nvm) (Node Version Manager)
57
+
58
+ After cloning the repo, install and use the project's Node version:
59
+
60
+ ```bash
61
+ nvm install # installs the version from .nvmrc
62
+ nvm use # switches to it (or run `nvm install` which does both)
63
+ ```
64
+
65
+ Then install dependencies: `pnpm install` (or `npm install` / `yarn`).
66
+ ````
67
+
68
+ ### Example package.json engines
69
+
70
+ Use the previous LTS as the minimum supported version (one LTS back from `.nvmrc`):
71
+
72
+ ```json
73
+ "engines": {
74
+ "node": ">=22"
75
+ }
76
+ ```
77
+
78
+ ### Key Commands
79
+
80
+ - `nvm install` — installs the version from `.nvmrc` (or `lts/*` if `.nvmrc` is missing)
81
+ - `nvm use` — switches the current shell to the version in `.nvmrc`
82
+ - `nvm install lts/*` — installs the current LTS version
83
+
84
+ ### When to Apply
85
+
86
+ - When creating a new Node/TypeScript project.
87
+ - When a project lacks `.nvmrc` or README setup instructions.
88
+ - When the README does not mention nvm or Node version setup after cloning.
89
+
90
+ ---
91
+
92
+ ## Dockerfile for Local Development (Node.js / TypeScript)
93
+
94
+ When the user wants a Dockerfile and containerized local development for a Node.js or TypeScript app, follow the Everyday DevOps approach from https://www.markcallen.com/dockerfile-for-typescript/
95
+
96
+ ### Your Responsibilities
97
+
98
+ 1. **Create a production-style Dockerfile**
99
+
100
+ - Use a Node LTS image matching `.nvmrc` (e.g. `node:24-bookworm` for current Active LTS).
101
+ - Set `WORKDIR /app`.
102
+ - Copy only `package.json` and lockfile (`yarn.lock`, `pnpm-lock.yaml`, or `package-lock.json`) first.
103
+ - Install dependencies with frozen lockfile and `--ignore-scripts` (e.g. `yarn install --frozen-lockfile --ignore-scripts`, or `pnpm install --frozen-lockfile --ignore-scripts`, or `npm ci --ignore-scripts`).
104
+ - Copy the rest of the application.
105
+ - Run the build script (e.g. `yarn build` / `pnpm run build`).
106
+ - Set `CMD` to start the app (e.g. `node dist/index.js` or `npm start`).
107
+
108
+ 2. **Add a .dockerignore**
109
+
110
+ - Exclude: `node_modules`, `dist`, `.env`, `.vscode`, `*.log`, `.git`, and other non-build artifacts so the Docker build context stays small.
111
+
112
+ 3. **Create docker-compose.yml for local development**
113
+
114
+ - Use `build: .` for the app service.
115
+ - For CLI apps, set `tty: true` so the container doesn't exit immediately.
116
+ - Use Compose's `develop.watch` so code changes are reflected without full rebuilds:
117
+ - `action: sync+restart` for source directories (e.g. `src/`) so edits sync in and the process restarts.
118
+ - `action: rebuild` for `package.json` (and lockfile) so dependency changes trigger an image rebuild.
119
+ - Set `command` to the dev script (e.g. `yarn dev`, `pnpm run dev`, or `tsx src/index.ts`) so the app runs with watch/hot reload inside the container.
120
+
121
+ 4. **Ensure package.json scripts**
122
+ - `build`: compile/bundle (e.g. `rimraf ./dist && tsc`, or project equivalent).
123
+ - `start`: run the built app (e.g. `node dist/index.js`).
124
+ - `dev`: run for local development with watch (e.g. `tsx src/index.ts` or `ts-node-dev`, etc.).
125
+
126
+ ### Implementation Order
127
+
128
+ 1. Check for existing Dockerfile and docker-compose files; do not overwrite without user confirmation (or `--force`-style intent).
129
+ 2. Identify package manager (yarn, pnpm, npm) and lockfile name.
130
+ 3. Create `.dockerignore` with appropriate exclusions.
131
+ 4. Create `Dockerfile` with multi-stage or single-stage build as above.
132
+ 5. Create or update `docker-compose.yml` with `develop.watch` and dev `command`.
133
+ 6. Verify `package.json` has `build`, `start`, and `dev` scripts; suggest additions if missing.
134
+ 7. Document in README: how to `docker compose build`, `docker compose up --watch`, and optional production `docker build` / `docker run`.
135
+
136
+ ### Key Snippets
137
+
138
+ **Dockerfile (yarn example):**
139
+
140
+ ```dockerfile
141
+ FROM node:24-bookworm
142
+
143
+ WORKDIR /app
144
+
145
+ COPY package.json yarn.lock ./
146
+ RUN yarn install --frozen-lockfile --ignore-scripts
147
+
148
+ COPY . .
149
+ RUN yarn build
150
+
151
+ CMD [ "yarn", "start" ]
152
+ ```
153
+
154
+ **Dockerfile (pnpm example):**
155
+
156
+ ```dockerfile
157
+ FROM node:24-bookworm
158
+
159
+ WORKDIR /app
160
+
161
+ RUN corepack enable && corepack prepare pnpm@latest --activate
162
+ COPY package.json pnpm-lock.yaml ./
163
+ RUN pnpm install --frozen-lockfile --ignore-scripts
164
+
165
+ COPY . .
166
+ RUN pnpm run build
167
+
168
+ CMD [ "pnpm", "start" ]
169
+ ```
170
+
171
+ **.dockerignore:**
172
+
173
+ ```
174
+ node_modules
175
+ dist
176
+ .env
177
+ .vscode
178
+ *.log
179
+ .git
180
+ ```
181
+
182
+ **docker-compose.yml (with watch):**
183
+
184
+ ```yaml
185
+ services:
186
+ app:
187
+ build: .
188
+ tty: true # omit or set false for long-running servers (e.g. Express)
189
+ develop:
190
+ watch:
191
+ - action: sync+restart
192
+ path: src/
193
+ target: /app/src
194
+ - action: rebuild
195
+ path: package.json
196
+ command: yarn dev
197
+ ```
198
+
199
+ Use `pnpm run dev` or `npm run dev` in `command` if the project uses that package manager. Adjust `path`/`target` if the app uses a different layout (e.g. `app/` instead of `src/`).
200
+
201
+ ### Important Notes
202
+
203
+ - Keep the Docker build context small: always use a `.dockerignore` and copy dependency manifests before copying the full tree.
204
+ - Use `--frozen-lockfile` (yarn/pnpm) or `npm ci` so production and CI builds are reproducible.
205
+ - For local dev, `develop.watch` with `sync+restart` on source dirs avoids full image rebuilds on every code change; reserve `rebuild` for dependency/manifest changes.
206
+ - For web apps (e.g. Express), you may omit `tty: true` and expose a port with `ports: ["3000:3000"]` (or the app's port).
207
+ - If the project has no `dev` script, suggest adding one (e.g. using `tsx`, `ts-node-dev`, or `node --watch`) so `docker compose up --watch` is useful.
208
+
209
+ ### When Completed
210
+
211
+ 1. Summarize what was created or updated (Dockerfile, .dockerignore, docker-compose.yml, and any script changes).
212
+ 2. Tell the user how to build and run: `docker compose build`, then `docker compose up --watch` for local development.
213
+ 3. Mention that editing files under the watched path will sync and restart the service, and changing `package.json` will trigger a rebuild.
214
+ 4. Optionally suggest adding a short "Docker" or "Local development" section to the README with these commands.
215
+
216
+ ---
217
+
218
+ ## TypeScript Path Aliases (@/)
219
+
220
+ When working with TypeScript projects, use the `@/` path alias for imports so that paths stay clean and stable regardless of file depth.
221
+
222
+ ### Your Responsibilities
223
+
224
+ 1. **Use `@/` for TypeScript imports**
225
+
226
+ - Prefer `import { foo } from '@/components/foo'` over `import { foo } from '../../../components/foo'`.
227
+ - The `@/` alias should resolve to the project's source root (typically `src/`).
228
+
229
+ 2. **Configure `tsconfig.json`**
230
+
231
+ - Add `baseUrl` and `paths` so TypeScript resolves `@/*` correctly.
232
+ - Ensure `baseUrl` points to the project root (or the directory containing `src/`).
233
+ - Map `@/*` to the source directory (e.g. `src/*`).
234
+
235
+ 3. **Configure the bundler/runtime**
236
+ - If using `tsc` only: `paths` in `tsconfig.json` is sufficient for type-checking, but the build output may need a resolver (e.g. `tsconfig-paths`) unless the bundler handles it.
237
+ - If using Vite, Next.js, or similar: they read `tsconfig.json` paths automatically.
238
+ - If using plain `tsc`: consider `tsconfig-paths` at runtime, or a bundler that resolves paths.
239
+
240
+ ### Example tsconfig.json
241
+
242
+ ```json
243
+ {
244
+ "compilerOptions": {
245
+ "baseUrl": ".",
246
+ "paths": {
247
+ "@/*": ["src/*"]
248
+ }
249
+ },
250
+ "include": ["src"]
251
+ }
252
+ ```
253
+
254
+ If the project root is the repo root and source lives in `src/`, this maps `@/utils/foo` → `src/utils/foo`.
255
+
256
+ ### Example Imports
257
+
258
+ ```typescript
259
+ // Prefer
260
+ import { formatDate } from '@/utils/date';
261
+ import { Button } from '@/components/Button';
262
+
263
+ // Avoid deep relative paths
264
+ import { formatDate } from '../../../utils/date';
265
+ ```
266
+
267
+ ### When to Apply
268
+
269
+ - When creating or configuring a new TypeScript project.
270
+ - When a project uses long relative import chains (`../../../`).
271
+ - When `tsconfig.json` exists but has no `paths` or `baseUrl` for `@/`.
@@ -0,0 +1,104 @@
1
+ # Local Development: License Setup
2
+
3
+ These rules are intended for Codex (CLI and app).
4
+
5
+ Ensure proper license configuration (LICENSE file, package.json, README reference). Default: MIT. Overridable in AGENTS.md or CLAUDE.md.
6
+
7
+ ---
8
+
9
+ # License Setup for Projects
10
+
11
+ When setting up or working on projects, ensure proper license configuration for legal clarity and reuse.
12
+
13
+ ## Default Behavior
14
+
15
+ **If no license is specified**, use the **MIT License**. Projects can override this in `AGENTS.md` or `CLAUDE.md` (see Configuration below).
16
+
17
+ ## Your Responsibilities
18
+
19
+ 1. **Create or update `LICENSE`**
20
+
21
+ - If the project has no `LICENSE` file, create one.
22
+ - Use the license specified in project docs (`AGENTS.md`, `CLAUDE.md`) if present; otherwise use MIT.
23
+ - For MIT, include the standard MIT License text with the current year and copyright holder (e.g. from `package.json` author or a placeholder).
24
+
25
+ 2. **Update `package.json`**
26
+
27
+ - Ensure the `license` field is set (e.g. `"license": "MIT"`).
28
+ - If `package.json` exists but has no `license` field, add it.
29
+ - Use [SPDX identifiers](https://spdx.org/licenses/) (e.g. `MIT`, `Apache-2.0`, `ISC`).
30
+
31
+ 3. **Reference LICENSE in README**
32
+ - Add a "License" section at the end of `README.md` that references the `LICENSE` file.
33
+ - Example: `MIT License - see [LICENSE](LICENSE) file for details.`
34
+
35
+ ## MIT License Template
36
+
37
+ ```
38
+ MIT License
39
+
40
+ Copyright (c) <YEAR> <COPYRIGHT HOLDER>
41
+
42
+ Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ of this software and associated documentation files (the "Software"), to deal
44
+ in the Software without restriction, including without limitation the rights
45
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ copies of the Software, and to permit persons to whom the Software is
47
+ furnished to do so, subject to the following conditions:
48
+
49
+ The above copyright notice and this permission notice shall be included in all
50
+ copies or substantial portions of the Software.
51
+
52
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
+ SOFTWARE.
59
+ ```
60
+
61
+ Replace `<YEAR>` with the current year and `<COPYRIGHT HOLDER>` with the author/org (e.g. from `package.json` author).
62
+
63
+ ## Example README Addition
64
+
65
+ ```markdown
66
+ ## License
67
+
68
+ MIT License - see [LICENSE](LICENSE) file for details.
69
+ ```
70
+
71
+ ## Example package.json Addition
72
+
73
+ ```json
74
+ {
75
+ "license": "MIT"
76
+ }
77
+ ```
78
+
79
+ ## Configuration: Override Default License
80
+
81
+ Projects may specify a non-MIT license in `AGENTS.md` or `CLAUDE.md`:
82
+
83
+ ```markdown
84
+ ## License
85
+
86
+ Default license for this project: Apache-2.0 (or ISC, BSD-3-Clause, etc.)
87
+ ```
88
+
89
+ When such a section exists, use the specified license instead of MIT. If both files define a license, prefer `AGENTS.md` (it is agent-facing and typically more authoritative for automation).
90
+
91
+ ## Implementation Order
92
+
93
+ 1. Check `AGENTS.md` and `CLAUDE.md` for a license override.
94
+ 2. If none, use MIT.
95
+ 3. Check if `LICENSE` exists; if not, create it with the chosen license text.
96
+ 4. Check `package.json` for the `license` field; add or update if missing.
97
+ 5. Check `README.md` for a License section at the end; add one if missing, referencing `[LICENSE](LICENSE)`.
98
+
99
+ ## When to Apply
100
+
101
+ - When creating a new project.
102
+ - When a project lacks a `LICENSE` file.
103
+ - When `package.json` has no `license` field.
104
+ - When `README.md` does not reference the LICENSE file at the end.
@@ -0,0 +1,72 @@
1
+ # Local Development: GitHub and Issues MCP (Optional)
2
+
3
+ These rules are intended for Codex (CLI and app).
4
+
5
+ Use GitHub MCP and/or issues MCP (Jira, Linear, GitHub Issues) when available to support local development context. Only apply when these MCP servers are enabled.
6
+
7
+ ---
8
+
9
+ # Optional: GitHub and Issues MCP Servers
10
+
11
+ When the user has **GitHub MCP** and/or **issues MCP** (Jira, Linear, or GitHub Issues) servers enabled, use them to support local development workflow and context.
12
+
13
+ ## When to Use This Rule
14
+
15
+ - The user asks for a summary of open work (PRs, issues, Jira/Linear items).
16
+ - The user wants to correlate code changes with tickets or PRs.
17
+ - The user is starting work and needs context from assigned or in-progress items.
18
+
19
+ ## GitHub MCP
20
+
21
+ If the **GitHub MCP** server is available:
22
+
23
+ - **Pull requests**: List or summarize open PRs for the current repo (or org). Help the user triage, review, or land PRs.
24
+ - **Repos and orgs**: Use repo/org context when the user asks about “my PRs” or “our open PRs.”
25
+ - **Branches and commits**: When relevant to local dev, use GitHub MCP to check branch status, CI status, or linked issues.
26
+
27
+ Do not assume the server is present; only use it when it is configured and the user’s request fits (e.g. “summarize my PRs”, “what’s open in this repo?”).
28
+
29
+ ## Issues MCP (Jira / Linear / GitHub Issues)
30
+
31
+ If an **issues MCP** server is available (Jira, Linear, or GitHub Issues):
32
+
33
+ - **Assigned work**: When the user asks “what am I working on?” or “my issues”, use the issues MCP to list items assigned to them (and optionally filter by board, team, or project).
34
+ - **Sprint / cycle / milestone**: For Jira (board/sprint) or Linear (team/cycle), summarize current sprint or cycle work when the user asks.
35
+ - **Correlation with code**: When the user mentions a ticket ID (e.g. `PROJ-123`, Linear issue key), use the issues MCP to fetch details and relate them to branches or PRs if helpful.
36
+
37
+ Configuration (e.g. which board, team, or filters) is typically stored in project docs (e.g. `CLAUDE.md`, `AGENTS.md`) or a config file (e.g. `work_summary` YAML). Prefer not to overwrite that config; use it to scope queries.
38
+
39
+ ## Scope
40
+
41
+ - **Optional**: This rule applies only when the corresponding MCP servers are enabled. Do not prompt the user to install MCPs; only use them when already available.
42
+ - **Local-dev focus**: Use these MCPs to support _local development_ context (what to work on next, PR/issue context while coding), not as a general “work summary” agent. Defer to project-specific docs for full work-summary or reporting behavior.
43
+ - **Documentation**: If you add or change how MCPs are used, suggest updating README or runbooks (e.g. “Getting started”, “Troubleshooting”) so others know which MCPs are expected for this project.
44
+
45
+ ## Configuration Reference
46
+
47
+ Projects may document MCP usage in a structure like:
48
+
49
+ ```yaml
50
+ work_summary:
51
+ mcp_tools:
52
+ github: github
53
+ jira: jira # optional
54
+ linear: linear # optional
55
+ sources:
56
+ pull_requests: true
57
+ github_issues:
58
+ enabled: false
59
+ scope: { mode: repos, orgs: [], repos: [] }
60
+ filters: { assigned_to_me: true, labels: [] }
61
+ jira:
62
+ enabled: false
63
+ board: ''
64
+ only_assigned_to_me: true
65
+ linear:
66
+ enabled: false
67
+ team: ''
68
+ view: cycle
69
+ only_assigned_to_me: true
70
+ ```
71
+
72
+ Respect such configuration when querying; use it to scope lists (e.g. “assigned to me”, specific board/team) rather than inventing defaults.