gbos 1.0.0
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 +2 -0
- package/package.json +40 -0
- package/src/cli.js +74 -0
- package/src/index.js +18 -0
package/README.md
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gbos",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "GBOS - Command line interface for GBOS services",
|
|
5
|
+
"main": "src/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"gbos": "./src/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "node src/index.js",
|
|
11
|
+
"cli": "node src/cli.js",
|
|
12
|
+
"dev": "node --watch src/index.js"
|
|
13
|
+
},
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"gbos",
|
|
19
|
+
"cli",
|
|
20
|
+
"tui",
|
|
21
|
+
"cloud",
|
|
22
|
+
"devtools"
|
|
23
|
+
],
|
|
24
|
+
"author": "Mystro Analytics",
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/mystroanalytics/gbos-node-local.git"
|
|
29
|
+
},
|
|
30
|
+
"bugs": {
|
|
31
|
+
"url": "https://github.com/mystroanalytics/gbos-node-local/issues"
|
|
32
|
+
},
|
|
33
|
+
"homepage": "https://github.com/mystroanalytics/gbos-node-local#readme",
|
|
34
|
+
"files": [
|
|
35
|
+
"src/**/*"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"commander": "^12.1.0"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/src/cli.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const program = new Command();
|
|
5
|
+
|
|
6
|
+
program
|
|
7
|
+
.name('gbos')
|
|
8
|
+
.description('GBOS - Command line interface for GBOS services')
|
|
9
|
+
.version('1.0.0');
|
|
10
|
+
|
|
11
|
+
program
|
|
12
|
+
.command('auth')
|
|
13
|
+
.description('Authenticate with GBOS services')
|
|
14
|
+
.option('-t, --token <token>', 'Use a specific auth token')
|
|
15
|
+
.action((options) => {
|
|
16
|
+
console.log('Authenticating with GBOS services...');
|
|
17
|
+
if (options.token) {
|
|
18
|
+
console.log('Using provided token');
|
|
19
|
+
} else {
|
|
20
|
+
console.log('Opening browser for authentication...');
|
|
21
|
+
}
|
|
22
|
+
// TODO: Implement authentication logic
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
program
|
|
26
|
+
.command('connect')
|
|
27
|
+
.description('Connect to a GBOS service or resource')
|
|
28
|
+
.argument('[service]', 'Service name to connect to')
|
|
29
|
+
.option('-e, --env <environment>', 'Environment (dev, staging, prod)', 'dev')
|
|
30
|
+
.action((service, options) => {
|
|
31
|
+
console.log(`Connecting to GBOS...`);
|
|
32
|
+
if (service) {
|
|
33
|
+
console.log(`Service: ${service}`);
|
|
34
|
+
}
|
|
35
|
+
console.log(`Environment: ${options.env}`);
|
|
36
|
+
// TODO: Implement connection logic
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
program
|
|
40
|
+
.command('help [command]')
|
|
41
|
+
.description('Display help for a specific command')
|
|
42
|
+
.action((command) => {
|
|
43
|
+
if (command) {
|
|
44
|
+
const cmd = program.commands.find(c => c.name() === command);
|
|
45
|
+
if (cmd) {
|
|
46
|
+
cmd.outputHelp();
|
|
47
|
+
} else {
|
|
48
|
+
console.log(`Unknown command: ${command}`);
|
|
49
|
+
console.log('Available commands: auth, connect, help, logout');
|
|
50
|
+
}
|
|
51
|
+
} else {
|
|
52
|
+
program.outputHelp();
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
program
|
|
57
|
+
.command('logout')
|
|
58
|
+
.description('Log out from GBOS services and clear credentials')
|
|
59
|
+
.option('-a, --all', 'Clear all stored credentials')
|
|
60
|
+
.action((options) => {
|
|
61
|
+
console.log('Logging out from GBOS services...');
|
|
62
|
+
if (options.all) {
|
|
63
|
+
console.log('Clearing all stored credentials...');
|
|
64
|
+
}
|
|
65
|
+
console.log('Successfully logged out.');
|
|
66
|
+
// TODO: Implement logout logic
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
// Show help by default if no command is provided
|
|
70
|
+
if (process.argv.length <= 2) {
|
|
71
|
+
program.outputHelp();
|
|
72
|
+
} else {
|
|
73
|
+
program.parse(process.argv);
|
|
74
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const http = require('http');
|
|
2
|
+
|
|
3
|
+
const PORT = process.env.PORT || 8080;
|
|
4
|
+
|
|
5
|
+
const server = http.createServer((req, res) => {
|
|
6
|
+
if (req.url === '/health' || req.url === '/') {
|
|
7
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
8
|
+
res.end(JSON.stringify({ status: 'ok', service: 'gbos' }));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
13
|
+
res.end(JSON.stringify({ error: 'Not found' }));
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
server.listen(PORT, () => {
|
|
17
|
+
console.log(`GBOS server listening on port ${PORT}`);
|
|
18
|
+
});
|