feat(cli): add tsup build pipeline for npm publishing

- Rename package to `chatlab-cli`, version 0.1.0
- Add tsup config with ESM output, bundle @openchatlab/* + stream-json
- Update bin/chatlab.js from stub to actual entry point
- Unify version reading via src/version.ts (CLI/MCP/HTTP API)
- Add publishing fields: type, files, engines, publishConfig, keywords
- Move @openchatlab/* to devDependencies (bundled into dist/)
- Add better-sqlite3 to dependencies, @node-rs/jieba to optionalDependencies
- Fix --web default path for bundled dist/ directory structure
This commit is contained in:
digua committed 2026-05-19 21:46:00 +08:00
1 parent 78e41a65b5
commit b1427e2422
9 files changed
+366 -37

No files matched your search

+55 -10
View File
@@ -1,23 +1,70 @@
{
"name": "@openchatlab/chatlab",
"version": "0.0.1",
"private": true,
"name": "chatlab-cli",
"version": "0.1.0",
"description": "ChatLab CLI & Service - 聊天记录分析工具",
"type": "module",
"bin": {
"chatlab": "./bin/chatlab.js"
},
"main": "./src/index.ts",
"types": "./src/index.ts",
"main": "./dist/index.js",
"files": [
"bin/",
"dist/",
"dist-web/",
"LICENSE"
],
"engines": {
"node": ">=20"
},
"publishConfig": {
"access": "public"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git+https://github.com/ChatLab/ChatLab.git",
"directory": "apps/cli"
},
"homepage": "https://github.com/ChatLab/ChatLab",
"keywords": [
"chatlab",
"chat",
"analysis",
"wechat",
"qq",
"telegram",
"whatsapp",
"discord",
"mcp",
"cli"
],
"scripts": {
"cli": "node scripts/ensure-native.mjs && tsx src/cli.ts",
"build": "tsup",
"ensure-native": "node scripts/ensure-native.mjs",
"rebuild-native": "bash scripts/rebuild-native.sh",
"rebuild-sqlite": "npm rebuild better-sqlite3"
"rebuild-sqlite": "npm rebuild better-sqlite3",
"prepublishOnly": "pnpm run build"
},
"dependencies": {
"@fastify/multipart": "^10.0.0",
"@fastify/static": "^9.1.3",
"@mariozechner/pi-agent-core": "0.54.2",
"@mariozechner/pi-ai": "0.54.2",
"@modelcontextprotocol/sdk": "^1.12.1",
"better-sqlite3": "^12.4.6",
"commander": "^13.1.0",
"fastify": "^5.8.4",
"gray-matter": "^4.0.3",
"js-tiktoken": "^1.0.21",
"smol-toml": "^1.3.1",
"stream-json": "^1.9.1",
"zod": "^3.24.4"
},
"optionalDependencies": {
"@node-rs/jieba": "^2.0.1"
},
"devDependencies": {
"@openchatlab/config": "workspace:*",
"@openchatlab/core": "workspace:*",
"@openchatlab/node-runtime": "workspace:*",
@@ -25,10 +72,8 @@
"@openchatlab/shared-types": "workspace:*",
"@openchatlab/sync": "workspace:*",
"@openchatlab/tools": "workspace:*",
"commander": "^13.1.0",
"fastify": "^5.8.4"
},
"devDependencies": {
"@types/better-sqlite3": "^7.6.13",
"tsup": "^8.5.0",
"tsx": "^4.21.0"
}
}