gingee-cli 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/LICENSE +21 -0
- package/README.md +163 -0
- package/commands/addApp.js +126 -0
- package/commands/addScript.js +45 -0
- package/commands/apiClient.js +139 -0
- package/commands/deleteApp.js +62 -0
- package/commands/init.js +133 -0
- package/commands/installApp.js +85 -0
- package/commands/installStoreApp.js +87 -0
- package/commands/installerUtils.js +430 -0
- package/commands/listApps.js +41 -0
- package/commands/listBackups.js +41 -0
- package/commands/listStoreApps.js +60 -0
- package/commands/login.js +70 -0
- package/commands/logout.js +10 -0
- package/commands/packageApp.js +66 -0
- package/commands/resetGlade.js +95 -0
- package/commands/resetPwd.js +80 -0
- package/commands/rollbackApp.js +63 -0
- package/commands/service.js +123 -0
- package/commands/upgradeApp.js +80 -0
- package/commands/upgradeStoreApp.js +97 -0
- package/commands/utils.js +35 -0
- package/index.js +154 -0
- package/package.json +51 -0
- package/templates/project/ecosystem.config.js +34 -0
- package/templates/project/gingee.json +34 -0
- package/templates/project/package.json +15 -0
- package/templates/project/start.js +6 -0
package/index.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const { Command } = require('commander');
|
|
4
|
+
const { init } = require('./commands/init');
|
|
5
|
+
const { addApp } = require('./commands/addApp');
|
|
6
|
+
const { addScript } = require('./commands/addScript');
|
|
7
|
+
|
|
8
|
+
const { resetPwd } = require('./commands/resetPwd');
|
|
9
|
+
const { resetGlade } = require('./commands/resetGlade');
|
|
10
|
+
|
|
11
|
+
const serviceCommands = require('./commands/service');
|
|
12
|
+
|
|
13
|
+
const { login } = require('./commands/login');
|
|
14
|
+
const { logout } = require('./commands/logout');
|
|
15
|
+
const { listApps } = require('./commands/listApps');
|
|
16
|
+
const { installApp } = require('./commands/installApp');
|
|
17
|
+
const { upgradeApp } = require('./commands/upgradeApp');
|
|
18
|
+
const { deleteApp } = require('./commands/deleteApp');
|
|
19
|
+
const { rollbackApp } = require('./commands/rollbackApp');
|
|
20
|
+
const { packageApp } = require('./commands/packageApp');
|
|
21
|
+
const { listBackups } = require('./commands/listBackups');
|
|
22
|
+
|
|
23
|
+
const { listStoreApps } = require('./commands/listStoreApps');
|
|
24
|
+
const { installStoreApp } = require('./commands/installStoreApp');
|
|
25
|
+
const { upgradeStoreApp } = require('./commands/upgradeStoreApp');
|
|
26
|
+
|
|
27
|
+
const packageJson = require('./package.json'); // For version number
|
|
28
|
+
const program = new Command();
|
|
29
|
+
|
|
30
|
+
program
|
|
31
|
+
.name('gingee-cli')
|
|
32
|
+
.description('The official command-line interface for the Gingee platform.')
|
|
33
|
+
.version(packageJson.version);
|
|
34
|
+
|
|
35
|
+
// Local scaffolding commands
|
|
36
|
+
program
|
|
37
|
+
.command('init <project-name>')
|
|
38
|
+
.description('Scaffold a new Gingee project in a new directory.')
|
|
39
|
+
.action(init);
|
|
40
|
+
|
|
41
|
+
program
|
|
42
|
+
.command('add-app <app-name>')
|
|
43
|
+
.description('Scaffold a new, interactive app inside the current project.')
|
|
44
|
+
.action(addApp);
|
|
45
|
+
|
|
46
|
+
program
|
|
47
|
+
.command('add-script <app-name> <script-path>')
|
|
48
|
+
.description("Create a new server script with boilerplate. Path format: '<app-name>/box/<script-path>'")
|
|
49
|
+
.action(addScript);
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
// Utility and recovery commands
|
|
53
|
+
program
|
|
54
|
+
.command('reset-pwd')
|
|
55
|
+
.description("Reset the Gingee - Glade admin password by directly updating its config file.")
|
|
56
|
+
.action(resetPwd);
|
|
57
|
+
|
|
58
|
+
program
|
|
59
|
+
.command('reset-glade')
|
|
60
|
+
.description("Reset the Gingee - Glade admin app to a clean, default installation.")
|
|
61
|
+
.action(resetGlade);
|
|
62
|
+
|
|
63
|
+
// Service management commands
|
|
64
|
+
|
|
65
|
+
const serviceCmd = program.command('service')
|
|
66
|
+
.description('Manage the Gingee server as a native background service (requires admin/sudo).');
|
|
67
|
+
|
|
68
|
+
serviceCmd.command('install').description('Install and start Gingee as a background service.').action(serviceCommands.install);
|
|
69
|
+
serviceCmd.command('uninstall').description('Stop and remove the Gingee background service.').action(serviceCommands.uninstall);
|
|
70
|
+
serviceCmd.command('start').description('Start the Gingee background service.').action(serviceCommands.start);
|
|
71
|
+
serviceCmd.command('stop').description('Stop the Gingee background service.').action(serviceCommands.stop);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
// Server Administration Commands
|
|
75
|
+
program.command('login').description('Authenticate with a Gingee Glade instance. Defaults to http://localhost:7070')
|
|
76
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
77
|
+
.requiredOption('-u, --username <username>', 'Username for authentication', 'admin')
|
|
78
|
+
.option('-p, --password <password>', 'Password for authentication')
|
|
79
|
+
.action(login);
|
|
80
|
+
|
|
81
|
+
program.command('logout').description('Log out of the current Gingee Glade session. Defaults to http://localhost:7070')
|
|
82
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
83
|
+
.action(logout);
|
|
84
|
+
|
|
85
|
+
program.command('list-apps').description('List all applications on the running Gingee server. Defaults to http://localhost:7070')
|
|
86
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
87
|
+
.action(listApps);
|
|
88
|
+
|
|
89
|
+
program.command('install-app')
|
|
90
|
+
.description('Interactively install a new application from a local .gin package.')
|
|
91
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
92
|
+
.requiredOption('-a, --appName <app-name>', 'The name for the application to be installed.')
|
|
93
|
+
.requiredOption('-p, --ginPath <path-to-gin-file>', 'The path to the local app package (.gin) file.')
|
|
94
|
+
.option('-f, --file <path-to-preset-file>', 'Use a preset file for non-interactive installation.')
|
|
95
|
+
.action(installApp);
|
|
96
|
+
|
|
97
|
+
program.command('upgrade-app')
|
|
98
|
+
.description('Upgrade an existing application from a .gin package.')
|
|
99
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
100
|
+
.requiredOption('-a, --appName <app-name>', 'The name of the application to upgrade.')
|
|
101
|
+
.requiredOption('-p, --ginPath <path-to-gin-file>', 'The path to the app package (.gin) file.')
|
|
102
|
+
.option('-f, --file <path-to-preset-file>', 'Use a preset file for non-interactive upgrade.')
|
|
103
|
+
.action(upgradeApp);
|
|
104
|
+
|
|
105
|
+
program.command('delete-app')
|
|
106
|
+
.description('Permanently delete an application from the server.')
|
|
107
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
108
|
+
.requiredOption('-a, --appName <app-name>', 'The name of the application to delete.')
|
|
109
|
+
.option('-f, --file <path-to-preset-file>', 'Use a preset file for non-interactive delete.')
|
|
110
|
+
.action(deleteApp);
|
|
111
|
+
|
|
112
|
+
program.command('rollback-app')
|
|
113
|
+
.description('Roll back an application to its most recent backup.')
|
|
114
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
115
|
+
.requiredOption('-a, --appName <app-name>', 'The name of the application to roll back.')
|
|
116
|
+
.option('-f, --file <path-to-preset-file>', 'Use a preset file for non-interactive rollback.')
|
|
117
|
+
.action(rollbackApp);
|
|
118
|
+
|
|
119
|
+
program.command('package-app')
|
|
120
|
+
.description('Package a live application into a downloadable .gin file.')
|
|
121
|
+
.requiredOption('-s, --serverUrl <server-url>', 'The base URL of the target Gingee server', 'http://localhost:7070')
|
|
122
|
+
.requiredOption('-a, --appName <app-name>', 'The name of the application to package.')
|
|
123
|
+
.option('-d, --dest <path>', 'The destination folder for the .gin app package file.')
|
|
124
|
+
.action(packageApp);
|
|
125
|
+
|
|
126
|
+
program.command('list-app-backups')
|
|
127
|
+
.description('List all available backups for an application.')
|
|
128
|
+
.requiredOption('-s, --serverUrl <server-url>', 'The base URL of the target Gingee server', 'http://localhost:7070')
|
|
129
|
+
.requiredOption('-a, --appName <app-name>', 'The name of the application to list backups for.')
|
|
130
|
+
.action(listBackups);
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
// --- App Store Commands ---
|
|
134
|
+
program.command('list-store-apps')
|
|
135
|
+
.description('List available applications from a store manifest URL.')
|
|
136
|
+
.requiredOption('-g, --gStoreUrl <gstore-url>', 'Gingee app store URL')
|
|
137
|
+
.action(listStoreApps);
|
|
138
|
+
|
|
139
|
+
program.command('install-store-app <app-name>')
|
|
140
|
+
.description('Interactively install an application from a store onto a target Gingee server.')
|
|
141
|
+
.requiredOption('-g, --gStoreUrl <gstore-url>', 'Gingee app store URL')
|
|
142
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
143
|
+
.action(installStoreApp);
|
|
144
|
+
|
|
145
|
+
program.command('upgrade-store-app <app-name>')
|
|
146
|
+
.description('Interactively upgrade an application from a store onto a target Gingee server.')
|
|
147
|
+
.requiredOption('-g, --gStoreUrl <gstore-url>', 'Gingee app store URL')
|
|
148
|
+
.requiredOption('-s, --serverUrl <server-url>', 'Gingee server URL', 'http://localhost:7070')
|
|
149
|
+
.action(upgradeStoreApp);
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
//TODO: We will add more commands here later.
|
|
153
|
+
|
|
154
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "gingee-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The Gingee Command Line Interface (CLI), official command line tool for creating and managing Gingee projects.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/gingerhome/gingee-cli.git"
|
|
9
|
+
},
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/gingerhome/gingee-cli/issues"
|
|
12
|
+
},
|
|
13
|
+
"homepage": "https://github.com/gingerhome/gingee-cli#readme",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"command line",
|
|
16
|
+
"cli",
|
|
17
|
+
"gingee",
|
|
18
|
+
"genai",
|
|
19
|
+
"ai-authored",
|
|
20
|
+
"collaborative-ai",
|
|
21
|
+
"web server",
|
|
22
|
+
"app server",
|
|
23
|
+
"app platform",
|
|
24
|
+
"app framework",
|
|
25
|
+
"framework",
|
|
26
|
+
"backend",
|
|
27
|
+
"sandbox",
|
|
28
|
+
"multi-database",
|
|
29
|
+
"enterprise"
|
|
30
|
+
],
|
|
31
|
+
"author": "",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"archiver": "^7.0.1",
|
|
35
|
+
"argon2": "^0.44.0",
|
|
36
|
+
"axios": "^1.11.0",
|
|
37
|
+
"chalk": "^5.5.0",
|
|
38
|
+
"commander": "^14.0.0",
|
|
39
|
+
"form-data": "^4.0.4",
|
|
40
|
+
"fs-extra": "^11.3.1",
|
|
41
|
+
"gingee": "^1.0.0",
|
|
42
|
+
"inquirer": "^12.9.2",
|
|
43
|
+
"ora": "^8.2.0",
|
|
44
|
+
"yauzl": "^3.2.0"
|
|
45
|
+
},
|
|
46
|
+
"optionalDependencies": {
|
|
47
|
+
"node-linux": "^0.1.12",
|
|
48
|
+
"node-mac": "^1.0.1",
|
|
49
|
+
"node-windows": "^1.0.0-beta.8"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
apps: [{
|
|
3
|
+
// The name of your application, as it will appear in PM2.
|
|
4
|
+
name: 'gingee-server',
|
|
5
|
+
|
|
6
|
+
// The script that starts your application.
|
|
7
|
+
script: 'start.js',
|
|
8
|
+
cwd: __dirname,
|
|
9
|
+
|
|
10
|
+
// --- Advanced Options ---
|
|
11
|
+
// Reference: https://pm2.io/doc/en/runtime/reference/ecosystem-file/
|
|
12
|
+
|
|
13
|
+
// To enable cluster mode and run on all available CPU cores:
|
|
14
|
+
// instances: 'max',
|
|
15
|
+
// exec_mode: 'cluster',
|
|
16
|
+
|
|
17
|
+
// To watch for file changes and automatically restart (for development):
|
|
18
|
+
// watch: ["./web", "./modules"],
|
|
19
|
+
|
|
20
|
+
// Automatic restart on crash
|
|
21
|
+
autorestart: true,
|
|
22
|
+
|
|
23
|
+
// Resource limits to prevent memory leaks from crashing the server
|
|
24
|
+
max_memory_restart: '1G',
|
|
25
|
+
|
|
26
|
+
// Environment variables
|
|
27
|
+
env: {
|
|
28
|
+
NODE_ENV: 'development'
|
|
29
|
+
},
|
|
30
|
+
env_production: {
|
|
31
|
+
NODE_ENV: 'production'
|
|
32
|
+
}
|
|
33
|
+
}]
|
|
34
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"server": {
|
|
3
|
+
"https": {
|
|
4
|
+
"enabled": false,
|
|
5
|
+
"port": 443
|
|
6
|
+
},
|
|
7
|
+
"http": {
|
|
8
|
+
"enabled": true,
|
|
9
|
+
"port": 7070
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"content_encoding": {
|
|
13
|
+
"enabled": true
|
|
14
|
+
},
|
|
15
|
+
"box": {
|
|
16
|
+
"allowed_modules": []
|
|
17
|
+
},
|
|
18
|
+
"web_root": "./web",
|
|
19
|
+
"cache": {
|
|
20
|
+
"provider": "memory"
|
|
21
|
+
},
|
|
22
|
+
"default_app": "glade",
|
|
23
|
+
"privileged_apps": [
|
|
24
|
+
"glide",
|
|
25
|
+
"glade"
|
|
26
|
+
],
|
|
27
|
+
"logging": {
|
|
28
|
+
"level": "error",
|
|
29
|
+
"rotation": {
|
|
30
|
+
"period_days": 7,
|
|
31
|
+
"max_size_mb": 50
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-gingee-project",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start": "node start.js",
|
|
7
|
+
"dev": "nodemon start.js"
|
|
8
|
+
},
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"gingee": "^1.0.0"
|
|
11
|
+
},
|
|
12
|
+
"devDependencies": {
|
|
13
|
+
"nodemon": "^3.0.0"
|
|
14
|
+
}
|
|
15
|
+
}
|