open-index/open-npm huggingface dataset:
npm package: @stacklance/envguard-cli
Description: CLI tool for validating, diffing, and managing environment variables
Latest version: 0.1.0

# @stacklance/envguard-cli

CLI tool for validating, diffing, masking, and fixing environment variables.

## Installation

```bash
npm install -g @stacklance/envguard-cli
# or use with npx
npx @stacklance/envguard-cli check
```

## Commands

### `env-guard check`

Validate a `.env` file against a schema.

```bash
env-guard check --path .env --schema ./env.schema.ts
```

Exits with code 1 on validation failure. In CI environments (`CI=true`), outputs GitHub Actions `::error::` annotations.

### `env-guard diff`

Show missing and extra keys between `.env` and `.env.example`.

```bash
env-guard diff --env .env --example .env.example
```

Output:

```
┌──────────┬───────────────────────────────┐
│ Key      │ Status                        │
├──────────┼───────────────────────────────┤
│ REDIS_URL│ Missing from .env             │
│ LEGACY   │ Extra (not in .env.example)   │
└──────────┴───────────────────────────────┘
```

### `env-guard mask`

Print all env vars with sensitive values redacted.

```bash
env-guard mask --path .env
```

Keys containing `SECRET`, `KEY`, `TOKEN`, `PASSWORD`, or `PASS` are auto-masked.

### `env-guard fix`

Append missing keys (from `.env.example`) to `.env` with empty values.

```bash
env-guard fix --path .env --example .env.example
```

### `env-guard audit`

Statically audit `process.env` usage in your codebase against a Zod schema file.

```bash
env-guard audit --dir ./src --schema ./env.schema.ts
```

Options:

| Flag | Description | Default |
| --- | --- | --- |
| `--dir <paths...>` | Directories to scan (supports multiple) | `./src` |
| `--schema <path>` | Path to Zod schema file | `./env.schema.ts` |
| `--fix` | Add undeclared keys to schema as `z.string().optional()` | `false` |
| `--json` | Output JSON instead of formatted text | `false` |

Exits with code 1 if any undeclared env vars are found. In CI, outputs `::error::` and `::warning::` annotations.

## CI Integration

When `CI=true` is set, failed validations output GitHub Actions annotations:

```
::error title=EnvGuard::DB_URL: Invalid url
```

## License

MIT
npm package: @stacklance/envguard-core
Description: Zod-based environment variable validation with type inference, .env loading, and watch mode
Latest version: 0.1.0

# @stacklance/envguard-core

Zod-based environment variable validation with full TypeScript inference, `.env` file loading, watch mode, and pretty error output.

## Installation

```bash
npm install @stacklance/envguard-core zod
```

## Usage

```ts
import { guard } from '@stacklance/envguard-core';
import { z } from 'zod';

const env = guard({
  PORT: z.coerce.number().default(3000),
  NODE_ENV: z.enum(['development', 'staging', 'production']),
  DB_URL: z.string().url(),
  DB_SSL: z.coerce.boolean().default(false),
  DB_CERT: z.string().optional(),
});

// Fully typed! env.PORT is number, env.NODE_ENV is 'development' | 'staging' | 'production'
console.log(env.PORT); // 3000
```

## Options

```ts
const env = guard(schema, {
  path: '.env',              // Path to .env file (default: '.env')
  examplePath: '.env.example', // Path to .env.example for key sync (default: '.env.example')
  freeze: true,              // Object.freeze the result (default: true)
  watch: false,              // Watch .env for changes (default: false)
  masked: false,             // Print masked env table (default: false)
});
```

## Watch Mode

```ts
const { env, watcher } = guard(schema, { watch: true });

watcher.on('change', (newEnv) => {
  console.log('Env updated:', newEnv);
});

watcher.on('error', (err) => {
  console.error('Validation failed:', err);
});

// Stop watching
watcher.close();
```

## Masked Logging

Automatically redacts values for keys containing `SECRET`, `KEY`, `TOKEN`, `PASSWORD`, or `PASS`:

```ts
guard(schema, { masked: true });
// Prints:
// API_KEY       ****
// PORT          3000
// DB_URL        postgres://localhost/mydb
```

## .env.example Sync

Automatically warns when keys differ between `.env` and `.env.example`:

```
⚠ Missing from .env (present in .env.example): REDIS_URL
⚠ Extra in .env (not in .env.example): LEGACY_FLAG
```

## Error Handling

```ts
import { guard, EnvGuardError } from '@stacklance/envguard-core';

try {
  const env = guard(schema);
} catch (err) {
  if (err instanceof EnvGuardError) {
    for (const detail of err.details) {
      console.log(detail.key, detail.issues);
    }
  }
}
```

## API

### `guard(schema, options?)`

Validate `process.env` against a Zod schema shape. Returns a frozen, fully-typed object.

### `GuardOptions`

| Option       | Type      | Default          | Description                        |
| ------------ | --------- | ---------------- | ---------------------------------- |
| `path`       | `string`  | `'.env'`         | Path to .env file                  |
| `examplePath`| `string`  | `'.env.example'` | Path to .env.example               |
| `freeze`     | `boolean` | `true`           | Freeze the result object           |
| `watch`      | `boolean` | `false`          | Watch .env file for changes        |
| `masked`     | `boolean` | `false`          | Print masked env values            |

### `EnvGuardError`

Error class with a `details` array of `{ key: string, issues: ZodIssue[] }`.

## License

MIT
npm package: @stacklance/envguard-nestjs
Description: NestJS dynamic module for Zod-based environment variable validation
Latest version: 0.1.0

# @stacklance/envguard-nestjs

NestJS dynamic module for Zod-based environment variable validation.

## Installation

```bash
npm install @stacklance/envguard-nestjs @stacklance/envguard-core zod
```

## Usage

### `forRoot`

```ts
import { Module } from '@nestjs/common';
import { EnvGuardModule } from '@stacklance/envguard-nestjs';
import { z } from 'zod';

@Module({
  imports: [
    EnvGuardModule.forRoot({
      schema: {
        PORT: z.coerce.number().default(3000),
        DB_URL: z.string().url(),
        API_KEY: z.string().min(1),
      },
    }),
  ],
})
export class AppModule {}
```

### `forRootAsync`

```ts
EnvGuardModule.forRootAsync({
  imports: [ConfigModule],
  useFactory: (config: ConfigService) => ({
    schema: {
      PORT: z.coerce.number().default(3000),
      DB_URL: z.string().url(),
    },
    options: {
      path: config.get('ENV_PATH', '.env'),
    },
  }),
  inject: [ConfigService],
});
```

### Injecting `EnvGuardService`

```ts
import { Injectable } from '@nestjs/common';
import { EnvGuardService } from '@stacklance/envguard-nestjs';

@Injectable()
export class AppService {
  constructor(private readonly envGuard: EnvGuardService) {}

  getPort(): number {
    return this.envGuard.get('PORT');
  }

  getAllEnv() {
    return this.envGuard.getAll();
  }
}
```

## Features

- Validates environment variables at application bootstrap
- Throws `EnvGuardError` with detailed per-key errors if validation fails
- Global module - `EnvGuardService` is available everywhere after import
- Full TypeScript inference via Zod schemas

## API

### `EnvGuardModule.forRoot(options)`

| Option    | Type           | Description                              |
| --------- | -------------- | ---------------------------------------- |
| `schema`  | `ZodRawShape`  | Zod schema shape for env validation      |
| `options`  | `GuardOptions` | Optional path, freeze, masked settings   |

### `EnvGuardModule.forRootAsync(options)`

| Option       | Type         | Description                           |
| ------------ | ------------ | ------------------------------------- |
| `imports`    | `Module[]`   | Modules to import                     |
| `useFactory` | `Function`   | Factory returning module options      |
| `inject`     | `Provider[]` | Providers to inject into factory      |

### `EnvGuardService`

| Method      | Returns          | Description                          |
| ----------- | ---------------- | ------------------------------------ |
| `get(key)`  | `TEnv[K]`        | Get a single validated env var       |
| `getAll()`  | `Readonly<TEnv>` | Get all validated env vars           |

## License

MIT
npm package: @stackloom/eslint-config
Description: Shared ESLint config for Stackloom projects
Author: Wittonchanglife
Latest version: 0.1.4

# @stackloom/eslint-config

Shared ESLint config for Stackloom projects.

## Install

```
npm i -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

# or with pnpm

```
pnpm add -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

# or with yarn

```
yarn add -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

## Usage

```
// Base (JS/TS) - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/base"]
}
```

```
// Base (JS/TS) - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/base"]
  }
]
```

```
// Next.js (App/Pages) - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/next-js"]
}
```

```
// Next.js (App/Pages) - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/next-js"]
  }
]
```

```
// React internal - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/react-internal"]
}
```

```
// React internal - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/react-internal"]
  }
]
```

## Version compatibility

- Requires ESLint 9.x and TypeScript 5.x (tested with the versions listed in package peerDependencies).
- Next.js config targets Next.js 14+ and 15+, and works with 15/16 when using the official `@next/eslint-plugin-next`.
- React rules target `react` and `react-hooks` plugins in their recent stable versions.

## Notes

- This package exposes multiple entry points via exports:
  - "@stackloom/eslint-config/base"
  - "@stackloom/eslint-config/next-js"
  - "@stackloom/eslint-config/react-internal"
- If using ESLint’s flat config, ensure your environment supports ESM and use `eslint.config.js` with `export default`.
- Some rules may assume modern tooling (e.g., TypeScript project references or Next.js app router); adjust overrides as needed in your project.
npm package: @stackloom/typescript-config
Description: Shared TypeScript configs for Stackloom projects
Author: Wittonchanglife
Latest version: 0.1.5

# @stackloom/eslint-config

Shared ESLint config for Stackloom projects.

## Install

```
npm i -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

# or with pnpm

```
pnpm add -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

# or with yarn

```
yarn add -D @stackloom/eslint-config eslint @eslint/js @typescript-eslint/eslint-plugin @typescript-eslint/parser eslint-plugin-react eslint-plugin-react-hooks @next/eslint-plugin-next
```

## Usage

```
// Base (JS/TS) - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/base"]
}
```

```
// Base (JS/TS) - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/base"]
  }
]
```

```
// Next.js (App/Pages) - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/next-js"]
}
```

```
// Next.js (App/Pages) - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/next-js"]
  }
]
```

```
// React internal - .eslintrc.json
{
  "extends": ["@stackloom/eslint-config/react-internal"]
}
```

```
// React internal - eslint.config.js (flat config)
export default [
  {
    extends: ["@stackloom/eslint-config/react-internal"]
  }
]
```

## Version compatibility

- Requires ESLint 9.x and TypeScript 5.x (tested with the versions listed in package peerDependencies).
- Next.js config targets Next.js 14+ and 15+, and works with 15/16 when using the official `@next/eslint-plugin-next`.
- React rules target `react` and `react-hooks` plugins in their recent stable versions.

## Notes

- This package exposes multiple entry points via exports:
  - "@stackloom/eslint-config/base"
  - "@stackloom/eslint-config/next-js"
  - "@stackloom/eslint-config/react-internal"
- If using ESLint’s flat config, ensure your environment supports ESM and use `eslint.config.js` with `export default`.
- Some rules may assume modern tooling (e.g., TypeScript project references or Next.js app router); adjust overrides as needed in your project.
npm package: @stackloom/ui
Description: Stackloom UI components and utilities
Author: Wittonchanglife
Latest version: 0.1.4

# @stackloom/ui

Reusable React UI components built on Radix UI and Tailwind CSS.

## Install

npm i @stackloom/ui

Peer dependencies (project-level):

- react, react-dom
- tailwindcss (v4)

## Styles

Import global styles once (e.g., in your root layout or App):

```
import "@stackloom/ui/globals.css"
```

## Usage

Example:

```
import { Button } from "@stackloom/ui/components/button"
// or import utility functions and hooks
import { cn } from "@stackloom/ui/lib/utils"
import { useSomething } from "@stackloom/ui/hooks/use-something"

export function Demo() {
  return <Button className={cn("px-4")}>Click</Button>
}
```

## Exports

- Styles: "@stackloom/ui/globals.css"
- PostCSS config: "@stackloom/ui/postcss.config"
- Lib utilities: "@stackloom/ui/lib/\*"
- Components: "@stackloom/ui/components/\*"
- Hooks: "@stackloom/ui/hooks/\*"

## Notes

- Ensure Tailwind CSS v4 is configured in your app.
- Components rely on Radix UI; install specific Radix packages if you use advanced patterns.