quickspin-cli 0.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 ADDED
@@ -0,0 +1,79 @@
1
+ # @quickspin/cli
2
+
3
+ Official CLI for QuickSpin - Managed microservices platform providing Redis, RabbitMQ, Elasticsearch, PostgreSQL, and MongoDB as fully managed services.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install -g @quickspin/cli
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ After installation, the `qspin` command will be available globally:
14
+
15
+ ```bash
16
+ # Check version
17
+ qspin version
18
+
19
+ # Login
20
+ qspin auth login
21
+
22
+ # Create a service
23
+ qspin services create --name my-redis --type redis --tier developer
24
+
25
+ # List services
26
+ qspin services list
27
+
28
+ # Get help
29
+ qspin --help
30
+ ```
31
+
32
+ ## Quick Start
33
+
34
+ 1. **Login to QuickSpin**
35
+ ```bash
36
+ qspin auth login
37
+ ```
38
+
39
+ 2. **Create your first service**
40
+ ```bash
41
+ qspin services create --name my-redis --type redis --tier developer
42
+ ```
43
+
44
+ 3. **Get connection credentials**
45
+ ```bash
46
+ qspin services connect my-redis
47
+ ```
48
+
49
+ ## Features
50
+
51
+ - **Service Management**: Create, list, delete, and manage managed services
52
+ - **Authentication**: Secure JWT-based authentication with OAuth support
53
+ - **Multi-Organization**: Switch between organizations and manage teams
54
+ - **Billing & Usage**: Monitor usage and view invoices
55
+ - **AI Recommendations**: Get intelligent service optimization suggestions
56
+ - **GitOps Support**: Deploy services using YAML configuration files
57
+ - **Shell Completions**: Auto-completion for bash, zsh, fish, and PowerShell
58
+
59
+ ## Supported Services
60
+
61
+ - Redis (in-memory data store)
62
+ - RabbitMQ (message broker)
63
+ - PostgreSQL (relational database)
64
+ - MongoDB (document database)
65
+ - MySQL (relational database)
66
+ - Elasticsearch (search and analytics)
67
+
68
+ ## Documentation
69
+
70
+ For full documentation, visit [https://docs.quickspin.dev](https://docs.quickspin.dev)
71
+
72
+ ## Support
73
+
74
+ - GitHub Issues: [https://github.com/quickspin/quickspin-cli/issues](https://github.com/quickspin/quickspin-cli/issues)
75
+ - Email: support@quickspin.dev
76
+
77
+ ## License
78
+
79
+ MIT
package/index.js ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process');
4
+ const path = require('path');
5
+
6
+ const binName = process.platform === 'win32' ? 'qspin.exe' : 'qspin';
7
+ const binPath = path.join(__dirname, 'bin', binName);
8
+
9
+ // Pass all arguments to the binary
10
+ const child = spawn(binPath, process.argv.slice(2), {
11
+ stdio: 'inherit',
12
+ shell: false,
13
+ });
14
+
15
+ child.on('exit', (code) => {
16
+ process.exit(code || 0);
17
+ });
18
+
19
+ child.on('error', (err) => {
20
+ console.error('Failed to execute qspin:', err.message);
21
+ process.exit(1);
22
+ });
package/install.js ADDED
@@ -0,0 +1,161 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process');
6
+ const https = require('https');
7
+ const zlib = require('zlib');
8
+ const tar = require('tar');
9
+
10
+ const GITHUB_REPO = 'quickspin/quickspin-cli';
11
+ const packageJson = require('./package.json');
12
+ const VERSION = packageJson.version;
13
+
14
+ function getPlatform() {
15
+ const platform = process.platform;
16
+ const arch = process.arch;
17
+
18
+ const platformMap = {
19
+ darwin: 'darwin',
20
+ linux: 'linux',
21
+ win32: 'windows',
22
+ };
23
+
24
+ const archMap = {
25
+ x64: 'x86_64',
26
+ arm64: 'arm64',
27
+ };
28
+
29
+ const mappedPlatform = platformMap[platform];
30
+ const mappedArch = archMap[arch];
31
+
32
+ if (!mappedPlatform || !mappedArch) {
33
+ throw new Error(
34
+ `Unsupported platform: ${platform}-${arch}. Supported: darwin/linux/windows on x64/arm64`
35
+ );
36
+ }
37
+
38
+ return { platform: mappedPlatform, arch: mappedArch };
39
+ }
40
+
41
+ function getBinaryName() {
42
+ return process.platform === 'win32' ? 'qspin.exe' : 'qspin';
43
+ }
44
+
45
+ function getDownloadURL() {
46
+ const { platform, arch } = getPlatform();
47
+ const ext = platform === 'windows' ? 'zip' : 'tar.gz';
48
+ return `https://github.com/${GITHUB_REPO}/releases/download/v${VERSION}/qspin-${VERSION}-${platform}-${arch}.${ext}`;
49
+ }
50
+
51
+ function download(url, dest) {
52
+ return new Promise((resolve, reject) => {
53
+ console.log(`Downloading ${url}...`);
54
+
55
+ https.get(url, (response) => {
56
+ if (response.statusCode === 302 || response.statusCode === 301) {
57
+ // Follow redirect
58
+ download(response.headers.location, dest).then(resolve).catch(reject);
59
+ return;
60
+ }
61
+
62
+ if (response.statusCode !== 200) {
63
+ reject(new Error(`Failed to download: ${response.statusCode} ${response.statusMessage}`));
64
+ return;
65
+ }
66
+
67
+ const file = fs.createWriteStream(dest);
68
+ response.pipe(file);
69
+
70
+ file.on('finish', () => {
71
+ file.close();
72
+ resolve();
73
+ });
74
+
75
+ file.on('error', (err) => {
76
+ fs.unlink(dest, () => {});
77
+ reject(err);
78
+ });
79
+ }).on('error', reject);
80
+ });
81
+ }
82
+
83
+ async function extractArchive(archivePath, destDir) {
84
+ const { platform } = getPlatform();
85
+
86
+ if (platform === 'windows') {
87
+ // Extract ZIP
88
+ const AdmZip = require('adm-zip');
89
+ const zip = new AdmZip(archivePath);
90
+ zip.extractAllTo(destDir, true);
91
+ } else {
92
+ // Extract tar.gz
93
+ await tar.x({
94
+ file: archivePath,
95
+ cwd: destDir,
96
+ });
97
+ }
98
+ }
99
+
100
+ async function install() {
101
+ try {
102
+ const binDir = path.join(__dirname, 'bin');
103
+ const distDir = path.join(__dirname, 'dist');
104
+
105
+ // Create directories
106
+ if (!fs.existsSync(binDir)) {
107
+ fs.mkdirSync(binDir, { recursive: true });
108
+ }
109
+ if (!fs.existsSync(distDir)) {
110
+ fs.mkdirSync(distDir, { recursive: true });
111
+ }
112
+
113
+ const downloadURL = getDownloadURL();
114
+ const { platform } = getPlatform();
115
+ const ext = platform === 'windows' ? 'zip' : 'tar.gz';
116
+ const archivePath = path.join(distDir, `qspin.${ext}`);
117
+
118
+ // Download binary
119
+ await download(downloadURL, archivePath);
120
+
121
+ // Extract archive
122
+ console.log('Extracting archive...');
123
+ await extractArchive(archivePath, distDir);
124
+
125
+ // Move binary to bin directory
126
+ const binaryName = getBinaryName();
127
+ const extractedBinary = path.join(distDir, binaryName);
128
+ const targetBinary = path.join(binDir, binaryName);
129
+
130
+ if (fs.existsSync(extractedBinary)) {
131
+ fs.renameSync(extractedBinary, targetBinary);
132
+ } else {
133
+ throw new Error(`Binary not found after extraction: ${extractedBinary}`);
134
+ }
135
+
136
+ // Make executable on Unix systems
137
+ if (process.platform !== 'win32') {
138
+ fs.chmodSync(targetBinary, '755');
139
+ }
140
+
141
+ // Clean up
142
+ fs.unlinkSync(archivePath);
143
+
144
+ console.log('✅ QuickSpin CLI installed successfully!');
145
+ console.log(`Run 'qspin --version' to verify installation.`);
146
+ console.log(`Get started with 'qspin auth login'`);
147
+
148
+ } catch (error) {
149
+ console.error('❌ Installation failed:', error.message);
150
+ console.error('\nPlease try manual installation:');
151
+ console.error(` Visit: https://github.com/${GITHUB_REPO}/releases/tag/v${VERSION}`);
152
+ process.exit(1);
153
+ }
154
+ }
155
+
156
+ // Only run if called directly
157
+ if (require.main === module) {
158
+ install();
159
+ }
160
+
161
+ module.exports = { install };
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "quickspin-cli",
3
+ "version": "0.1.2",
4
+ "description": "Official CLI for QuickSpin - Managed microservices platform providing Redis, RabbitMQ, Elasticsearch, PostgreSQL, and MongoDB as fully managed services",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "qspin": "./bin/qspin"
8
+ },
9
+ "scripts": {
10
+ "postinstall": "node install.js",
11
+ "preuninstall": "node uninstall.js",
12
+ "test": "node test.js"
13
+ },
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/quickspin/quickspin-cli.git"
17
+ },
18
+ "keywords": [
19
+ "quickspin",
20
+ "cli",
21
+ "microservices",
22
+ "redis",
23
+ "rabbitmq",
24
+ "elasticsearch",
25
+ "postgresql",
26
+ "mongodb",
27
+ "mysql",
28
+ "database",
29
+ "managed-services",
30
+ "devtools",
31
+ "kubernetes",
32
+ "cloud"
33
+ ],
34
+ "author": "QuickSpin Team <opensource@quickspin.dev>",
35
+ "license": "MIT",
36
+ "bugs": {
37
+ "url": "https://github.com/quickspin/quickspin-cli/issues"
38
+ },
39
+ "homepage": "https://quickspin.dev",
40
+ "engines": {
41
+ "node": ">=14.0.0"
42
+ },
43
+ "os": [
44
+ "darwin",
45
+ "linux",
46
+ "win32"
47
+ ],
48
+ "cpu": [
49
+ "x64",
50
+ "arm64"
51
+ ],
52
+ "files": [
53
+ "bin/",
54
+ "dist/",
55
+ "install.js",
56
+ "uninstall.js",
57
+ "index.js",
58
+ "README.md",
59
+ "LICENSE"
60
+ ]
61
+ }
package/uninstall.js ADDED
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+
6
+ function uninstall() {
7
+ try {
8
+ const binDir = path.join(__dirname, 'bin');
9
+ const distDir = path.join(__dirname, 'dist');
10
+
11
+ // Remove bin directory
12
+ if (fs.existsSync(binDir)) {
13
+ fs.rmSync(binDir, { recursive: true, force: true });
14
+ console.log('Removed bin directory');
15
+ }
16
+
17
+ // Remove dist directory
18
+ if (fs.existsSync(distDir)) {
19
+ fs.rmSync(distDir, { recursive: true, force: true });
20
+ console.log('Removed dist directory');
21
+ }
22
+
23
+ console.log('✅ QuickSpin CLI uninstalled successfully!');
24
+ } catch (error) {
25
+ console.error('⚠️ Uninstallation warning:', error.message);
26
+ }
27
+ }
28
+
29
+ // Only run if called directly
30
+ if (require.main === module) {
31
+ uninstall();
32
+ }
33
+
34
+ module.exports = { uninstall };