kothaset 0.0.1
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/package.json +50 -0
- package/scripts/postinstall.js +162 -0
package/package.json
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kothaset",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "High-quality dataset generation CLI for LLM training",
|
|
5
|
+
"author": "Shanto Islam <shantoislamdev@gmail.com>",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/shantoislamdev/kothaset.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/shantoislamdev/kothaset/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/shantoislamdev/kothaset#readme",
|
|
15
|
+
"keywords": [
|
|
16
|
+
"llm",
|
|
17
|
+
"dataset",
|
|
18
|
+
"ai",
|
|
19
|
+
"training",
|
|
20
|
+
"cli",
|
|
21
|
+
"machine-learning",
|
|
22
|
+
"synthetic-data",
|
|
23
|
+
"openai",
|
|
24
|
+
"gpt"
|
|
25
|
+
],
|
|
26
|
+
"bin": {
|
|
27
|
+
"kothaset": "./bin/kothaset"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"postinstall": "node scripts/postinstall.js"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=14"
|
|
34
|
+
},
|
|
35
|
+
"os": [
|
|
36
|
+
"darwin",
|
|
37
|
+
"linux",
|
|
38
|
+
"win32"
|
|
39
|
+
],
|
|
40
|
+
"cpu": [
|
|
41
|
+
"x64",
|
|
42
|
+
"arm64"
|
|
43
|
+
],
|
|
44
|
+
"files": [
|
|
45
|
+
"bin/",
|
|
46
|
+
"scripts/",
|
|
47
|
+
"README.md",
|
|
48
|
+
"LICENSE"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* KothaSet postinstall script
|
|
5
|
+
* Downloads the correct binary for the current platform from GitHub Releases
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const fs = require('fs');
|
|
9
|
+
const path = require('path');
|
|
10
|
+
const https = require('https');
|
|
11
|
+
const { execSync } = require('child_process');
|
|
12
|
+
|
|
13
|
+
const PACKAGE = require('../package.json');
|
|
14
|
+
const VERSION = PACKAGE.version;
|
|
15
|
+
const REPO = 'shantoislamdev/kothaset';
|
|
16
|
+
const BIN_DIR = path.join(__dirname, '..', 'bin');
|
|
17
|
+
const BINARY_NAME = process.platform === 'win32' ? 'kothaset.exe' : 'kothaset';
|
|
18
|
+
|
|
19
|
+
// Platform/arch mapping
|
|
20
|
+
const PLATFORM_MAP = {
|
|
21
|
+
darwin: 'darwin',
|
|
22
|
+
linux: 'linux',
|
|
23
|
+
win32: 'windows',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const ARCH_MAP = {
|
|
27
|
+
x64: 'amd64',
|
|
28
|
+
arm64: 'arm64',
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
function getPlatformArch() {
|
|
32
|
+
const platform = PLATFORM_MAP[process.platform];
|
|
33
|
+
const arch = ARCH_MAP[process.arch];
|
|
34
|
+
|
|
35
|
+
if (!platform || !arch) {
|
|
36
|
+
throw new Error(
|
|
37
|
+
`Unsupported platform: ${process.platform} ${process.arch}\n` +
|
|
38
|
+
`Supported: darwin-x64, darwin-arm64, linux-x64, linux-arm64, win32-x64`
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return { platform, arch };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function getDownloadUrl() {
|
|
46
|
+
const { platform, arch } = getPlatformArch();
|
|
47
|
+
const ext = platform === 'windows' ? 'zip' : 'tar.gz';
|
|
48
|
+
const filename = `kothaset_${VERSION}_${platform}_${arch}.${ext}`;
|
|
49
|
+
return `https://github.com/${REPO}/releases/download/v${VERSION}/${filename}`;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function download(url, dest) {
|
|
53
|
+
return new Promise((resolve, reject) => {
|
|
54
|
+
console.log(`Downloading from: ${url}`);
|
|
55
|
+
|
|
56
|
+
const file = fs.createWriteStream(dest);
|
|
57
|
+
|
|
58
|
+
const request = https.get(url, (response) => {
|
|
59
|
+
// Handle redirects
|
|
60
|
+
if (response.statusCode === 302 || response.statusCode === 301) {
|
|
61
|
+
file.close();
|
|
62
|
+
fs.unlinkSync(dest);
|
|
63
|
+
download(response.headers.location, dest).then(resolve).catch(reject);
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (response.statusCode !== 200) {
|
|
68
|
+
file.close();
|
|
69
|
+
fs.unlinkSync(dest);
|
|
70
|
+
reject(new Error(`Failed to download: HTTP ${response.statusCode}`));
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const total = parseInt(response.headers['content-length'], 10);
|
|
75
|
+
let downloaded = 0;
|
|
76
|
+
|
|
77
|
+
response.on('data', (chunk) => {
|
|
78
|
+
downloaded += chunk.length;
|
|
79
|
+
if (total) {
|
|
80
|
+
const percent = Math.round((downloaded / total) * 100);
|
|
81
|
+
process.stdout.write(`\rDownloading... ${percent}%`);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
response.pipe(file);
|
|
86
|
+
|
|
87
|
+
file.on('finish', () => {
|
|
88
|
+
file.close();
|
|
89
|
+
console.log('\nDownload complete.');
|
|
90
|
+
resolve();
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
request.on('error', (err) => {
|
|
95
|
+
file.close();
|
|
96
|
+
fs.unlinkSync(dest);
|
|
97
|
+
reject(err);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function extract(archive, dest) {
|
|
103
|
+
const { platform } = getPlatformArch();
|
|
104
|
+
|
|
105
|
+
console.log('Extracting...');
|
|
106
|
+
|
|
107
|
+
if (platform === 'windows') {
|
|
108
|
+
// Use PowerShell to extract zip on Windows
|
|
109
|
+
execSync(
|
|
110
|
+
`powershell -Command "Expand-Archive -Path '${archive}' -DestinationPath '${dest}' -Force"`,
|
|
111
|
+
{ stdio: 'inherit' }
|
|
112
|
+
);
|
|
113
|
+
} else {
|
|
114
|
+
// Use tar on Unix
|
|
115
|
+
execSync(`tar -xzf "${archive}" -C "${dest}"`, { stdio: 'inherit' });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async function main() {
|
|
120
|
+
try {
|
|
121
|
+
console.log(`\n📦 Installing KothaSet v${VERSION}...\n`);
|
|
122
|
+
|
|
123
|
+
// Create bin directory
|
|
124
|
+
if (!fs.existsSync(BIN_DIR)) {
|
|
125
|
+
fs.mkdirSync(BIN_DIR, { recursive: true });
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const { platform } = getPlatformArch();
|
|
129
|
+
const ext = platform === 'windows' ? 'zip' : 'tar.gz';
|
|
130
|
+
const archivePath = path.join(BIN_DIR, `kothaset.${ext}`);
|
|
131
|
+
|
|
132
|
+
// Download archive
|
|
133
|
+
const url = getDownloadUrl();
|
|
134
|
+
await download(url, archivePath);
|
|
135
|
+
|
|
136
|
+
// Extract
|
|
137
|
+
extract(archivePath, BIN_DIR);
|
|
138
|
+
|
|
139
|
+
// Clean up archive
|
|
140
|
+
fs.unlinkSync(archivePath);
|
|
141
|
+
|
|
142
|
+
// Make binary executable (Unix only)
|
|
143
|
+
const binaryPath = path.join(BIN_DIR, BINARY_NAME);
|
|
144
|
+
if (platform !== 'windows') {
|
|
145
|
+
fs.chmodSync(binaryPath, 0o755);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// Verify installation
|
|
149
|
+
console.log('\n✅ KothaSet installed successfully!');
|
|
150
|
+
console.log(` Binary: ${binaryPath}`);
|
|
151
|
+
console.log('\nRun "kothaset --help" to get started.\n');
|
|
152
|
+
|
|
153
|
+
} catch (error) {
|
|
154
|
+
console.error('\n❌ Installation failed:', error.message);
|
|
155
|
+
console.error('\nManual installation:');
|
|
156
|
+
console.error(` 1. Download from: https://github.com/${REPO}/releases`);
|
|
157
|
+
console.error(' 2. Extract and add to your PATH');
|
|
158
|
+
process.exit(1);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
main();
|