@revkeen/cli-binary 0.0.1-rc2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/LICENSE +21 -0
- package/bin/README.md +54 -0
- package/bin/revkeen +0 -0
- package/install.js +155 -0
- package/package.json +42 -0
- package/run.js +19 -0
package/bin/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 RevKeen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/bin/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# RevKeen CLI
|
|
2
|
+
|
|
3
|
+
The official RevKeen command-line interface — manage payments, subscriptions,
|
|
4
|
+
invoices and billing from your terminal.
|
|
5
|
+
|
|
6
|
+
> **Know What You Keep, Not Just What You Earn.**
|
|
7
|
+
|
|
8
|
+
A single self-contained binary (Go + [Cobra](https://cobra.dev)), with commands
|
|
9
|
+
generated from the RevKeen OpenAPI contract.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Homebrew (macOS / Linux)
|
|
15
|
+
brew install revkeen/tap/revkeen
|
|
16
|
+
|
|
17
|
+
# npm
|
|
18
|
+
npm install -g @revkeen/cli-binary
|
|
19
|
+
|
|
20
|
+
# Shell script (macOS / Linux)
|
|
21
|
+
curl -fsSL https://cli.revkeen.com/install.sh | sh
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Authentication
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
revkeen auth login # OAuth device flow, or
|
|
28
|
+
revkeen config set api-key rk_live_... # API key (rk_live_* / rk_sandbox_*)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Configuration is stored in `~/.revkeen/config.toml`. The `REVKEEN_API_KEY`
|
|
32
|
+
environment variable overrides the stored key.
|
|
33
|
+
|
|
34
|
+
Target staging with `revkeen config set environment staging`.
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
revkeen customers list
|
|
40
|
+
revkeen invoices list
|
|
41
|
+
revkeen subscriptions get sub_123
|
|
42
|
+
revkeen analytics revenue-get-mrr-summary
|
|
43
|
+
|
|
44
|
+
# Escape hatch for any endpoint
|
|
45
|
+
revkeen api GET /v2/customers
|
|
46
|
+
revkeen api POST /v2/invoices -d '{"customerId":"cus_xxx"}'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Global flags: `--output table|json|yaml|csv`, `--json`, `--agent` (compact JSON
|
|
50
|
+
for tools/LLMs), `--no-color`. Run `revkeen --help` for the full command list.
|
|
51
|
+
|
|
52
|
+
## License
|
|
53
|
+
|
|
54
|
+
[MIT](./LICENSE)
|
package/bin/revkeen
ADDED
|
Binary file
|
package/install.js
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { execSync } = require("child_process");
|
|
6
|
+
const fs = require("fs");
|
|
7
|
+
const https = require("https");
|
|
8
|
+
const os = require("os");
|
|
9
|
+
const path = require("path");
|
|
10
|
+
const { createWriteStream, mkdirSync } = fs;
|
|
11
|
+
|
|
12
|
+
const VERSION = require("./package.json").version;
|
|
13
|
+
const REPO = "revkeen/cli";
|
|
14
|
+
|
|
15
|
+
const PLATFORM_MAP = {
|
|
16
|
+
darwin: "darwin",
|
|
17
|
+
linux: "linux",
|
|
18
|
+
win32: "windows",
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const ARCH_MAP = {
|
|
22
|
+
x64: "amd64",
|
|
23
|
+
arm64: "arm64",
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function getArchiveName() {
|
|
27
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
28
|
+
const arch = ARCH_MAP[process.arch];
|
|
29
|
+
|
|
30
|
+
if (!platform) {
|
|
31
|
+
throw new Error(`Unsupported platform: ${process.platform}`);
|
|
32
|
+
}
|
|
33
|
+
if (!arch) {
|
|
34
|
+
throw new Error(`Unsupported architecture: ${process.arch}`);
|
|
35
|
+
}
|
|
36
|
+
if (platform === "windows" && arch === "arm64") {
|
|
37
|
+
throw new Error("Windows arm64 is not supported");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const ext = platform === "windows" ? "zip" : "tar.gz";
|
|
41
|
+
return `revkeen_${platform}_${arch}.${ext}`;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function getBinaryName() {
|
|
45
|
+
return process.platform === "win32" ? "revkeen.exe" : "revkeen";
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function downloadFile(url) {
|
|
49
|
+
return new Promise((resolve, reject) => {
|
|
50
|
+
const follow = (url, redirects) => {
|
|
51
|
+
if (redirects > 5) {
|
|
52
|
+
return reject(new Error("Too many redirects"));
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const proto = url.startsWith("https") ? https : require("http");
|
|
56
|
+
proto
|
|
57
|
+
.get(url, { headers: { "User-Agent": "revkeen-cli-npm" } }, (res) => {
|
|
58
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
59
|
+
return follow(res.headers.location, redirects + 1);
|
|
60
|
+
}
|
|
61
|
+
if (res.statusCode !== 200) {
|
|
62
|
+
return reject(
|
|
63
|
+
new Error(`Download failed: HTTP ${res.statusCode} from ${url}`)
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
const chunks = [];
|
|
67
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
68
|
+
res.on("end", () => resolve(Buffer.concat(chunks)));
|
|
69
|
+
res.on("error", reject);
|
|
70
|
+
})
|
|
71
|
+
.on("error", reject);
|
|
72
|
+
};
|
|
73
|
+
follow(url, 0);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async function extractTarGz(buffer, destDir) {
|
|
78
|
+
const tmpFile = path.join(os.tmpdir(), `revkeen-${Date.now()}.tar.gz`);
|
|
79
|
+
fs.writeFileSync(tmpFile, buffer);
|
|
80
|
+
try {
|
|
81
|
+
execSync(`tar -xzf "${tmpFile}" -C "${destDir}"`, { stdio: "pipe" });
|
|
82
|
+
} finally {
|
|
83
|
+
fs.unlinkSync(tmpFile);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async function extractZip(buffer, destDir) {
|
|
88
|
+
const tmpFile = path.join(os.tmpdir(), `revkeen-${Date.now()}.zip`);
|
|
89
|
+
fs.writeFileSync(tmpFile, buffer);
|
|
90
|
+
try {
|
|
91
|
+
// Use PowerShell on Windows, unzip on Unix
|
|
92
|
+
if (process.platform === "win32") {
|
|
93
|
+
execSync(
|
|
94
|
+
`powershell -Command "Expand-Archive -Path '${tmpFile}' -DestinationPath '${destDir}' -Force"`,
|
|
95
|
+
{ stdio: "pipe" }
|
|
96
|
+
);
|
|
97
|
+
} else {
|
|
98
|
+
execSync(`unzip -o "${tmpFile}" -d "${destDir}"`, { stdio: "pipe" });
|
|
99
|
+
}
|
|
100
|
+
} finally {
|
|
101
|
+
fs.unlinkSync(tmpFile);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
async function main() {
|
|
106
|
+
const archiveName = getArchiveName();
|
|
107
|
+
const binaryName = getBinaryName();
|
|
108
|
+
const binDir = path.join(__dirname, "bin");
|
|
109
|
+
const binaryPath = path.join(binDir, binaryName);
|
|
110
|
+
|
|
111
|
+
// Skip if binary already exists (e.g. CI caching)
|
|
112
|
+
if (fs.existsSync(binaryPath)) {
|
|
113
|
+
console.log(`revkeen binary already exists at ${binaryPath}`);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const url = `https://github.com/${REPO}/releases/download/v${VERSION}/${archiveName}`;
|
|
118
|
+
console.log(`Downloading revkeen v${VERSION} for ${process.platform}/${process.arch}...`);
|
|
119
|
+
console.log(` ${url}`);
|
|
120
|
+
|
|
121
|
+
const buffer = await downloadFile(url);
|
|
122
|
+
|
|
123
|
+
mkdirSync(binDir, { recursive: true });
|
|
124
|
+
|
|
125
|
+
if (archiveName.endsWith(".zip")) {
|
|
126
|
+
await extractZip(buffer, binDir);
|
|
127
|
+
} else {
|
|
128
|
+
await extractTarGz(buffer, binDir);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// chmod +x on Unix
|
|
132
|
+
if (process.platform !== "win32") {
|
|
133
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Verify the binary exists
|
|
137
|
+
if (!fs.existsSync(binaryPath)) {
|
|
138
|
+
throw new Error(
|
|
139
|
+
`Binary not found at ${binaryPath} after extraction. Archive contents may have unexpected structure.`
|
|
140
|
+
);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
console.log(`Installed revkeen v${VERSION} to ${binaryPath}`);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
main().catch((err) => {
|
|
147
|
+
// In CI or monorepo installs, the release may not exist yet.
|
|
148
|
+
// Don't fail pnpm install — the binary is only needed by npm consumers.
|
|
149
|
+
if (process.env.CI || process.env.REVKEEN_SKIP_CLI_DOWNLOAD) {
|
|
150
|
+
console.warn(`Skipping revkeen CLI download (CI): ${err.message}`);
|
|
151
|
+
process.exit(0);
|
|
152
|
+
}
|
|
153
|
+
console.error(`Failed to install revkeen: ${err.message}`);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
});
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@revkeen/cli-binary",
|
|
3
|
+
"version": "0.0.1-rc2",
|
|
4
|
+
"description": "RevKeen CLI — manage payments, subscriptions & billing from your terminal",
|
|
5
|
+
"bin": {
|
|
6
|
+
"revkeen": "run.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node install.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"install.js",
|
|
13
|
+
"run.js",
|
|
14
|
+
"bin/"
|
|
15
|
+
],
|
|
16
|
+
"os": [
|
|
17
|
+
"darwin",
|
|
18
|
+
"linux",
|
|
19
|
+
"win32"
|
|
20
|
+
],
|
|
21
|
+
"cpu": [
|
|
22
|
+
"x64",
|
|
23
|
+
"arm64"
|
|
24
|
+
],
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=16"
|
|
27
|
+
},
|
|
28
|
+
"repository": {
|
|
29
|
+
"type": "git",
|
|
30
|
+
"url": "https://github.com/revkeen/cli.git"
|
|
31
|
+
},
|
|
32
|
+
"homepage": "https://revkeen.com",
|
|
33
|
+
"keywords": [
|
|
34
|
+
"revkeen",
|
|
35
|
+
"cli",
|
|
36
|
+
"billing",
|
|
37
|
+
"payments",
|
|
38
|
+
"subscriptions",
|
|
39
|
+
"invoices"
|
|
40
|
+
],
|
|
41
|
+
"license": "MIT"
|
|
42
|
+
}
|
package/run.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
"use strict";
|
|
4
|
+
|
|
5
|
+
const { execFileSync } = require("child_process");
|
|
6
|
+
const path = require("path");
|
|
7
|
+
|
|
8
|
+
const binaryName = process.platform === "win32" ? "revkeen.exe" : "revkeen";
|
|
9
|
+
const binaryPath = path.join(__dirname, "bin", binaryName);
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
execFileSync(binaryPath, process.argv.slice(2), { stdio: "inherit" });
|
|
13
|
+
} catch (err) {
|
|
14
|
+
if (err.status !== undefined) {
|
|
15
|
+
process.exit(err.status);
|
|
16
|
+
}
|
|
17
|
+
console.error(`Failed to run revkeen: ${err.message}`);
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|