@amadeus19/cc-statusline 3.2.0

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/.gitkeep ADDED
@@ -0,0 +1 @@
1
+
package/index.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const fs = require("node:fs");
5
+ const path = require("node:path");
6
+ const { spawn } = require("node:child_process");
7
+
8
+ const BIN_DIR = path.join(__dirname, "bin");
9
+ const isWindows = process.platform === "win32";
10
+ const binaryName = isWindows ? "ccsp.exe" : "ccsp";
11
+ const binaryPath = path.join(BIN_DIR, binaryName);
12
+
13
+ function ensureBinary() {
14
+ if (fs.existsSync(binaryPath)) {
15
+ return binaryPath;
16
+ }
17
+
18
+ console.error(
19
+ "[cc-statusline] Prebuilt binary not found. Try reinstalling with 'npm install --force @amadeus19/cc-statusline' or compile it manually via 'cargo build --release'."
20
+ );
21
+ process.exitCode = 1;
22
+ return process.exit();
23
+ }
24
+
25
+ function run() {
26
+ const executable = ensureBinary();
27
+ const args = process.argv.slice(2);
28
+
29
+ const child = spawn(executable, args, {
30
+ stdio: "inherit",
31
+ env: process.env
32
+ });
33
+
34
+ child.on("exit", (code, signal) => {
35
+ if (typeof code === "number") {
36
+ process.exit(code);
37
+ } else if (signal) {
38
+ // Mirror termination signal
39
+ process.kill(process.pid, signal);
40
+ } else {
41
+ process.exit(1);
42
+ }
43
+ });
44
+ }
45
+
46
+ run();
package/install.js ADDED
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+
6
+ const PLATFORM_PACKAGES = {
7
+ "darwin-arm64": "@amadeus19/cc-statusline-macos-arm64",
8
+ "darwin-x64": "@amadeus19/cc-statusline-macos-x64",
9
+ "linux-arm64": "@amadeus19/cc-statusline-linux-arm64",
10
+ "linux-x64": "@amadeus19/cc-statusline-linux-x64",
11
+ "win32-arm64": "@amadeus19/cc-statusline-windows-arm64",
12
+ "win32-x64": "@amadeus19/cc-statusline-windows-x64"
13
+ };
14
+
15
+ const targetKey = `${process.platform}-${process.arch}`;
16
+ const pkgName = PLATFORM_PACKAGES[targetKey];
17
+ const binDir = path.join(__dirname, "bin");
18
+ const isWindows = process.platform === "win32";
19
+ const binaryName = isWindows ? "ccsp.exe" : "ccsp";
20
+
21
+ function log(message) {
22
+ console.log(`[ccsp] ${message}`);
23
+ }
24
+
25
+ function warn(message) {
26
+ console.warn(`[ccsp] ${message}`);
27
+ }
28
+
29
+ function copyBinaryFromPackage(packageName) {
30
+ let exportedPath;
31
+ try {
32
+ // Platform package exports absolute path to the bundled binary
33
+ // eslint-disable-next-line import/no-dynamic-require, global-require
34
+ exportedPath = require(packageName);
35
+ } catch (err) {
36
+ warn(
37
+ `optional dependency '${packageName}' was not installed. ` +
38
+ "Ensure you are using npm >=7 with workspace support, or reinstall the package."
39
+ );
40
+ return false;
41
+ }
42
+
43
+ if (!exportedPath || !fs.existsSync(exportedPath)) {
44
+ warn(`binary not found in '${packageName}'. Path attempted: ${exportedPath || "<empty>"}`);
45
+ return false;
46
+ }
47
+
48
+ fs.mkdirSync(binDir, { recursive: true });
49
+ const destPath = path.join(binDir, binaryName);
50
+ fs.copyFileSync(exportedPath, destPath);
51
+
52
+ if (!isWindows) {
53
+ fs.chmodSync(destPath, 0o755);
54
+ }
55
+
56
+ log(`installed ${packageName} binary to ${destPath}`);
57
+ return true;
58
+ }
59
+
60
+ function main() {
61
+ if (process.env.CCSP_DEV_SKIP_BINARY === "1") {
62
+ log("CCSP_DEV_SKIP_BINARY=1 detected - skipping binary installation.");
63
+ return;
64
+ }
65
+
66
+ if (!pkgName) {
67
+ warn(
68
+ `no prebuilt binary available for platform '${process.platform}' architecture '${process.arch}'.\n` +
69
+ "You can compile from source with 'cargo build --release' and place the binary in your PATH."
70
+ );
71
+ process.exitCode = 1;
72
+ return;
73
+ }
74
+
75
+ if (!copyBinaryFromPackage(pkgName)) {
76
+ process.exitCode = 1;
77
+ }
78
+ }
79
+
80
+ main();
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@amadeus19/cc-statusline",
3
+ "version": "3.2.0",
4
+ "description": "Claude Code Statusline Pro - Rust-powered statusline",
5
+ "license": "MIT",
6
+ "bin": {
7
+ "cc-statusline": "index.js"
8
+ },
9
+ "files": [
10
+ "index.js",
11
+ "install.js",
12
+ "bin/",
13
+ "README.md"
14
+ ],
15
+ "scripts": {
16
+ "postinstall": "node install.js"
17
+ },
18
+ "keywords": [
19
+ "cli",
20
+ "statusline",
21
+ "claude",
22
+ "claude-code",
23
+ "rust",
24
+ "terminal",
25
+ "ccsp"
26
+ ],
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/kzj1867-spec/cc-statusline.git"
30
+ },
31
+ "bugs": {
32
+ "url": "https://github.com/kzj1867-spec/cc-statusline/issues"
33
+ },
34
+ "homepage": "https://github.com/kzj1867-spec/cc-statusline",
35
+ "author": "amadeus19",
36
+ "engines": {
37
+ "node": ">=16"
38
+ },
39
+ "optionalDependencies": {
40
+ "@amadeus19/cc-statusline-macos-arm64": "^3.0.0",
41
+ "@amadeus19/cc-statusline-macos-x64": "^3.0.0",
42
+ "@amadeus19/cc-statusline-linux-x64": "^3.0.0",
43
+ "@amadeus19/cc-statusline-linux-arm64": "^3.0.0",
44
+ "@amadeus19/cc-statusline-windows-x64": "^3.0.0",
45
+ "@amadeus19/cc-statusline-windows-arm64": "^3.0.0"
46
+ }
47
+ }