kalshi-cli 1.1.1 → 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/package.json +1 -1
- package/postinstall.js +39 -1
package/package.json
CHANGED
package/postinstall.js
CHANGED
|
@@ -8,6 +8,7 @@ const os = require('os');
|
|
|
8
8
|
const CLI_DIR = path.join(os.homedir(), '.local', 'share', 'kalshi-cli');
|
|
9
9
|
const VENV_DIR = path.join(CLI_DIR, '.venv');
|
|
10
10
|
const REPO_URL = 'https://github.com/JThomasDevs/kalshi-cli.git';
|
|
11
|
+
const KALSHI_DIR = path.join(os.homedir(), '.kalshi');
|
|
11
12
|
|
|
12
13
|
console.log('🎰 Setting up kalshi-cli...');
|
|
13
14
|
|
|
@@ -53,11 +54,48 @@ function setupVenv() {
|
|
|
53
54
|
});
|
|
54
55
|
}
|
|
55
56
|
|
|
57
|
+
// Set up ~/.kalshi directory with .env template
|
|
58
|
+
function setupKalshiConfig() {
|
|
59
|
+
console.log('📄 Setting up ~/.kalshi configuration...');
|
|
60
|
+
|
|
61
|
+
fs.mkdirSync(KALSHI_DIR, { recursive: true });
|
|
62
|
+
|
|
63
|
+
const envPath = path.join(KALSHI_DIR, '.env');
|
|
64
|
+
if (!fs.existsSync(envPath)) {
|
|
65
|
+
fs.writeFileSync(envPath, `# Kalshi API Configuration
|
|
66
|
+
# Get credentials at: https://kalshi.com/api
|
|
67
|
+
KALSHI_ACCESS_KEY=your_access_key_here
|
|
68
|
+
`);
|
|
69
|
+
console.log('📄 Created ~/.kalshi/.env — edit it with your API key');
|
|
70
|
+
} else {
|
|
71
|
+
console.log('✅ ~/.kalshi/.env already exists');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const keyPath = path.join(KALSHI_DIR, 'private_key.pem');
|
|
75
|
+
if (!fs.existsSync(keyPath)) {
|
|
76
|
+
fs.writeFileSync(keyPath, `# Place your RSA private key here
|
|
77
|
+
# Get it from: https://kalshi.com/api
|
|
78
|
+
-----BEGIN RSA PRIVATE KEY-----
|
|
79
|
+
your_private_key_here
|
|
80
|
+
-----END RSA PRIVATE KEY-----
|
|
81
|
+
`);
|
|
82
|
+
console.log('📄 Created ~/.kalshi/private_key.pem — place your RSA private key here');
|
|
83
|
+
} else {
|
|
84
|
+
console.log('✅ ~/.kalshi/private_key.pem already exists');
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
56
88
|
async function main() {
|
|
57
89
|
await setupRepo();
|
|
58
90
|
await setupVenv();
|
|
91
|
+
setupKalshiConfig();
|
|
92
|
+
console.log('');
|
|
59
93
|
console.log('✅ kalshi-cli is ready!');
|
|
60
|
-
console.log('
|
|
94
|
+
console.log('');
|
|
95
|
+
console.log('📋 Next steps:');
|
|
96
|
+
console.log(' 1. Edit ~/.kalshi/.env with your KALSHI_ACCESS_KEY');
|
|
97
|
+
console.log(' 2. Paste your RSA private key into ~/.kalshi/private_key.pem');
|
|
98
|
+
console.log(' 3. Run: kalshi --help');
|
|
61
99
|
}
|
|
62
100
|
|
|
63
101
|
main().catch(err => {
|