feat: npm wrapper + CI publish, fix README YAML/JSON description

This commit is contained in:
jackwener
2026-04-16 22:33:53 +08:00
parent 6cdc806642
commit 47d17aeccf
9 changed files with 213 additions and 18 deletions
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@wx-cli/darwin-arm64",
"version": "0.1.1",
"description": "wx-cli binary for macOS arm64",
"os": ["darwin"],
"cpu": ["arm64"],
"files": ["bin/"],
"license": "Apache-2.0",
"publishConfig": { "access": "public" }
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@wx-cli/darwin-x64",
"version": "0.1.1",
"description": "wx-cli binary for macOS x64",
"os": ["darwin"],
"cpu": ["x64"],
"files": ["bin/"],
"license": "Apache-2.0",
"publishConfig": { "access": "public" }
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@wx-cli/linux-arm64",
"version": "0.1.1",
"description": "wx-cli binary for Linux arm64",
"os": ["linux"],
"cpu": ["arm64"],
"files": ["bin/"],
"license": "Apache-2.0",
"publishConfig": { "access": "public" }
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@wx-cli/linux-x64",
"version": "0.1.1",
"description": "wx-cli binary for Linux x64",
"os": ["linux"],
"cpu": ["x64"],
"files": ["bin/"],
"license": "Apache-2.0",
"publishConfig": { "access": "public" }
}
+10
View File
@@ -0,0 +1,10 @@
{
"name": "@wx-cli/win32-x64",
"version": "0.1.1",
"description": "wx-cli binary for Windows x64",
"os": ["win32"],
"cpu": ["x64"],
"files": ["bin/"],
"license": "Apache-2.0",
"publishConfig": { "access": "public" }
}
+31
View File
@@ -0,0 +1,31 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs');
const PLATFORM_PACKAGES = {
'darwin-arm64': '@wx-cli/darwin-arm64',
'darwin-x64': '@wx-cli/darwin-x64',
'linux-x64': '@wx-cli/linux-x64',
'linux-arm64': '@wx-cli/linux-arm64',
'win32-x64': '@wx-cli/win32-x64',
};
const platformKey = `${process.platform}-${process.arch}`;
const pkg = PLATFORM_PACKAGES[platformKey];
if (!pkg) {
console.log(`wx-cli: no binary for ${platformKey}, skipping`);
process.exit(0);
}
const ext = process.platform === 'win32' ? '.exe' : '';
try {
const binaryPath = require.resolve(`${pkg}/bin/wx${ext}`);
if (process.platform !== 'win32') {
fs.chmodSync(binaryPath, 0o755);
}
} catch {
console.log(`wx-cli: platform package ${pkg} not installed`);
}
+34
View File
@@ -0,0 +1,34 @@
{
"name": "wx-cli",
"version": "0.1.1",
"description": "Query your local WeChat data from the command line. Designed for LLM agent tool calls.",
"bin": {
"wx": "bin/wx.js"
},
"scripts": {
"postinstall": "node install.js"
},
"files": [
"bin/",
"install.js"
],
"optionalDependencies": {
"@wx-cli/darwin-arm64": "0.1.1",
"@wx-cli/darwin-x64": "0.1.1",
"@wx-cli/linux-x64": "0.1.1",
"@wx-cli/linux-arm64": "0.1.1",
"@wx-cli/win32-x64": "0.1.1"
},
"engines": {
"node": ">=14"
},
"keywords": ["wechat", "cli", "wx", "llm", "ai", "sqlite", "sqlcipher"],
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/jackwener/wx-cli"
},
"publishConfig": {
"access": "public"
}
}