@88code/byebyecode 1.1.2
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/README.md +42 -0
- package/bin/byebyecode.js +93 -0
- package/package.json +34 -0
- package/scripts/postinstall.js +160 -0
package/README.md
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# @cometix/ccline
|
|
2
|
+
|
|
3
|
+
CCometixLine - High-performance Claude Code StatusLine tool
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g @88code/byebyecode
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- 🚀 **Fast**: Written in Rust for maximum performance
|
|
14
|
+
- 🌍 **Cross-platform**: Works on Windows, macOS, and Linux
|
|
15
|
+
- 📦 **Easy installation**: One command via npm
|
|
16
|
+
- 🔄 **Auto-update**: Built-in update notifications
|
|
17
|
+
- 🎨 **Beautiful**: Nerd Font icons and colors
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
After installation, ccline is automatically configured for Claude Code at `~/.claude/88code/byebyecode`.
|
|
22
|
+
|
|
23
|
+
You can also use it directly:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
byebyecode --help
|
|
27
|
+
byebyecode --version
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## For Users in China
|
|
31
|
+
|
|
32
|
+
Use npm mirror for faster installation:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm install -g @88code/byebyecode --registry https://registry.npmmirror.com
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## More Information
|
|
39
|
+
|
|
40
|
+
- GitHub: https://github.com/Haleclipse/CCometixLine
|
|
41
|
+
- Issues: https://github.com/Haleclipse/CCometixLine/issues
|
|
42
|
+
- License: MIT
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const { spawnSync } = require('child_process');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
const fs = require('fs');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
// 1. Priority: Use ~/.claude/ccline/byebyecode if exists
|
|
8
|
+
const claudePath = path.join(
|
|
9
|
+
os.homedir(),
|
|
10
|
+
'.claude',
|
|
11
|
+
'ccline',
|
|
12
|
+
process.platform === 'win32' ? 'byebyecode.exe' : 'byebyecode'
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
if (fs.existsSync(claudePath)) {
|
|
16
|
+
const result = spawnSync(claudePath, process.argv.slice(2), {
|
|
17
|
+
stdio: 'inherit',
|
|
18
|
+
shell: false
|
|
19
|
+
});
|
|
20
|
+
process.exit(result.status || 0);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 2. Fallback: Use npm package binary
|
|
24
|
+
const platform = process.platform;
|
|
25
|
+
const arch = process.arch;
|
|
26
|
+
|
|
27
|
+
// Handle special cases
|
|
28
|
+
let platformKey = `${platform}-${arch}`;
|
|
29
|
+
if (platform === 'linux') {
|
|
30
|
+
// Detect if static linking is needed based on glibc version
|
|
31
|
+
function shouldUseStaticBinary() {
|
|
32
|
+
try {
|
|
33
|
+
const { execSync } = require('child_process');
|
|
34
|
+
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
35
|
+
encoding: 'utf8',
|
|
36
|
+
timeout: 1000
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Parse "ldd (GNU libc) 2.35" format
|
|
40
|
+
const match = lddOutput.match(/(?:GNU libc|GLIBC).*?(\d+)\.(\d+)/);
|
|
41
|
+
if (match) {
|
|
42
|
+
const major = parseInt(match[1]);
|
|
43
|
+
const minor = parseInt(match[2]);
|
|
44
|
+
// Use static binary if glibc < 2.35
|
|
45
|
+
return major < 2 || (major === 2 && minor < 35);
|
|
46
|
+
}
|
|
47
|
+
} catch (e) {
|
|
48
|
+
// If detection fails, default to dynamic binary
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (shouldUseStaticBinary()) {
|
|
56
|
+
platformKey = 'linux-x64-musl';
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const packageMap = {
|
|
61
|
+
'darwin-x64': '@88code/byebyecode-darwin-x64',
|
|
62
|
+
'darwin-arm64': '@88code/byebyecode-darwin-arm64',
|
|
63
|
+
'linux-x64': '@88code/byebyecode-linux-x64',
|
|
64
|
+
'linux-x64-musl': '@88code/byebyecode-linux-x64-musl',
|
|
65
|
+
'win32-x64': '@88code/byebyecode-win32-x64',
|
|
66
|
+
'win32-ia32': '@88code/byebyecode-win32-x64', // Use 64-bit for 32-bit systems
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const packageName = packageMap[platformKey];
|
|
70
|
+
if (!packageName) {
|
|
71
|
+
console.error(`Error: Unsupported platform ${platformKey}`);
|
|
72
|
+
console.error('Supported platforms: darwin (x64/arm64), linux (x64), win32 (x64)');
|
|
73
|
+
console.error('Please visit https://github.com/Haleclipse/CCometixLine for manual installation');
|
|
74
|
+
process.exit(1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const binaryName = platform === 'win32' ? 'byebyecode.exe' : 'byebyecode';
|
|
78
|
+
const binaryPath = path.join(__dirname, '..', 'node_modules', packageName, binaryName);
|
|
79
|
+
|
|
80
|
+
if (!fs.existsSync(binaryPath)) {
|
|
81
|
+
console.error(`Error: Binary not found at ${binaryPath}`);
|
|
82
|
+
console.error('This might indicate a failed installation or unsupported platform.');
|
|
83
|
+
console.error('请尝试重新安装: npm install -g @88code/byebyecode');
|
|
84
|
+
console.error(`Expected package: ${packageName}`);
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const result = spawnSync(binaryPath, process.argv.slice(2), {
|
|
89
|
+
stdio: 'inherit',
|
|
90
|
+
shell: false
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
process.exit(result.status || 0);
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@88code/byebyecode",
|
|
3
|
+
"version": "1.1.2",
|
|
4
|
+
"description": "CCometixLine - High-performance Claude Code StatusLine tool",
|
|
5
|
+
"bin": {
|
|
6
|
+
"byebyecode": "./bin/byebyecode.js"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"postinstall": "node scripts/postinstall.js"
|
|
10
|
+
},
|
|
11
|
+
"optionalDependencies": {
|
|
12
|
+
"@88code/byebyecode-darwin-x64": "1.1.2",
|
|
13
|
+
"@88code/byebyecode-darwin-arm64": "1.1.2",
|
|
14
|
+
"@88code/byebyecode-linux-x64": "1.1.2",
|
|
15
|
+
"@88code/byebyecode-linux-x64-musl": "1.1.2",
|
|
16
|
+
"@88code/byebyecode-win32-x64": "1.1.2"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "https://github.com/byebye-code/byebyecode"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"claude",
|
|
24
|
+
"statusline",
|
|
25
|
+
"claude-code",
|
|
26
|
+
"rust",
|
|
27
|
+
"cli"
|
|
28
|
+
],
|
|
29
|
+
"author": "Haleclipse",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=14.0.0"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
|
|
5
|
+
// Silent mode detection
|
|
6
|
+
const silent = process.env.npm_config_loglevel === 'silent' ||
|
|
7
|
+
process.env.CCLINE_SKIP_POSTINSTALL === '1';
|
|
8
|
+
|
|
9
|
+
if (!silent) {
|
|
10
|
+
console.log('🚀 Setting up CCometixLine for Claude Code...');
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
const platform = process.platform;
|
|
15
|
+
const arch = process.arch;
|
|
16
|
+
const homeDir = os.homedir();
|
|
17
|
+
const claudeDir = path.join(homeDir, '.claude', 'ccline');
|
|
18
|
+
|
|
19
|
+
// Create directory
|
|
20
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
21
|
+
|
|
22
|
+
// Determine platform key
|
|
23
|
+
let platformKey = `${platform}-${arch}`;
|
|
24
|
+
if (platform === 'linux') {
|
|
25
|
+
// Detect if static linking is needed based on glibc version
|
|
26
|
+
function shouldUseStaticBinary() {
|
|
27
|
+
try {
|
|
28
|
+
const { execSync } = require('child_process');
|
|
29
|
+
const lddOutput = execSync('ldd --version 2>/dev/null || echo ""', {
|
|
30
|
+
encoding: 'utf8',
|
|
31
|
+
timeout: 1000
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// Parse "ldd (GNU libc) 2.35" format
|
|
35
|
+
const match = lddOutput.match(/(?:GNU libc|GLIBC).*?(\d+)\.(\d+)/);
|
|
36
|
+
if (match) {
|
|
37
|
+
const major = parseInt(match[1]);
|
|
38
|
+
const minor = parseInt(match[2]);
|
|
39
|
+
// Use static binary if glibc < 2.35
|
|
40
|
+
return major < 2 || (major === 2 && minor < 35);
|
|
41
|
+
}
|
|
42
|
+
} catch (e) {
|
|
43
|
+
// If detection fails, default to dynamic binary
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (shouldUseStaticBinary()) {
|
|
51
|
+
platformKey = 'linux-x64-musl';
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const packageMap = {
|
|
56
|
+
'darwin-x64': '@88code/byebyecode-darwin-x64',
|
|
57
|
+
'darwin-arm64': '@88code/byebyecode-darwin-arm64',
|
|
58
|
+
'linux-x64': '@88code/byebyecode-linux-x64',
|
|
59
|
+
'linux-x64-musl': '@88code/byebyecode-linux-x64-musl',
|
|
60
|
+
'win32-x64': '@88code/byebyecode-win32-x64',
|
|
61
|
+
'win32-ia32': '@88code/byebyecode-win32-x64', // Use 64-bit for 32-bit
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const packageName = packageMap[platformKey];
|
|
65
|
+
if (!packageName) {
|
|
66
|
+
if (!silent) {
|
|
67
|
+
console.log(`Platform ${platformKey} not supported for auto-setup`);
|
|
68
|
+
}
|
|
69
|
+
process.exit(0);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const binaryName = platform === 'win32' ? 'byebyecode.exe' : 'byebyecode';
|
|
73
|
+
const targetPath = path.join(claudeDir, binaryName);
|
|
74
|
+
|
|
75
|
+
// Multiple path search strategies for different package managers
|
|
76
|
+
const findBinaryPath = () => {
|
|
77
|
+
const possiblePaths = [
|
|
78
|
+
// npm/yarn: nested in node_modules
|
|
79
|
+
path.join(__dirname, '..', 'node_modules', packageName, binaryName),
|
|
80
|
+
// pnpm: try require.resolve first
|
|
81
|
+
(() => {
|
|
82
|
+
try {
|
|
83
|
+
const packagePath = require.resolve(packageName + '/package.json');
|
|
84
|
+
return path.join(path.dirname(packagePath), binaryName);
|
|
85
|
+
} catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
})(),
|
|
89
|
+
// pnpm: flat structure fallback with version detection
|
|
90
|
+
(() => {
|
|
91
|
+
const currentPath = __dirname;
|
|
92
|
+
const pnpmMatch = currentPath.match(/(.+\.pnpm)[\\/]([^\\//]+)[\\/]/);
|
|
93
|
+
if (pnpmMatch) {
|
|
94
|
+
const pnpmRoot = pnpmMatch[1];
|
|
95
|
+
const packageNameEncoded = packageName.replace('/', '+');
|
|
96
|
+
|
|
97
|
+
try {
|
|
98
|
+
// Try to find any version of the package
|
|
99
|
+
const pnpmContents = fs.readdirSync(pnpmRoot);
|
|
100
|
+
const packagePattern = new RegExp(`^${packageNameEncoded.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}@`);
|
|
101
|
+
const matchingPackage = pnpmContents.find(dir => packagePattern.test(dir));
|
|
102
|
+
|
|
103
|
+
if (matchingPackage) {
|
|
104
|
+
return path.join(pnpmRoot, matchingPackage, 'node_modules', packageName, binaryName);
|
|
105
|
+
}
|
|
106
|
+
} catch {
|
|
107
|
+
// Fallback to current behavior if directory reading fails
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
})()
|
|
112
|
+
].filter(p => p !== null);
|
|
113
|
+
|
|
114
|
+
for (const testPath of possiblePaths) {
|
|
115
|
+
if (fs.existsSync(testPath)) {
|
|
116
|
+
return testPath;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
const sourcePath = findBinaryPath();
|
|
123
|
+
if (!sourcePath) {
|
|
124
|
+
if (!silent) {
|
|
125
|
+
console.log('Binary package not installed, skipping Claude Code setup');
|
|
126
|
+
console.log('The global ccline command will still work via npm');
|
|
127
|
+
}
|
|
128
|
+
process.exit(0);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Copy or link the binary
|
|
132
|
+
if (platform === 'win32') {
|
|
133
|
+
// Windows: Copy file
|
|
134
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
135
|
+
} else {
|
|
136
|
+
// Unix: Try hard link first, fallback to copy
|
|
137
|
+
try {
|
|
138
|
+
if (fs.existsSync(targetPath)) {
|
|
139
|
+
fs.unlinkSync(targetPath);
|
|
140
|
+
}
|
|
141
|
+
fs.linkSync(sourcePath, targetPath);
|
|
142
|
+
} catch {
|
|
143
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
144
|
+
}
|
|
145
|
+
fs.chmodSync(targetPath, '755');
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!silent) {
|
|
149
|
+
console.log('✨ CCometixLine is ready for Claude Code!');
|
|
150
|
+
console.log(`📍 Location: ${targetPath}`);
|
|
151
|
+
console.log('🎉 You can now use: ccline --help');
|
|
152
|
+
}
|
|
153
|
+
} catch (error) {
|
|
154
|
+
// Silent failure - don't break installation
|
|
155
|
+
if (!silent) {
|
|
156
|
+
console.log('Note: Could not auto-configure for Claude Code');
|
|
157
|
+
console.log('The global ccline command will still work.');
|
|
158
|
+
console.log('You can manually copy ccline to ~/.claude/ccline/ if needed');
|
|
159
|
+
}
|
|
160
|
+
}
|