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
6 changes: 5 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
- [ ] 没有新增第二份正文、重复入口或第二套默认值
- [ ] 新增命令 / 参数 / 退出码有示例与测试
- [ ] 没有引入调用方包的源码依赖
- [ ] 已跑 `pnpm check`、`pnpm test`、`pnpm typecheck`、`npm pack --dry-run`
- [ ] 包体边界:`npm pack --dry-run` 不含 `tests` / `scripts` / `rules` / 包根 `AGENTS.md` / 构建配置 / lockfile
- [ ] Node 基线:`engines.node >= 22.18`、产物 `target: node22` 未偏离
- [ ] 包质量:`pnpm build` 的 `publint` / `attw` / `unused` 通过
- [ ] 体积报告已看(`pnpm size`,只报告、不设门禁)
- [ ] 已跑 `pnpm check`、`pnpm test`、`pnpm build`、`npm pack --dry-run`

## 审核重点

Expand Down
20 changes: 12 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ concurrency:
jobs:
ci:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node: [22, 24]
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
- uses: voidzero-dev/setup-vp@v1.22.0
with:
version: 12.6.0
node-version: ${{ matrix.node }}
cache: true

- uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm
- run: pnpm check

- run: pnpm install --frozen-lockfile
- run: pnpm build
if: matrix.node == 24

- run: pnpm check
- run: pnpm size
if: matrix.node == 24

- run: pnpm test
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ coverage/
*.log
*.tsbuildinfo
.DS_Store

# Vite+ 生成的 Git hook dispatcher(项目自己的 hook 在 .vite-hooks/ 下)
.vite-hooks/_/
1 change: 1 addition & 0 deletions .node-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.22.2
26 changes: 26 additions & 0 deletions .vite-hooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh
# ============================================================================
# pre-commit — 提交前闸门(静态检查,不起浏览器)
# ----------------------------------------------------------------------------
# 先 `vp staged` 处理暂存文件,再跑包内 `check`;需要浏览器的检查不进钩子。
# 环境不具备(没有 node)时放行并提示,不算不合格。
# 手动安装:pnpm exec vp config --no-agent;诊断:vp hooks status
# ============================================================================
set -e
ROOT="$(git rev-parse --show-toplevel)"
cd "$ROOT"

if ! command -v node >/dev/null 2>&1; then
echo "⚠ pre-commit:未找到 node,跳过静态闸门(PATH=$PATH)"
exit 0
fi

VP="$ROOT/node_modules/.bin/vp"

echo "── pre-commit:Vite+ staged(fmt / lint)─────────────────────────────"
"$VP" staged || exit 1

echo "── pre-commit:包内静态检查 ───────────────────────────────────────────"
"$VP" run check || exit 1

echo "✓ 静态闸门通过"
1 change: 0 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
```bash
pnpm check
pnpm test
pnpm typecheck
```

没跑或没跑通时,必须说明是哪一条、为什么。
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 0.1.4 - 2026-11-10

- 构建改用 `vp pack`,产物同时生成 `dist/index.js` 与 `dist/index.d.ts`。
- `exports.types` 指向 `dist/index.d.ts`,包体不再包含 `src/`;安装后类型解析不依赖源码。
- 无运行时 API 变化。

## 0.1.3 - 2026-11-10

- 修复 `--key=value` 的值含等号时被截断:`--define=KEY=VALUE` 现在完整保留。
Expand Down
5 changes: 4 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
- **冗余**:同一事实只有一份正文;新增说明先改真源,其他位置只留指针。
- **缺漏**:新增能力是否有入口、示例与验证命令。
- **漂移**:`package.json` / README / `CHANGELOG` / VERSION(及适用的 AI 文档)版本是否一致。
- **包体**:`npm pack --dry-run` 不含 `tests` / `scripts` / `rules` / 包根 `AGENTS.md` / 构建配置 / lockfile;`exports` 与类型入口一致。
- **基线**:`engines.node >= 22.18`、产物 `target: node22` 未偏离;开发端脚本与依赖不进入发布包。

机械检查交给 CI;人审看架构、边界、语义与取舍。

Expand All @@ -35,7 +37,8 @@
```bash
pnpm check
pnpm test
pnpm typecheck
pnpm build # 含 publint / attw / unused
pnpm size # 体积只报告,不设门禁
npm pack --dry-run
```

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
pnpm add @ultime/cli
```

需要 Node >= 22.18;包发的是编译后的 ESM(`dist/`),类型来自 `src/*.ts`。
需要 Node >= 22.18;包发的是编译后的 ESM(`dist/`),类型来自 `dist/*.d.ts`。

## 用它做什么

Expand Down
19 changes: 19 additions & 0 deletions checks.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** 通过 @ultime/checks 运行;规则与词表按本包维护。 */
export default {
roots: ['.'],
ignore: ['node_modules', 'dist', 'coverage', '.vite-hooks', '.tmp', 'checks.config.mjs'],
rules: [
{ use: 'imports', severity: 'error', options: { packageRoots: ['.'], packages: ['@ultime/'] } },
{ use: 'unresolved', severity: 'warn', options: { scope: ['src/**', 'scripts/**'] } },
{
use: 'text',
severity: 'error',
options: {
include: 'all',
deny: ['docs/', 'roadmap/', 'design-system/\\d', 'references', '小巨蛋', 'xiaojudan', '归序札记'],
warn: ['以前|上一版|旧值|下一轮|待补|待实现|未实现|不再用|TODO|FIXME'],
},
},
{ use: 'doc-set', severity: 'error', options: { packages: ['.'] } },
],
}
29 changes: 21 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ultime/cli",
"version": "0.1.3",
"version": "0.1.4",
"description": "Ultime · cli:通用命令行设施(参数 / 命令注册 / 上下文 / 退出码),零领域依赖",
"keywords": [
"argument-parser",
Expand All @@ -22,7 +22,6 @@
},
"files": [
"dist",
"src",
"README.md",
"llms.txt",
"SKILLS.md",
Expand All @@ -33,26 +32,40 @@
"type": "module",
"exports": {
".": {
"types": "./src/index.ts",
"types": "./dist/index.d.ts",
"import": "./dist/index.js"
}
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "vp build",
"check": "vp check",
"build": "vp pack",
"check": "vp check && checks run && pnpm cycles",
"checks": "checks run",
"cycles": "vp lint --import-plugin --deny=import/no-cycle src",
"test": "vp test",
"typecheck": "tsc -p tsconfig.json --noEmit",
"prepublishOnly": "pnpm check && pnpm test && pnpm build"
"size": "size-limit --json",
"prepublishOnly": "pnpm check && pnpm test && pnpm build",
"prepare": "vp config --no-agent"
},
"devDependencies": {
"@arethetypeswrong/core": "^0.18.5",
"@size-limit/preset-small-lib": "^14.3.0",
"@types/node": "^22.20.5",
"tsx": "^4.23.15",
"@ultime/checks": "^0.2.0",
"publint": "^0.3.25",
"size-limit": "^14.3.0",
"typescript": "^5.9.3",
"unplugin-unused": "^0.6.0",
"vite-plus": "1.5.1"
},
"size-limit": [
{
"name": "@ultime/cli",
"path": "dist/index.js"
}
],
"engines": {
"node": ">=22.18"
},
Expand Down
Loading
Loading