@kandiforge/kandi-cli 8.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/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ PROPRIETARY SOFTWARE LICENSE
2
+
3
+ Copyright (c) 2025 KandiForge. All rights reserved.
4
+
5
+ This software and associated documentation files (the "Software") are proprietary
6
+ and confidential. The Software is licensed, not sold.
7
+
8
+ RESTRICTIONS:
9
+ - You may not distribute, sublicense, or resell the Software
10
+ - You may not reverse engineer, decompile, or disassemble the Software
11
+ - You may not remove or alter any proprietary notices or labels
12
+
13
+ USE:
14
+ The Software is provided for use according to the terms of your license agreement
15
+ with KandiForge.
16
+
17
+ NO WARRANTY:
18
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED.
19
+
20
+ For licensing inquiries, contact: support@kandiforge.com
package/README.md ADDED
@@ -0,0 +1,70 @@
1
+ ![Kandi CLI Logo](kandi-icon.png)
2
+
3
+ # Kandi CLI
4
+
5
+ AI-assisted software development CLI with interactive chat and 26 built-in tools.
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install -g kandi-cli
11
+ ```
12
+
13
+ Or use with npx:
14
+
15
+ ```bash
16
+ npx kandi-cli --help
17
+ ```
18
+
19
+ ## Requirements
20
+
21
+ - macOS (Intel or Apple Silicon)
22
+ - Node.js 14.0.0 or higher
23
+
24
+ ## Getting Started
25
+
26
+ ### 1. Configure API Keys
27
+
28
+ ```bash
29
+ kandi config set anthropic.api_key "your-api-key"
30
+ kandi config set openai.api_key "your-api-key"
31
+ kandi config set github.token "your-token"
32
+ ```
33
+
34
+ ### 2. Start Interactive Chat
35
+
36
+ ```bash
37
+ kandi chat --allow-all
38
+ ```
39
+
40
+ ### 3. Execute Coding Tasks
41
+
42
+ ```bash
43
+ kandi code "Create a Python script that prints hello world"
44
+ ```
45
+
46
+ ### 4. Run Spec Files
47
+
48
+ ```bash
49
+ kandi exec-spec /path/to/spec.md
50
+ ```
51
+
52
+ ## Features
53
+
54
+ - **Interactive Chat Mode**: Engage with AI assistants in a conversational interface
55
+ - **26 Built-in Tools**: Comprehensive toolset for software development tasks
56
+ - **Multiple AI Providers**: Support for Anthropic, OpenAI, and other providers
57
+ - **GitHub Integration**: Seamless integration with GitHub repositories
58
+ - **Spec File Execution**: Run detailed specifications for complex tasks
59
+
60
+ ## Documentation
61
+
62
+ For detailed documentation and updates, visit: https://github.com/KandiForge/kandi-cli-releases
63
+
64
+ ## Support
65
+
66
+ Report issues at: https://github.com/KandiForge/kandi-cli-releases/issues
67
+
68
+ ## License
69
+
70
+ This is proprietary software. See LICENSE for details.
package/bin/kandi ADDED
@@ -0,0 +1 @@
1
+ #\!/bin/sh
package/package.json ADDED
@@ -0,0 +1,48 @@
1
+ {
2
+ "name": "@kandiforge/kandi-cli",
3
+ "version": "8.0.1",
4
+ "description": "AI-assisted software development CLI with interactive chat and 26 built-in tools",
5
+ "author": "KandiForge",
6
+ "license": "Proprietary",
7
+ "homepage": "https://github.com/KandiForge/kandi-cli-releases",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/KandiForge/kandi-cli-releases.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/KandiForge/kandi-cli-releases/issues"
14
+ },
15
+ "keywords": [
16
+ "ai",
17
+ "cli",
18
+ "development",
19
+ "assistant",
20
+ "kandi",
21
+ "kandiforge",
22
+ "code-generation",
23
+ "software-development"
24
+ ],
25
+ "bin": {
26
+ "kandi": "./bin/kandi"
27
+ },
28
+ "scripts": {
29
+ "postinstall": "node scripts/install.js",
30
+ "test": "echo \"No tests configured\""
31
+ },
32
+ "files": [
33
+ "bin/",
34
+ "scripts/",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "engines": {
39
+ "node": ">=14.0.0"
40
+ },
41
+ "os": [
42
+ "darwin"
43
+ ],
44
+ "cpu": [
45
+ "x64",
46
+ "arm64"
47
+ ]
48
+ }
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const https = require('https');
6
+ const { execSync } = require('child_process');
7
+ const crypto = require('crypto');
8
+
9
+ const RELEASE_VERSION = '8.0.1';
10
+ const REPO = 'KandiForge/apps';
11
+
12
+ function getArch() {
13
+ const arch = process.arch;
14
+ if (arch === 'x64') return 'x86_64';
15
+ if (arch === 'arm64') return 'arm64';
16
+ throw new Error(`Unsupported architecture: ${arch}`);
17
+ }
18
+
19
+ function downloadFile(url, destPath) {
20
+ return new Promise((resolve, reject) => {
21
+ console.log(`Downloading from: ${url}`);
22
+
23
+ https.get(url, (response) => {
24
+ if (response.statusCode === 302 || response.statusCode === 301) {
25
+ // Follow redirect
26
+ return downloadFile(response.headers.location, destPath)
27
+ .then(resolve)
28
+ .catch(reject);
29
+ }
30
+
31
+ if (response.statusCode !== 200) {
32
+ reject(new Error(`Failed to download: ${response.statusCode}`));
33
+ return;
34
+ }
35
+
36
+ const file = fs.createWriteStream(destPath);
37
+ response.pipe(file);
38
+
39
+ file.on('finish', () => {
40
+ file.close();
41
+ resolve();
42
+ });
43
+
44
+ file.on('error', (err) => {
45
+ fs.unlink(destPath, () => {});
46
+ reject(err);
47
+ });
48
+ }).on('error', reject);
49
+ });
50
+ }
51
+
52
+ async function verifyChecksum(filePath, expectedHash) {
53
+ return new Promise((resolve, reject) => {
54
+ const hash = crypto.createHash('sha256');
55
+ const stream = fs.createReadStream(filePath);
56
+
57
+ stream.on('data', (data) => hash.update(data));
58
+ stream.on('end', () => {
59
+ const fileHash = hash.digest('hex');
60
+ if (fileHash === expectedHash) {
61
+ resolve(true);
62
+ } else {
63
+ reject(new Error(`Checksum mismatch. Expected: ${expectedHash}, Got: ${fileHash}`));
64
+ }
65
+ });
66
+ stream.on('error', reject);
67
+ });
68
+ }
69
+
70
+ async function install() {
71
+ try {
72
+ const arch = getArch();
73
+ const platform = process.platform;
74
+
75
+ if (platform !== 'darwin') {
76
+ throw new Error(`Platform ${platform} is not supported. Only macOS is supported.`);
77
+ }
78
+
79
+ // Download URL for the binary
80
+ const fileName = `kandi-cli-v${RELEASE_VERSION}-macos-universal.tar.gz`;
81
+ const downloadUrl = `https://github.com/${REPO}/releases/download/cli-v${RELEASE_VERSION}/${fileName}`;
82
+
83
+ const binDir = path.join(__dirname, '..', 'bin');
84
+ const tempFile = path.join(binDir, fileName);
85
+
86
+ // Create bin directory if it doesn't exist
87
+ if (!fs.existsSync(binDir)) {
88
+ fs.mkdirSync(binDir, { recursive: true });
89
+ }
90
+
91
+ // Download the release tarball
92
+ console.log(`Installing Kandi CLI v${RELEASE_VERSION} for ${platform} ${arch}...`);
93
+ await downloadFile(downloadUrl, tempFile);
94
+
95
+ // Extract the binary
96
+ console.log('Extracting binary...');
97
+ execSync(`tar -xzf "${tempFile}" -C "${binDir}"`, { stdio: 'inherit' });
98
+
99
+ // Clean up tarball
100
+ fs.unlinkSync(tempFile);
101
+
102
+ // The tarball extracts to kandi-cli-v{version}/kandi
103
+ const extractedDir = path.join(binDir, `kandi-cli-v${RELEASE_VERSION}`);
104
+ const extractedPath = path.join(extractedDir, 'kandi');
105
+ const binaryPath = path.join(binDir, 'kandi-bin');
106
+
107
+ // Move the extracted binary to the correct location
108
+ if (fs.existsSync(extractedPath)) {
109
+ fs.renameSync(extractedPath, binaryPath);
110
+ // Clean up the extracted directory
111
+ fs.rmdirSync(extractedDir);
112
+ } else {
113
+ throw new Error(`Binary not found at expected location: ${extractedPath}`);
114
+ }
115
+
116
+ // Make binary executable
117
+ fs.chmodSync(binaryPath, 0o755);
118
+
119
+ console.log('✅ Kandi CLI installed successfully!');
120
+ console.log(`Binary location: ${binaryPath}`);
121
+ console.log('\nTo get started, run: kandi --help');
122
+
123
+ } catch (error) {
124
+ console.error('❌ Installation failed:', error.message);
125
+
126
+ // Fallback: Try to use locally built binary if available
127
+ const localBinary = '/Users/admin/kandi-forge/kandi-cli/target/release/kandi';
128
+ const binDir = path.join(__dirname, '..', 'bin');
129
+ const targetBinary = path.join(binDir, 'kandi-bin');
130
+
131
+ if (fs.existsSync(localBinary)) {
132
+ console.log('Using local development binary as fallback...');
133
+ if (!fs.existsSync(binDir)) {
134
+ fs.mkdirSync(binDir, { recursive: true });
135
+ }
136
+ fs.copyFileSync(localBinary, targetBinary);
137
+ fs.chmodSync(targetBinary, 0o755);
138
+ console.log('✅ Installed local development binary');
139
+ } else {
140
+ process.exit(1);
141
+ }
142
+ }
143
+ }
144
+
145
+ // Run installation
146
+ install();