mirror of
https://github.com/jackwener/wx-cli.git
synced 2026-10-08 16:15:45 +00:00
feat: npm wrapper + CI publish, fix README YAML/JSON description
This commit is contained in:
@@ -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`);
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user