@gxp-dev/tools 2.0.5
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/.github/workflows/npm-publish.yml +48 -0
- package/CLAUDE.md +400 -0
- package/README.md +247 -0
- package/REFACTOR_PLAN.md +194 -0
- package/bin/gx-devtools.js +87 -0
- package/bin/lib/cli.js +251 -0
- package/bin/lib/commands/assets.js +337 -0
- package/bin/lib/commands/build.js +259 -0
- package/bin/lib/commands/datastore.js +433 -0
- package/bin/lib/commands/dev.js +328 -0
- package/bin/lib/commands/extensions.js +298 -0
- package/bin/lib/commands/index.js +35 -0
- package/bin/lib/commands/init.js +307 -0
- package/bin/lib/commands/publish.js +189 -0
- package/bin/lib/commands/socket.js +158 -0
- package/bin/lib/commands/ssl.js +47 -0
- package/bin/lib/constants.js +120 -0
- package/bin/lib/tui/App.tsx +600 -0
- package/bin/lib/tui/components/CommandInput.tsx +278 -0
- package/bin/lib/tui/components/GeminiPanel.tsx +161 -0
- package/bin/lib/tui/components/Header.tsx +27 -0
- package/bin/lib/tui/components/LogPanel.tsx +122 -0
- package/bin/lib/tui/components/TabBar.tsx +56 -0
- package/bin/lib/tui/components/WelcomeScreen.tsx +80 -0
- package/bin/lib/tui/index.tsx +63 -0
- package/bin/lib/tui/services/ExtensionService.ts +122 -0
- package/bin/lib/tui/services/GeminiService.ts +395 -0
- package/bin/lib/tui/services/ServiceManager.ts +336 -0
- package/bin/lib/tui/services/SocketService.ts +204 -0
- package/bin/lib/tui/services/ViteService.ts +107 -0
- package/bin/lib/tui/services/index.ts +13 -0
- package/bin/lib/utils/files.js +180 -0
- package/bin/lib/utils/index.js +17 -0
- package/bin/lib/utils/paths.js +138 -0
- package/bin/lib/utils/prompts.js +71 -0
- package/bin/lib/utils/ssl.js +233 -0
- package/browser-extensions/README.md +1 -0
- package/browser-extensions/chrome/background.js +857 -0
- package/browser-extensions/chrome/content.js +51 -0
- package/browser-extensions/chrome/devtools.html +9 -0
- package/browser-extensions/chrome/devtools.js +23 -0
- package/browser-extensions/chrome/icons/gx_off_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_off_64.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_128.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_16.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_32.png +0 -0
- package/browser-extensions/chrome/icons/gx_on_64.png +0 -0
- package/browser-extensions/chrome/inspector.js +1087 -0
- package/browser-extensions/chrome/manifest.json +70 -0
- package/browser-extensions/chrome/panel.html +638 -0
- package/browser-extensions/chrome/panel.js +862 -0
- package/browser-extensions/chrome/popup.html +399 -0
- package/browser-extensions/chrome/popup.js +515 -0
- package/browser-extensions/chrome/rules.json +1 -0
- package/browser-extensions/chrome/test-chrome.html +145 -0
- package/browser-extensions/chrome/test-mixed-content.html +190 -0
- package/browser-extensions/chrome/test-uri-pattern.html +199 -0
- package/browser-extensions/firefox/README.md +134 -0
- package/browser-extensions/firefox/background.js +804 -0
- package/browser-extensions/firefox/content.js +120 -0
- package/browser-extensions/firefox/debug-errors.html +229 -0
- package/browser-extensions/firefox/debug-https.html +113 -0
- package/browser-extensions/firefox/devtools.html +9 -0
- package/browser-extensions/firefox/devtools.js +24 -0
- package/browser-extensions/firefox/icons/gx_off_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_off_64.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_128.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_16.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_32.png +0 -0
- package/browser-extensions/firefox/icons/gx_on_64.png +0 -0
- package/browser-extensions/firefox/inspector.js +1087 -0
- package/browser-extensions/firefox/manifest.json +67 -0
- package/browser-extensions/firefox/panel.html +638 -0
- package/browser-extensions/firefox/panel.js +862 -0
- package/browser-extensions/firefox/popup.html +525 -0
- package/browser-extensions/firefox/popup.js +536 -0
- package/browser-extensions/firefox/test-gramercy.html +126 -0
- package/browser-extensions/firefox/test-imports.html +58 -0
- package/browser-extensions/firefox/test-masking.html +147 -0
- package/browser-extensions/firefox/test-uri-pattern.html +199 -0
- package/docs/DOCUSAURUS_IMPORT.md +378 -0
- package/docs/_category_.json +8 -0
- package/docs/app-manifest.md +272 -0
- package/docs/building-for-platform.md +315 -0
- package/docs/dev-tools.md +291 -0
- package/docs/getting-started.md +180 -0
- package/docs/gxp-store.md +305 -0
- package/docs/index.md +44 -0
- package/package.json +77 -0
- package/runtime/PortalContainer.vue +326 -0
- package/runtime/dev-tools/DevToolsModal.vue +217 -0
- package/runtime/dev-tools/LayoutSwitcher.vue +221 -0
- package/runtime/dev-tools/MockDataEditor.vue +621 -0
- package/runtime/dev-tools/SocketSimulator.vue +562 -0
- package/runtime/dev-tools/StoreInspector.vue +644 -0
- package/runtime/dev-tools/index.js +6 -0
- package/runtime/gxpStringsPlugin.js +428 -0
- package/runtime/index.html +22 -0
- package/runtime/main.js +32 -0
- package/runtime/mock-api/auth-middleware.js +97 -0
- package/runtime/mock-api/image-generator.js +221 -0
- package/runtime/mock-api/index.js +197 -0
- package/runtime/mock-api/response-generator.js +394 -0
- package/runtime/mock-api/route-generator.js +323 -0
- package/runtime/mock-api/socket-triggers.js +371 -0
- package/runtime/mock-api/spec-loader.js +300 -0
- package/runtime/server.js +180 -0
- package/runtime/stores/gxpPortalConfigStore.js +554 -0
- package/runtime/stores/index.js +6 -0
- package/runtime/vite-inspector-plugin.js +749 -0
- package/runtime/vite-source-tracker-plugin.js +232 -0
- package/runtime/vite.config.js +402 -0
- package/scripts/launch-chrome.js +90 -0
- package/scripts/pack-chrome.js +91 -0
- package/socket-events/AiSessionMessageCreated.json +18 -0
- package/socket-events/SocialStreamPostCreated.json +24 -0
- package/socket-events/SocialStreamPostVariantCompleted.json +23 -0
- package/template/README.md +332 -0
- package/template/app-manifest.json +32 -0
- package/template/dev-assets/images/avatar-placeholder.png +0 -0
- package/template/dev-assets/images/background-placeholder.jpg +0 -0
- package/template/dev-assets/images/banner-placeholder.jpg +0 -0
- package/template/dev-assets/images/icon-placeholder.png +0 -0
- package/template/dev-assets/images/logo-placeholder.png +0 -0
- package/template/dev-assets/images/product-placeholder.jpg +0 -0
- package/template/dev-assets/images/thumbnail-placeholder.jpg +0 -0
- package/template/env.example +51 -0
- package/template/gitignore +53 -0
- package/template/index.html +22 -0
- package/template/main.js +28 -0
- package/template/src/DemoPage.vue +459 -0
- package/template/src/Plugin.vue +38 -0
- package/template/src/stores/index.js +9 -0
- package/template/src/stores/test-data.json +173 -0
- package/template/theme-layouts/AdditionalStyling.css +0 -0
- package/template/theme-layouts/PrivateLayout.vue +39 -0
- package/template/theme-layouts/PublicLayout.vue +39 -0
- package/template/theme-layouts/SystemLayout.vue +39 -0
- package/template/vite.config.js +333 -0
- package/tsconfig.tui.json +21 -0
- package/vite.config.js +164 -0
package/REFACTOR_PLAN.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# GxP Toolkit Refactoring Plan
|
|
2
|
+
|
|
3
|
+
## Status: COMPLETED
|
|
4
|
+
|
|
5
|
+
All major refactoring phases have been completed. This document is kept for reference.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Phase 1: CLI Refactoring ✅ COMPLETED
|
|
10
|
+
|
|
11
|
+
### Goal
|
|
12
|
+
Break `bin/gx-devtools.js` (2407 lines) into focused modules while maintaining backward compatibility.
|
|
13
|
+
|
|
14
|
+
### Final Structure
|
|
15
|
+
```
|
|
16
|
+
bin/
|
|
17
|
+
├── gx-devtools.js # Entry point (~25 lines) - delegates to lib/cli.js
|
|
18
|
+
└── lib/
|
|
19
|
+
├── cli.js # Yargs command definitions
|
|
20
|
+
├── constants.js # Dependencies, scripts, ports
|
|
21
|
+
├── commands/
|
|
22
|
+
│ ├── init.js # gxdev init
|
|
23
|
+
│ ├── dev.js # gxdev dev
|
|
24
|
+
│ ├── build.js # gxdev build
|
|
25
|
+
│ ├── publish.js # gxdev publish
|
|
26
|
+
│ ├── ssl.js # gxdev setup-ssl
|
|
27
|
+
│ ├── datastore.js # gxdev datastore <action>
|
|
28
|
+
│ ├── socket.js # gxdev socket <action>
|
|
29
|
+
│ ├── assets.js # gxdev assets <action>
|
|
30
|
+
│ ├── extensions.js # gxdev ext:*
|
|
31
|
+
│ └── index.js # Re-exports all commands
|
|
32
|
+
└── utils/
|
|
33
|
+
├── paths.js # Path resolution (findProjectRoot, resolveGxPaths, etc.)
|
|
34
|
+
├── ssl.js # SSL certificate management
|
|
35
|
+
├── files.js # File operations (safeCopyFile, etc.)
|
|
36
|
+
├── prompts.js # User prompts (promptUser)
|
|
37
|
+
└── index.js # Re-exports all utilities
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Completed Tasks
|
|
41
|
+
- [x] Create `bin/lib/` directory structure
|
|
42
|
+
- [x] Extract path resolution utilities to `utils/paths.js`
|
|
43
|
+
- [x] Extract SSL management to `utils/ssl.js`
|
|
44
|
+
- [x] Extract file utilities to `utils/files.js`
|
|
45
|
+
- [x] Extract prompts to `utils/prompts.js`
|
|
46
|
+
- [x] Extract dependency constants to `constants.js`
|
|
47
|
+
- [x] Create individual command modules
|
|
48
|
+
- [x] Update main entry point to use modular CLI
|
|
49
|
+
- [x] Test all commands work identically
|
|
50
|
+
- [x] Renamed CLI command from `gxto` to `gxdev`
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Phase 2: Folder Structure Cleanup ✅ COMPLETED
|
|
55
|
+
|
|
56
|
+
### Goal
|
|
57
|
+
Clean up the template system and establish clear boundaries.
|
|
58
|
+
|
|
59
|
+
### Final Structure
|
|
60
|
+
```
|
|
61
|
+
gx-devtools/
|
|
62
|
+
├── bin/ # CLI (refactored)
|
|
63
|
+
│ └── lib/ # Modular CLI components
|
|
64
|
+
├── template/ # Files copied to new projects during init
|
|
65
|
+
│ ├── src/
|
|
66
|
+
│ │ ├── Plugin.vue # User's entry point (editable)
|
|
67
|
+
│ │ ├── DemoPage.vue # Example component (editable)
|
|
68
|
+
│ │ └── stores/ # Store templates
|
|
69
|
+
│ ├── theme-layouts/ # Layout templates (editable)
|
|
70
|
+
│ ├── dev-assets/ # Placeholder images
|
|
71
|
+
│ ├── main.js # Dev entry point (imports from @gx-runtime)
|
|
72
|
+
│ ├── index.html
|
|
73
|
+
│ ├── vite.config.js # Project vite config with aliases
|
|
74
|
+
│ ├── app-manifest.json
|
|
75
|
+
│ ├── env.example
|
|
76
|
+
│ ├── gitignore
|
|
77
|
+
│ └── README.md
|
|
78
|
+
├── runtime/ # Files used from node_modules (NOT copied)
|
|
79
|
+
│ ├── PortalContainer.vue # Platform emulator (immutable)
|
|
80
|
+
│ ├── server.js # Socket.IO server
|
|
81
|
+
│ ├── dev-tools/ # In-browser dev tools
|
|
82
|
+
│ │ ├── DevToolsModal.vue
|
|
83
|
+
│ │ ├── StoreInspector.vue
|
|
84
|
+
│ │ ├── LayoutSwitcher.vue
|
|
85
|
+
│ │ ├── SocketSimulator.vue
|
|
86
|
+
│ │ └── MockDataEditor.vue
|
|
87
|
+
│ └── stores/
|
|
88
|
+
│ └── gxpPortalConfigStore.js
|
|
89
|
+
├── socket-events/ # Event templates (single source of truth)
|
|
90
|
+
├── browser-extensions/ # Chrome/Firefox extensions
|
|
91
|
+
└── scripts/ # Build/launch scripts
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Completed Tasks
|
|
95
|
+
- [x] Create `/runtime/` directory
|
|
96
|
+
- [x] Move PortalContainer.vue to /runtime/
|
|
97
|
+
- [x] Move server.js to /runtime/
|
|
98
|
+
- [x] Move gxpPortalConfigStore.js to /runtime/stores/
|
|
99
|
+
- [x] Consolidate socket-events to single location
|
|
100
|
+
- [x] Update CLI path resolution
|
|
101
|
+
- [x] Update template/main.js to import from @gx-runtime
|
|
102
|
+
- [x] Update template/vite.config.js with aliases (@, @layouts, @gx-runtime)
|
|
103
|
+
- [x] Test `gxdev init` creates correct project structure
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Phase 3: PortalContainer Immutability ✅ COMPLETED
|
|
108
|
+
|
|
109
|
+
### Goal
|
|
110
|
+
Make PortalContainer.vue truly hidden from client projects while still functional for development.
|
|
111
|
+
|
|
112
|
+
### Implementation
|
|
113
|
+
- PortalContainer.vue is in `/runtime/` (NOT copied during init)
|
|
114
|
+
- Client's main.js imports via Vite alias: `import App from "@gx-runtime/PortalContainer.vue"`
|
|
115
|
+
- Vite config defines `@gx-runtime` alias pointing to toolkit's runtime directory
|
|
116
|
+
|
|
117
|
+
### Completed Tasks
|
|
118
|
+
- [x] Move PortalContainer.vue to /runtime/
|
|
119
|
+
- [x] Update template/main.js import path
|
|
120
|
+
- [x] Update template/vite.config.js with @gx-runtime alias
|
|
121
|
+
- [x] Test development server loads PortalContainer from node_modules
|
|
122
|
+
- [x] Document this architecture in CLAUDE.md
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Phase 4: Dev Tools Configuration Modal ✅ COMPLETED
|
|
127
|
+
|
|
128
|
+
### Goal
|
|
129
|
+
Create an in-browser development tools modal.
|
|
130
|
+
|
|
131
|
+
### Features Implemented
|
|
132
|
+
1. **Store Inspector** - View/edit pluginVars, stringsList, assetList, triggerState, dependencyList
|
|
133
|
+
2. **Layout Switcher** - Toggle between System/Private/Public layouts
|
|
134
|
+
3. **Socket Simulator** - Send test socket events with JSON editor
|
|
135
|
+
4. **Mock Data Editor** - Edit theme colors, navigation items, user session, permissions
|
|
136
|
+
|
|
137
|
+
### Triggers
|
|
138
|
+
- **Keyboard shortcut:** `Ctrl+Shift+D` (or `Cmd+Shift+D` on Mac)
|
|
139
|
+
- **Floating button:** Gear icon in bottom-right corner
|
|
140
|
+
- **Console API:** `window.gxDevTools.open()` / `.close()` / `.toggle()`
|
|
141
|
+
|
|
142
|
+
### Files Created
|
|
143
|
+
```
|
|
144
|
+
runtime/dev-tools/
|
|
145
|
+
├── DevToolsModal.vue # Main modal with tabs
|
|
146
|
+
├── StoreInspector.vue # Store state viewer/editor
|
|
147
|
+
├── LayoutSwitcher.vue # Layout toggle
|
|
148
|
+
├── SocketSimulator.vue # Socket event sender
|
|
149
|
+
├── MockDataEditor.vue # Theme/nav/permissions editor
|
|
150
|
+
└── index.js # Exports
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Completed Tasks
|
|
154
|
+
- [x] Create DevToolsModal.vue with tabbed interface
|
|
155
|
+
- [x] Implement StoreInspector with collapsible sections
|
|
156
|
+
- [x] Implement LayoutSwitcher
|
|
157
|
+
- [x] Implement SocketSimulator with event log
|
|
158
|
+
- [x] Implement MockDataEditor
|
|
159
|
+
- [x] Add keyboard shortcut handling
|
|
160
|
+
- [x] Add console command API
|
|
161
|
+
- [x] Add floating trigger button
|
|
162
|
+
- [x] Integrate into PortalContainer.vue
|
|
163
|
+
- [x] Document in CLAUDE.md
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## Phase 5: Cleanup & Polish ✅ COMPLETED
|
|
168
|
+
|
|
169
|
+
### Completed Tasks
|
|
170
|
+
- [x] Update CLAUDE.md with new structure and dev tools docs
|
|
171
|
+
- [x] Update template/README.md with gxdev commands
|
|
172
|
+
- [x] Rename CLI from `gxto` to `gxdev`
|
|
173
|
+
- [x] Update all code references and documentation
|
|
174
|
+
- [x] Add .gitignore template file
|
|
175
|
+
- [x] Fix init command paths for new folder structure
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Summary of Changes
|
|
180
|
+
|
|
181
|
+
### CLI Command Rename
|
|
182
|
+
- Old: `gxto`
|
|
183
|
+
- New: `gxdev`
|
|
184
|
+
|
|
185
|
+
### Key Architecture Changes
|
|
186
|
+
1. **Monolithic CLI** → **Modular structure** in `bin/lib/`
|
|
187
|
+
2. **Mixed config/** → **Separate template/ and runtime/ directories**
|
|
188
|
+
3. **Exposed PortalContainer** → **Hidden in runtime/, accessed via @gx-runtime alias**
|
|
189
|
+
4. **No dev tools** → **Full dev tools modal with 4 panels**
|
|
190
|
+
|
|
191
|
+
### Vite Aliases (in projects)
|
|
192
|
+
- `@` → Project's `src/` directory
|
|
193
|
+
- `@layouts` → Project's `theme-layouts/` directory
|
|
194
|
+
- `@gx-runtime` → Toolkit's `runtime/` directory (from node_modules)
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GxToolkit CLI
|
|
5
|
+
*
|
|
6
|
+
* This tool works both as a globally installed npm package and as a local dependency.
|
|
7
|
+
* It provides commands for creating new GxP projects and managing development workflows.
|
|
8
|
+
*
|
|
9
|
+
* Commands:
|
|
10
|
+
* (no command) - Launch interactive TUI (Terminal UI)
|
|
11
|
+
* init [name] - Initialize a new GxP project or update existing one
|
|
12
|
+
* setup-ssl - Setup SSL certificates for HTTPS development
|
|
13
|
+
* dev - Start development server (launches TUI with auto-start)
|
|
14
|
+
* build - Build plugin for production
|
|
15
|
+
* publish [file] - Publish package files to local project
|
|
16
|
+
* datastore - Manage GxP datastore
|
|
17
|
+
* socket - Simulate socket events (launches TUI with auto-start)
|
|
18
|
+
* assets - Manage development assets and placeholders
|
|
19
|
+
* ext:firefox - Launch Firefox with browser extension (launches TUI)
|
|
20
|
+
* ext:chrome - Launch Chrome with browser extension (launches TUI)
|
|
21
|
+
* ext:build - Build browser extensions for distribution
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
// Commands that should use the traditional CLI (one-shot commands)
|
|
25
|
+
const ONE_SHOT_COMMANDS = ['init', 'build', 'publish', 'setup-ssl', 'ext:build', '--help', '-h', '--version'];
|
|
26
|
+
|
|
27
|
+
// Commands that should launch TUI with auto-start
|
|
28
|
+
const TUI_AUTO_START_COMMANDS = ['dev', 'socket', 'ext:firefox', 'ext:chrome', 'datastore', 'assets'];
|
|
29
|
+
|
|
30
|
+
const args = process.argv.slice(2);
|
|
31
|
+
const command = args[0];
|
|
32
|
+
|
|
33
|
+
// Check if this is a one-shot command
|
|
34
|
+
const isOneShot = ONE_SHOT_COMMANDS.includes(command) ||
|
|
35
|
+
(command && command.startsWith('-'));
|
|
36
|
+
|
|
37
|
+
// Check if we should use TUI with auto-start
|
|
38
|
+
const isTuiCommand = TUI_AUTO_START_COMMANDS.includes(command);
|
|
39
|
+
|
|
40
|
+
// If no command or TUI command, try to launch TUI
|
|
41
|
+
// Fall back to traditional CLI if TUI dependencies are not available
|
|
42
|
+
if (!isOneShot) {
|
|
43
|
+
const fs = require('fs');
|
|
44
|
+
const path = require('path');
|
|
45
|
+
// TUI output is in project root's dist/tui, not bin/dist/tui
|
|
46
|
+
const tuiPath = path.join(__dirname, '..', 'dist', 'tui', 'index.js');
|
|
47
|
+
|
|
48
|
+
if (fs.existsSync(tuiPath)) {
|
|
49
|
+
// Use dynamic import() for ESM modules (ink v5 is ESM-only)
|
|
50
|
+
(async () => {
|
|
51
|
+
try {
|
|
52
|
+
const { startTUI } = await import(tuiPath);
|
|
53
|
+
|
|
54
|
+
// Determine auto-start commands
|
|
55
|
+
const autoStart = [];
|
|
56
|
+
const tuiArgs = {};
|
|
57
|
+
|
|
58
|
+
if (command === 'dev') {
|
|
59
|
+
autoStart.push('dev');
|
|
60
|
+
if (args.includes('--with-socket') || args.includes('-s')) {
|
|
61
|
+
autoStart.push('socket');
|
|
62
|
+
}
|
|
63
|
+
tuiArgs.noHttps = args.includes('--no-https');
|
|
64
|
+
} else if (command === 'socket') {
|
|
65
|
+
autoStart.push('socket');
|
|
66
|
+
} else if (command === 'ext:firefox') {
|
|
67
|
+
autoStart.push('ext firefox');
|
|
68
|
+
} else if (command === 'ext:chrome') {
|
|
69
|
+
autoStart.push('ext chrome');
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
startTUI({ autoStart, args: tuiArgs });
|
|
73
|
+
} catch (err) {
|
|
74
|
+
// TUI dependencies not available, fall back to traditional CLI
|
|
75
|
+
console.error('TUI error:', err.message);
|
|
76
|
+
require("./lib/cli");
|
|
77
|
+
}
|
|
78
|
+
})();
|
|
79
|
+
} else {
|
|
80
|
+
// TUI not compiled yet, use traditional CLI
|
|
81
|
+
console.log('Note: TUI not yet available. Run "npm run build:tui" to enable interactive mode.');
|
|
82
|
+
require("./lib/cli");
|
|
83
|
+
}
|
|
84
|
+
} else {
|
|
85
|
+
// One-shot command, use traditional CLI
|
|
86
|
+
require("./lib/cli");
|
|
87
|
+
}
|
package/bin/lib/cli.js
ADDED
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GxToolkit CLI Entry Point
|
|
5
|
+
*
|
|
6
|
+
* This is the main entry point for the gxdev CLI tool.
|
|
7
|
+
* It sets up yargs commands and delegates to the appropriate command modules.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const yargs = require("yargs");
|
|
11
|
+
const { loadGlobalConfig } = require("./utils");
|
|
12
|
+
const {
|
|
13
|
+
initCommand,
|
|
14
|
+
devCommand,
|
|
15
|
+
buildCommand,
|
|
16
|
+
publishCommand,
|
|
17
|
+
setupSSLCommand,
|
|
18
|
+
datastoreCommand,
|
|
19
|
+
socketCommand,
|
|
20
|
+
assetsCommand,
|
|
21
|
+
extensionFirefoxCommand,
|
|
22
|
+
extensionChromeCommand,
|
|
23
|
+
extensionBuildCommand,
|
|
24
|
+
extensionInstallCommand,
|
|
25
|
+
} = require("./commands");
|
|
26
|
+
|
|
27
|
+
// Load global configuration
|
|
28
|
+
const globalConfig = loadGlobalConfig();
|
|
29
|
+
|
|
30
|
+
// Set up yargs CLI
|
|
31
|
+
yargs
|
|
32
|
+
.usage("$0 <command>")
|
|
33
|
+
.config(globalConfig)
|
|
34
|
+
.command(
|
|
35
|
+
"init [name]",
|
|
36
|
+
"Initialize a new GxP project or update existing one",
|
|
37
|
+
{
|
|
38
|
+
name: {
|
|
39
|
+
describe: "Project name (for new projects)",
|
|
40
|
+
type: "string",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
initCommand
|
|
44
|
+
)
|
|
45
|
+
.command(
|
|
46
|
+
"setup-ssl",
|
|
47
|
+
"Setup SSL certificates for HTTPS development",
|
|
48
|
+
{},
|
|
49
|
+
setupSSLCommand
|
|
50
|
+
)
|
|
51
|
+
.command(
|
|
52
|
+
"dev",
|
|
53
|
+
"Start development server",
|
|
54
|
+
{
|
|
55
|
+
port: {
|
|
56
|
+
describe: "Development server port",
|
|
57
|
+
type: "number",
|
|
58
|
+
},
|
|
59
|
+
"node-log-level": {
|
|
60
|
+
describe: "Node log level",
|
|
61
|
+
type: "string",
|
|
62
|
+
default: "info",
|
|
63
|
+
},
|
|
64
|
+
"component-path": {
|
|
65
|
+
describe: "Path to main component",
|
|
66
|
+
type: "string",
|
|
67
|
+
default: "./src/Plugin.vue",
|
|
68
|
+
},
|
|
69
|
+
"no-https": {
|
|
70
|
+
describe: "Disable HTTPS and use HTTP instead",
|
|
71
|
+
type: "boolean",
|
|
72
|
+
default: false,
|
|
73
|
+
},
|
|
74
|
+
"with-socket": {
|
|
75
|
+
describe: "Also start Socket.IO server with nodemon",
|
|
76
|
+
type: "boolean",
|
|
77
|
+
default: false,
|
|
78
|
+
alias: "s",
|
|
79
|
+
},
|
|
80
|
+
firefox: {
|
|
81
|
+
describe: "Launch Firefox with browser extension",
|
|
82
|
+
type: "boolean",
|
|
83
|
+
default: false,
|
|
84
|
+
},
|
|
85
|
+
chrome: {
|
|
86
|
+
describe: "Launch Chrome with browser extension",
|
|
87
|
+
type: "boolean",
|
|
88
|
+
default: false,
|
|
89
|
+
},
|
|
90
|
+
"with-mock": {
|
|
91
|
+
describe: "Enable Mock API server (requires --with-socket)",
|
|
92
|
+
type: "boolean",
|
|
93
|
+
default: false,
|
|
94
|
+
alias: "m",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
devCommand
|
|
98
|
+
)
|
|
99
|
+
.command(
|
|
100
|
+
"build",
|
|
101
|
+
"Build plugin for production",
|
|
102
|
+
{
|
|
103
|
+
"node-log-level": {
|
|
104
|
+
describe: "Node log level",
|
|
105
|
+
type: "string",
|
|
106
|
+
default: "error",
|
|
107
|
+
},
|
|
108
|
+
"component-path": {
|
|
109
|
+
describe: "Path to main component",
|
|
110
|
+
type: "string",
|
|
111
|
+
default: "./src/Plugin.vue",
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
buildCommand
|
|
115
|
+
)
|
|
116
|
+
.command(
|
|
117
|
+
"publish [file]",
|
|
118
|
+
"Publish package files to local project",
|
|
119
|
+
{
|
|
120
|
+
file: {
|
|
121
|
+
describe: "File to publish (server.js, gxpPortalConfigStore.js)",
|
|
122
|
+
type: "string",
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
publishCommand
|
|
126
|
+
)
|
|
127
|
+
.command(
|
|
128
|
+
"datastore <action>",
|
|
129
|
+
"Manage GxP datastore",
|
|
130
|
+
{
|
|
131
|
+
action: {
|
|
132
|
+
describe: "Action to perform",
|
|
133
|
+
choices: ["list", "add", "scan-strings", "config", "init"],
|
|
134
|
+
},
|
|
135
|
+
type: {
|
|
136
|
+
describe: "Variable type (for add command)",
|
|
137
|
+
choices: ["string", "setting", "asset"],
|
|
138
|
+
},
|
|
139
|
+
key: {
|
|
140
|
+
describe: "Variable key/name (for add command)",
|
|
141
|
+
type: "string",
|
|
142
|
+
},
|
|
143
|
+
value: {
|
|
144
|
+
describe: "Variable value (for add command)",
|
|
145
|
+
type: "string",
|
|
146
|
+
},
|
|
147
|
+
component: {
|
|
148
|
+
describe: "Component path (for scan-strings command)",
|
|
149
|
+
type: "string",
|
|
150
|
+
},
|
|
151
|
+
config: {
|
|
152
|
+
describe: "Configuration name (for config command)",
|
|
153
|
+
type: "string",
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
datastoreCommand
|
|
157
|
+
)
|
|
158
|
+
.command(
|
|
159
|
+
"ext:firefox",
|
|
160
|
+
"Launch Firefox with browser extension",
|
|
161
|
+
{},
|
|
162
|
+
extensionFirefoxCommand
|
|
163
|
+
)
|
|
164
|
+
.command(
|
|
165
|
+
"ext:chrome",
|
|
166
|
+
"Launch Chrome with browser extension",
|
|
167
|
+
{},
|
|
168
|
+
extensionChromeCommand
|
|
169
|
+
)
|
|
170
|
+
.command(
|
|
171
|
+
"ext:build",
|
|
172
|
+
"Build browser extensions for distribution",
|
|
173
|
+
{},
|
|
174
|
+
extensionBuildCommand
|
|
175
|
+
)
|
|
176
|
+
.command(
|
|
177
|
+
"ext:install <browser>",
|
|
178
|
+
"Install extension permanently in local browser",
|
|
179
|
+
{
|
|
180
|
+
browser: {
|
|
181
|
+
describe: "Browser to install extension in",
|
|
182
|
+
choices: ["chrome", "firefox"],
|
|
183
|
+
type: "string",
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
extensionInstallCommand
|
|
187
|
+
)
|
|
188
|
+
.command(
|
|
189
|
+
"socket <action>",
|
|
190
|
+
"Simulate socket events",
|
|
191
|
+
{
|
|
192
|
+
action: {
|
|
193
|
+
describe: "Action to perform",
|
|
194
|
+
choices: ["list", "send"],
|
|
195
|
+
},
|
|
196
|
+
event: {
|
|
197
|
+
describe: "Event name to send (for send action)",
|
|
198
|
+
type: "string",
|
|
199
|
+
},
|
|
200
|
+
identifier: {
|
|
201
|
+
describe: "Override identifier/channel (for send action)",
|
|
202
|
+
type: "string",
|
|
203
|
+
},
|
|
204
|
+
},
|
|
205
|
+
socketCommand
|
|
206
|
+
)
|
|
207
|
+
.command(
|
|
208
|
+
"assets <action>",
|
|
209
|
+
"Manage development assets and placeholders",
|
|
210
|
+
{
|
|
211
|
+
action: {
|
|
212
|
+
describe: "Action to perform",
|
|
213
|
+
choices: ["list", "generate", "init"],
|
|
214
|
+
},
|
|
215
|
+
size: {
|
|
216
|
+
describe: "Image size (for generate action)",
|
|
217
|
+
type: "string",
|
|
218
|
+
default: "400x300",
|
|
219
|
+
},
|
|
220
|
+
name: {
|
|
221
|
+
describe: "Asset name (for generate action)",
|
|
222
|
+
type: "string",
|
|
223
|
+
default: "placeholder",
|
|
224
|
+
},
|
|
225
|
+
color: {
|
|
226
|
+
describe: "Background color (for generate action)",
|
|
227
|
+
type: "string",
|
|
228
|
+
},
|
|
229
|
+
text: {
|
|
230
|
+
describe: "Text to display (for generate action)",
|
|
231
|
+
type: "string",
|
|
232
|
+
},
|
|
233
|
+
format: {
|
|
234
|
+
describe: "Image format (for generate action)",
|
|
235
|
+
type: "string",
|
|
236
|
+
choices: ["png", "jpg", "jpeg", "gif"],
|
|
237
|
+
default: "png",
|
|
238
|
+
},
|
|
239
|
+
count: {
|
|
240
|
+
describe:
|
|
241
|
+
"Number of assets to generate with different colors/styles (for generate action)",
|
|
242
|
+
type: "number",
|
|
243
|
+
default: 1,
|
|
244
|
+
},
|
|
245
|
+
},
|
|
246
|
+
assetsCommand
|
|
247
|
+
)
|
|
248
|
+
.demandCommand(1, "Please provide a valid command")
|
|
249
|
+
.help("h")
|
|
250
|
+
.alias("h", "help")
|
|
251
|
+
.parse();
|