open-index/open-npm huggingface dataset:
npm package: @hocgin/wenyan-core
Description: Core library for Wenyan markdown rendering & publishing
Author: Lei
Latest version: 3.0.2

<div align="center">
    <img alt="logo" src="https://raw.githubusercontent.com/caol64/wenyan/main/Data/256-mac.png" width="128" />
</div>

# 文颜 CORE

[![npm](https://img.shields.io/npm/v/@wenyan-md/core)](https://www.npmjs.com/package/@wenyan-md/core)
[![License](https://img.shields.io/github/license/caol64/wenyan-core)](LICENSE)
![NPM Downloads](https://img.shields.io/npm/dm/%40wenyan-md%2Fcore)
[![Stars](https://img.shields.io/github/stars/caol64/wenyan-core?style=social)](https://github.com/caol64/wenyan-core)

## 简介

**[文颜（Wenyan）](https://wenyan.yuzhi.tech/)** 是一套多平台 Markdown 排版与发布工具链，  **文颜 CORE** 是其核心库，专注于：

- Markdown → HTML 渲染
- 主题排版（公众号 / Web）
- 代码高亮与样式增强
- 发布前内容处理（脚注、图片、样式兼容）

适合以下使用场景：

- 在 **Node.js / Web** 项目中嵌入排版能力
- 构建 **CLI / 桌面端 / MCP / AI 写作系统**
- 自定义 Markdown 排版或内容发布流程
- 作为文颜生态的二次开发基础

## 安装

```bash
npm install @wenyan-md/core
```

## API 文档

- [Wenyan Core API 文档](docs/api.md)
- [Wenyan Core API 文档：Node 环境渲染](docs/node.md)
- [Wenyan Core API 文档：微信公众号发布](docs/wechat.md)

## 内置主题

- [内置主题](src/assets/themes/)
- [内置代码高亮主题](src/assets/highlight/styles/)
- [内置主题预览](https://yuzhi.tech/docs/wenyan/theme)

## 赞助

如果你觉得文颜对你有帮助，可以给我家猫咪买点罐头 ❤️

[https://yuzhi.tech/sponsor](https://yuzhi.tech/sponsor)

## License

Apache License Version 2.0
npm package: @hochej/envwise
Description: Classify environment variables into safe, mapped secret, and dropped secret sets.
Latest version: 0.1.8

# envwise

<p align="center">
  <img src="assets/envwise-hero.png" alt="envwise — classify environment variables" width="720" />
</p>

`envwise` classifies environment variables into three groups:

- **mapped secrets**: secret + known host(s)
- **dropped secrets**: secret-like but no host mapping
- **safe vars**: not classified as secret

Primary use is as a **TypeScript library**. A CLI is also included for local inspection.

## Library usage

```ts
import { classify, classifyEnv } from "@hochej/envwise";

classify("GITHUB_TOKEN", "ghp_...");
// => { isSecret: true, hosts: ["api.github.com"], matchedBy: "value", ... }

classifyEnv(process.env as Record<string, string>);
// => { secrets: [...], dropped: [...], safe: [...] }

import { parseDotenv } from "@hochej/envwise";

parseDotenv("API_HOST=api.example.com\nAPI_URL=https://${API_HOST}\n");
// => interpolation disabled by default

parseDotenv("API_HOST=api.example.com\nAPI_URL=https://${API_HOST}\n", { expand: true });
// => enable dotenv-expand interpolation (opt-in)
```

### Matching order

1. `overrides[name]`
2. value regex (`value_patterns`)
3. exact name map (`exact_name_host_map`)
4. keyword name map (`keyword_host_map`, longest keyword wins)
5. generic secret-name pattern (`KEY|TOKEN|SECRET|PASSWORD|...`)

If value and name both match, value wins.
If value matches but has no host mapping, name mapping is used as fallback.

## CLI usage

```bash
# inspect current process env
envwise inspect --env

# inspect dotenv file
envwise inspect --file .env

# opt-in dotenv variable interpolation (can be slow on very large files)
envwise inspect --file .env --expand

# machine-readable output (secret values redacted by default)
envwise inspect --file .env --json

# include plaintext secret values (dangerous; use with care)
envwise inspect --file .env --json --include-secret-values
```

## Optional integration helper

For consumers that need a `Record<name, { hosts, value }>` shape, use:

```ts
import { classifyEnvForGondolin } from "@hochej/envwise";

const { secretsMap } = classifyEnvForGondolin(process.env as Record<string, string>);
```

## Development

`envwise` ships with a bundled mapping file (`src/generated/secret-mapping.ts`). End users do **not** need to run mapping update tooling.

Raw `secret-mapping.gondolin.json`/`.sha256` files are not stored in this repo; CI fetches from `hochej/hogwash` when regenerating the bundled module.

```bash
# prereq: install uv (https://docs.astral.sh/uv/)
pnpm install

# maintainer workflow: pull latest mapping from hogwash via GitHub API
pnpm mapping:update -- --latest
# optional integrity pin: pnpm mapping:update -- --tag vX.Y.Z --sha256 <expected_sha>

pnpm fixtures:curate
pnpm fixtures:check
pnpm test
pnpm typecheck
pnpm build
```

> Maintainer tooling uses `uv` to run Python scripts (in CI and package scripts).