@gv-sh/specgen-app 0.3.1 → 0.4.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  # SpecGen App - Complete Platform
2
2
 
3
- [![Version](https://img.shields.io/badge/version-0.3.1-blue.svg)](https://github.com/gv-sh/specgen-app)
3
+ [![Version](https://img.shields.io/badge/version-0.4.0-blue.svg)](https://github.com/gv-sh/specgen-app)
4
4
 
5
5
  A unified deployment package for the SpecGen speculative fiction generator platform.
6
6
 
@@ -12,6 +12,25 @@ A unified deployment package for the SpecGen speculative fiction generator platf
12
12
 
13
13
  ## Quick Start
14
14
 
15
+ ### Using NPX (Recommended)
16
+
17
+ ```bash
18
+ # Create and enter your project directory
19
+ mkdir specgen-project
20
+ cd specgen-project
21
+
22
+ # Run setup directly with npx
23
+ npx @gv-sh/specgen-app setup
24
+
25
+ # Start in development mode
26
+ npx @gv-sh/specgen-app dev
27
+
28
+ # Or start in production mode
29
+ npx @gv-sh/specgen-app production
30
+ ```
31
+
32
+ ### Using NPM Scripts
33
+
15
34
  1. **Setup**:
16
35
  ```bash
17
36
  npm run setup
@@ -38,7 +57,7 @@ A unified deployment package for the SpecGen speculative fiction generator platf
38
57
 
39
58
  ## Deployment Options
40
59
 
41
- ### Option 1: Quick NPM Deployment to Remote Server
60
+ ### Option 1: Quick NPX Deployment to Remote Server
42
61
 
43
62
  If you have SSH access to a server (like an EC2 instance), this is the fastest way to deploy:
44
63
 
@@ -60,9 +79,6 @@ If you have SSH access to a server (like an EC2 instance), this is the fastest w
60
79
 
61
80
  4. **Install and run SpecGen**:
62
81
  ```bash
63
- # Install globally
64
- sudo npm install -g @gv-sh/specgen-app
65
-
66
82
  # Create and enter project directory
67
83
  mkdir specgen
68
84
  cd specgen
@@ -83,10 +99,11 @@ If you have SSH access to a server (like an EC2 instance), this is the fastest w
83
99
  ```
84
100
 
85
101
  6. **Access your application**:
86
- - User Interface: http://your-server-ip:3000
87
- - Admin Interface: http://your-server-ip:3000/admin
102
+ - User Interface: http://your-server-ip:3002
103
+ - Admin Interface: http://your-server-ip:3001
104
+ - API: http://your-server-ip:3000
88
105
 
89
- ### Option 2: NPM Package Deployment (Detailed)
106
+ ### Option 2: Global NPM Package Deployment
90
107
 
91
108
  #### Local Machine Deployment
92
109
 
@@ -103,13 +120,13 @@ If you have SSH access to a server (like an EC2 instance), this is the fastest w
103
120
 
104
121
  3. **Initialize and setup**:
105
122
  ```bash
106
- npx @gv-sh/specgen-app setup
123
+ specgen-app setup
107
124
  ```
108
125
  During setup, you'll be prompted to enter your OpenAI API key.
109
126
 
110
127
  4. **Start the application**:
111
- - Development mode: `npx @gv-sh/specgen-app dev`
112
- - Production mode: `npx @gv-sh/specgen-app production`
128
+ - Development mode: `specgen-app dev`
129
+ - Production mode: `specgen-app production`
113
130
 
114
131
  #### Remote Server Deployment
115
132
 
@@ -130,19 +147,19 @@ If you have SSH access to a server (like an EC2 instance), this is the fastest w
130
147
  cd specgen
131
148
  ```
132
149
 
133
- 4. **Install SpecGen**:
150
+ 4. **Install SpecGen globally**:
134
151
  ```bash
135
- npm install @gv-sh/specgen-app
152
+ npm install -g @gv-sh/specgen-app
136
153
  ```
137
154
 
138
155
  5. **Setup the application**:
139
156
  ```bash
140
- npx @gv-sh/specgen-app setup
157
+ specgen-app setup
141
158
  ```
142
159
 
143
160
  6. **Start in production mode**:
144
161
  ```bash
145
- npx @gv-sh/specgen-app production
162
+ specgen-app production
146
163
  ```
147
164
 
148
165
  ### Option 3: Manual Deployment
@@ -172,13 +189,22 @@ sudo ./deploy.sh
172
189
 
173
190
  ## Management Commands
174
191
 
175
- When using NPM global installation:
192
+ When using NPX or global installation:
176
193
  ```bash
177
194
  # Check status
178
- npx @gv-sh/specgen-app status
195
+ npx @gv-sh/specgen-app deploy:status
196
+ # or when installed globally
197
+ specgen-app deploy:status
179
198
 
180
199
  # Stop services
181
- npx @gv-sh/specgen-app stop
200
+ npx @gv-sh/specgen-app deploy:stop
201
+ # or
202
+ specgen-app deploy:stop
203
+
204
+ # Restart services
205
+ npx @gv-sh/specgen-app deploy:restart
206
+ # or
207
+ specgen-app deploy:restart
182
208
 
183
209
  # Update to latest version
184
210
  npm update -g @gv-sh/specgen-app
@@ -202,14 +228,32 @@ npm run deploy:status
202
228
  npm run deploy:backup
203
229
  ```
204
230
 
231
+ ## Available Commands
232
+
233
+ The following commands are available when using `npx @gv-sh/specgen-app` or `specgen-app` (if installed globally):
234
+
235
+ - `setup` - Set up the SpecGen application
236
+ - `production` - Run the application in production mode
237
+ - `dev` - Run the application in development mode
238
+ - `deploy` - Deploy the application
239
+ - `deploy:stop` - Stop the deployed application
240
+ - `deploy:restart` - Restart the deployed application
241
+ - `deploy:update` - Update the deployed application
242
+ - `deploy:status` - Check the status of the deployed application
243
+ - `deploy:backup` - Create a backup of the deployed application
244
+ - `troubleshoot` - Run troubleshooting checks
245
+
205
246
  ## Troubleshooting
206
247
 
207
248
  If you encounter issues:
208
249
 
209
250
  ```bash
210
- # For global NPM installation
251
+ # Using npx
211
252
  npx @gv-sh/specgen-app troubleshoot
212
253
 
254
+ # Using global installation
255
+ specgen-app troubleshoot
256
+
213
257
  # For repository installation
214
258
  npm run troubleshoot
215
259
  ```
package/bin/cli.js ADDED
@@ -0,0 +1,81 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const path = require('path');
5
+ const fs = require('fs');
6
+
7
+ // Find the root directory of the package
8
+ const findPackageRoot = () => {
9
+ // When installed as a dependency, the package will be in node_modules/@gv-sh/specgen-app
10
+ // When running directly from the package, we're already at the root
11
+ const packageJsonPath = path.resolve(__dirname, '../package.json');
12
+
13
+ if (fs.existsSync(packageJsonPath)) {
14
+ return path.dirname(packageJsonPath);
15
+ }
16
+
17
+ throw new Error('Could not locate package root directory');
18
+ };
19
+
20
+ const runScript = (scriptName) => {
21
+ try {
22
+ const packageRoot = findPackageRoot();
23
+ process.chdir(packageRoot);
24
+
25
+ console.log(`📦 Running ${scriptName} script...`);
26
+ execSync(`npm run ${scriptName}`, { stdio: 'inherit' });
27
+
28
+ console.log(`✅ ${scriptName} completed successfully`);
29
+ } catch (error) {
30
+ console.error(`❌ Error during ${scriptName}:`, error.message);
31
+ process.exit(1);
32
+ }
33
+ };
34
+
35
+ const command = process.argv[2];
36
+
37
+ switch (command) {
38
+ case 'setup':
39
+ runScript('setup');
40
+ break;
41
+ case 'production':
42
+ runScript('production');
43
+ break;
44
+ case 'dev':
45
+ runScript('dev');
46
+ break;
47
+ case 'deploy':
48
+ runScript('deploy');
49
+ break;
50
+ case 'deploy:stop':
51
+ runScript('deploy:stop');
52
+ break;
53
+ case 'deploy:restart':
54
+ runScript('deploy:restart');
55
+ break;
56
+ case 'deploy:update':
57
+ runScript('deploy:update');
58
+ break;
59
+ case 'deploy:status':
60
+ runScript('deploy:status');
61
+ break;
62
+ case 'deploy:backup':
63
+ runScript('deploy:backup');
64
+ break;
65
+ case 'troubleshoot':
66
+ runScript('troubleshoot');
67
+ break;
68
+ default:
69
+ console.log('Usage: specgen-app <command>');
70
+ console.log('\nAvailable commands:');
71
+ console.log(' setup - Set up the SpecGen application');
72
+ console.log(' production - Run the application in production mode');
73
+ console.log(' dev - Run the application in development mode');
74
+ console.log(' deploy - Deploy the application');
75
+ console.log(' deploy:stop - Stop the deployed application');
76
+ console.log(' deploy:restart - Restart the deployed application');
77
+ console.log(' deploy:update - Update the deployed application');
78
+ console.log(' deploy:status - Check the status of the deployed application');
79
+ console.log(' deploy:backup - Create a backup of the deployed application');
80
+ console.log(' troubleshoot - Run troubleshooting checks');
81
+ }
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ // This file makes the package importable
2
+ // The main functionality is provided through the CLI
3
+
4
+ module.exports = {
5
+ version: require('./package.json').version,
6
+ description: 'SpecGen Application Package',
7
+
8
+ // Export script paths for programmatic access
9
+ scripts: {
10
+ setup: require.resolve('./scripts/setup.sh'),
11
+ dev: require.resolve('./scripts/dev.sh'),
12
+ production: require.resolve('./scripts/production.sh')
13
+ }
14
+ };
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "@gv-sh/specgen-app",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Complete SpecGen application with server, admin, and user interfaces",
5
5
  "main": "index.js",
6
+ "bin": {
7
+ "specgen-app": "./bin/cli.js"
8
+ },
6
9
  "scripts": {
7
10
  "setup": "chmod +x scripts/setup.sh && ./scripts/setup.sh",
8
11
  "dev": "chmod +x scripts/dev.sh && ./scripts/dev.sh",
@@ -16,7 +19,8 @@
16
19
  "deploy:update": "chmod +x scripts/update.sh && ./scripts/update.sh",
17
20
  "deploy:status": "chmod +x scripts/status.sh && ./scripts/status.sh",
18
21
  "deploy:backup": "chmod +x scripts/backup.sh && ./scripts/backup.sh",
19
- "troubleshoot": "chmod +x scripts/troubleshoot.sh && ./scripts/troubleshoot.sh"
22
+ "troubleshoot": "chmod +x scripts/troubleshoot.sh && ./scripts/troubleshoot.sh",
23
+ "postinstall": "chmod +x bin/cli.js"
20
24
  },
21
25
  "dependencies": {
22
26
  "@gv-sh/specgen-server": "0.9.0",
@@ -1,6 +1,12 @@
1
1
  #!/bin/bash
2
2
 
3
- # Make all scripts executable
4
- chmod +x scripts/*.sh
3
+ # SpecGen Package Deployment Script
4
+ echo "📦 Making files executable..."
5
5
 
6
- echo "✅ All scripts are now executable"
6
+ # Make all shell scripts executable
7
+ find scripts -name "*.sh" -exec chmod +x {} \;
8
+
9
+ # Make CLI executable
10
+ chmod +x bin/cli.js
11
+
12
+ echo "✅ All scripts are now executable"