Initial commit: wx-cli again
Fresh start from botiverse/wx-cli (working tree at main, no prior history).
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli-darwin-arm64",
|
||||
"version": "0.6.3",
|
||||
"description": "wx-cli binary for macOS arm64",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"files": [
|
||||
"bin/"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli-darwin-x64",
|
||||
"version": "0.6.3",
|
||||
"description": "wx-cli binary for macOS x64",
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"files": [
|
||||
"bin/"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli-linux-arm64",
|
||||
"version": "0.6.3",
|
||||
"description": "wx-cli binary for Linux arm64",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"cpu": [
|
||||
"arm64"
|
||||
],
|
||||
"files": [
|
||||
"bin/"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli-linux-x64",
|
||||
"version": "0.6.3",
|
||||
"description": "wx-cli binary for Linux x64",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"files": [
|
||||
"bin/"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli-win32-x64",
|
||||
"version": "0.6.3",
|
||||
"description": "wx-cli binary for Windows x64",
|
||||
"os": [
|
||||
"win32"
|
||||
],
|
||||
"cpu": [
|
||||
"x64"
|
||||
],
|
||||
"files": [
|
||||
"bin/"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const { execFileSync } = require('child_process');
|
||||
const path = require('path');
|
||||
const fs = require('fs');
|
||||
|
||||
const PLATFORM_PACKAGES = {
|
||||
'darwin-arm64': '@jackwener/wx-cli-darwin-arm64',
|
||||
'darwin-x64': '@jackwener/wx-cli-darwin-x64',
|
||||
'linux-x64': '@jackwener/wx-cli-linux-x64',
|
||||
'linux-arm64': '@jackwener/wx-cli-linux-arm64',
|
||||
'win32-x64': '@jackwener/wx-cli-win32-x64',
|
||||
};
|
||||
|
||||
const platformKey = `${process.platform}-${process.arch}`;
|
||||
const ext = process.platform === 'win32' ? '.exe' : '';
|
||||
|
||||
function getBinaryPath() {
|
||||
if (process.env.WX_CLI_BINARY) {
|
||||
return process.env.WX_CLI_BINARY;
|
||||
}
|
||||
|
||||
const pkg = PLATFORM_PACKAGES[platformKey];
|
||||
if (!pkg) {
|
||||
console.error(`wx-cli: unsupported platform ${platformKey}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
return require.resolve(`${pkg}/bin/wx${ext}`);
|
||||
} catch {
|
||||
const modPath = path.join(
|
||||
path.dirname(require.resolve(`${pkg}/package.json`)),
|
||||
`bin/wx${ext}`
|
||||
);
|
||||
if (fs.existsSync(modPath)) return modPath;
|
||||
}
|
||||
|
||||
console.error(`wx-cli: binary not found for ${platformKey}`);
|
||||
console.error('Try: npm install -g @jackwener/wx-cli');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
try {
|
||||
execFileSync(getBinaryPath(), process.argv.slice(2), {
|
||||
stdio: 'inherit',
|
||||
env: { ...process.env },
|
||||
});
|
||||
} catch (e) {
|
||||
if (e && e.status != null) process.exit(e.status);
|
||||
throw e;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env node
|
||||
'use strict';
|
||||
|
||||
const fs = require('fs');
|
||||
|
||||
const PLATFORM_PACKAGES = {
|
||||
'darwin-arm64': '@jackwener/wx-cli-darwin-arm64',
|
||||
'darwin-x64': '@jackwener/wx-cli-darwin-x64',
|
||||
'linux-x64': '@jackwener/wx-cli-linux-x64',
|
||||
'linux-arm64': '@jackwener/wx-cli-linux-arm64',
|
||||
'win32-x64': '@jackwener/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,42 @@
|
||||
{
|
||||
"name": "@jackwener/wx-cli",
|
||||
"version": "0.6.3",
|
||||
"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": {
|
||||
"@jackwener/wx-cli-darwin-arm64": "0.6.3",
|
||||
"@jackwener/wx-cli-darwin-x64": "0.6.3",
|
||||
"@jackwener/wx-cli-linux-x64": "0.6.3",
|
||||
"@jackwener/wx-cli-linux-arm64": "0.6.3",
|
||||
"@jackwener/wx-cli-win32-x64": "0.6.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"keywords": [
|
||||
"wechat",
|
||||
"cli",
|
||||
"wx",
|
||||
"llm",
|
||||
"ai",
|
||||
"sqlite",
|
||||
"sqlcipher"
|
||||
],
|
||||
"license": "Apache-2.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/botiverse/wx-cli"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user