@gxp-dev/tools 2.0.62 → 2.0.64
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 +32 -31
- package/bin/gx-devtools.js +74 -54
- package/bin/lib/cli.js +23 -21
- package/bin/lib/commands/add-dependency.js +366 -325
- package/bin/lib/commands/assets.js +137 -139
- package/bin/lib/commands/build.js +169 -174
- package/bin/lib/commands/datastore.js +181 -183
- package/bin/lib/commands/dev.js +127 -131
- package/bin/lib/commands/extensions.js +147 -149
- package/bin/lib/commands/extract-config.js +73 -67
- package/bin/lib/commands/index.js +12 -12
- package/bin/lib/commands/init.js +342 -240
- package/bin/lib/commands/publish.js +69 -75
- package/bin/lib/commands/socket.js +69 -69
- package/bin/lib/commands/ssl.js +14 -14
- package/bin/lib/constants.js +10 -24
- package/bin/lib/tui/App.tsx +761 -705
- package/bin/lib/tui/components/AIPanel.tsx +191 -171
- package/bin/lib/tui/components/CommandInput.tsx +394 -343
- package/bin/lib/tui/components/GeminiPanel.tsx +175 -151
- package/bin/lib/tui/components/Header.tsx +23 -21
- package/bin/lib/tui/components/LogPanel.tsx +244 -220
- package/bin/lib/tui/components/TabBar.tsx +50 -48
- package/bin/lib/tui/components/WelcomeScreen.tsx +126 -71
- package/bin/lib/tui/index.tsx +37 -39
- package/bin/lib/tui/services/AIService.ts +518 -462
- package/bin/lib/tui/services/ExtensionService.ts +140 -129
- package/bin/lib/tui/services/GeminiService.ts +367 -337
- package/bin/lib/tui/services/ServiceManager.ts +344 -322
- package/bin/lib/tui/services/SocketService.ts +168 -168
- package/bin/lib/tui/services/ViteService.ts +88 -88
- package/bin/lib/tui/services/index.ts +47 -22
- package/bin/lib/utils/ai-scaffold.js +291 -280
- package/bin/lib/utils/extract-config.js +157 -140
- package/bin/lib/utils/files.js +82 -86
- package/bin/lib/utils/index.js +7 -7
- package/bin/lib/utils/paths.js +34 -34
- package/bin/lib/utils/prompts.js +194 -169
- package/bin/lib/utils/ssl.js +79 -81
- package/browser-extensions/README.md +0 -1
- package/browser-extensions/chrome/background.js +244 -237
- package/browser-extensions/chrome/content.js +32 -29
- package/browser-extensions/chrome/devtools.html +7 -7
- package/browser-extensions/chrome/devtools.js +19 -19
- package/browser-extensions/chrome/inspector.js +802 -767
- package/browser-extensions/chrome/manifest.json +71 -63
- package/browser-extensions/chrome/panel.html +674 -636
- package/browser-extensions/chrome/panel.js +722 -712
- package/browser-extensions/chrome/popup.html +586 -543
- package/browser-extensions/chrome/popup.js +282 -244
- package/browser-extensions/chrome/rules.json +1 -1
- package/browser-extensions/chrome/test-chrome.html +216 -136
- package/browser-extensions/chrome/test-mixed-content.html +284 -189
- package/browser-extensions/chrome/test-uri-pattern.html +221 -198
- package/browser-extensions/firefox/README.md +9 -6
- package/browser-extensions/firefox/background.js +221 -218
- package/browser-extensions/firefox/content.js +55 -52
- package/browser-extensions/firefox/debug-errors.html +386 -228
- package/browser-extensions/firefox/debug-https.html +153 -105
- package/browser-extensions/firefox/devtools.html +7 -7
- package/browser-extensions/firefox/devtools.js +23 -20
- package/browser-extensions/firefox/inspector.js +802 -767
- package/browser-extensions/firefox/manifest.json +68 -68
- package/browser-extensions/firefox/panel.html +674 -636
- package/browser-extensions/firefox/panel.js +722 -712
- package/browser-extensions/firefox/popup.html +572 -535
- package/browser-extensions/firefox/popup.js +281 -236
- package/browser-extensions/firefox/test-gramercy.html +170 -125
- package/browser-extensions/firefox/test-imports.html +59 -55
- package/browser-extensions/firefox/test-masking.html +231 -140
- package/browser-extensions/firefox/test-uri-pattern.html +221 -198
- package/dist/tui/App.d.ts +1 -1
- package/dist/tui/App.d.ts.map +1 -1
- package/dist/tui/App.js +154 -150
- package/dist/tui/App.js.map +1 -1
- package/dist/tui/components/AIPanel.d.ts.map +1 -1
- package/dist/tui/components/AIPanel.js +42 -35
- package/dist/tui/components/AIPanel.js.map +1 -1
- package/dist/tui/components/CommandInput.d.ts +1 -1
- package/dist/tui/components/CommandInput.d.ts.map +1 -1
- package/dist/tui/components/CommandInput.js +92 -62
- package/dist/tui/components/CommandInput.js.map +1 -1
- package/dist/tui/components/GeminiPanel.d.ts.map +1 -1
- package/dist/tui/components/GeminiPanel.js +37 -30
- package/dist/tui/components/GeminiPanel.js.map +1 -1
- package/dist/tui/components/Header.d.ts.map +1 -1
- package/dist/tui/components/Header.js +1 -1
- package/dist/tui/components/Header.js.map +1 -1
- package/dist/tui/components/LogPanel.d.ts +1 -1
- package/dist/tui/components/LogPanel.d.ts.map +1 -1
- package/dist/tui/components/LogPanel.js +26 -24
- package/dist/tui/components/LogPanel.js.map +1 -1
- package/dist/tui/components/TabBar.d.ts +2 -2
- package/dist/tui/components/TabBar.d.ts.map +1 -1
- package/dist/tui/components/TabBar.js +11 -11
- package/dist/tui/components/TabBar.js.map +1 -1
- package/dist/tui/components/WelcomeScreen.d.ts.map +1 -1
- package/dist/tui/components/WelcomeScreen.js +6 -6
- package/dist/tui/components/WelcomeScreen.js.map +1 -1
- package/dist/tui/index.d.ts.map +1 -1
- package/dist/tui/index.js +8 -8
- package/dist/tui/index.js.map +1 -1
- package/dist/tui/services/AIService.d.ts +2 -2
- package/dist/tui/services/AIService.d.ts.map +1 -1
- package/dist/tui/services/AIService.js +165 -125
- package/dist/tui/services/AIService.js.map +1 -1
- package/dist/tui/services/ExtensionService.d.ts +1 -1
- package/dist/tui/services/ExtensionService.d.ts.map +1 -1
- package/dist/tui/services/ExtensionService.js +33 -26
- package/dist/tui/services/ExtensionService.js.map +1 -1
- package/dist/tui/services/GeminiService.d.ts +1 -1
- package/dist/tui/services/GeminiService.d.ts.map +1 -1
- package/dist/tui/services/GeminiService.js +87 -76
- package/dist/tui/services/GeminiService.js.map +1 -1
- package/dist/tui/services/ServiceManager.d.ts +3 -3
- package/dist/tui/services/ServiceManager.d.ts.map +1 -1
- package/dist/tui/services/ServiceManager.js +72 -58
- package/dist/tui/services/ServiceManager.js.map +1 -1
- package/dist/tui/services/SocketService.d.ts.map +1 -1
- package/dist/tui/services/SocketService.js +32 -32
- package/dist/tui/services/SocketService.js.map +1 -1
- package/dist/tui/services/ViteService.d.ts.map +1 -1
- package/dist/tui/services/ViteService.js +26 -28
- package/dist/tui/services/ViteService.js.map +1 -1
- package/dist/tui/services/index.d.ts +6 -6
- package/dist/tui/services/index.d.ts.map +1 -1
- package/dist/tui/services/index.js +6 -6
- package/dist/tui/services/index.js.map +1 -1
- package/mcp/gxp-api-server.js +83 -81
- package/package.json +109 -93
- package/runtime/PortalContainer.vue +258 -234
- package/runtime/dev-tools/DevToolsModal.vue +153 -155
- package/runtime/dev-tools/LayoutSwitcher.vue +144 -140
- package/runtime/dev-tools/MockDataEditor.vue +456 -433
- package/runtime/dev-tools/SocketSimulator.vue +379 -371
- package/runtime/dev-tools/StoreInspector.vue +517 -455
- package/runtime/dev-tools/index.js +5 -5
- package/runtime/fallback-layouts/PrivateLayout.vue +2 -2
- package/runtime/fallback-layouts/PublicLayout.vue +2 -2
- package/runtime/fallback-layouts/SystemLayout.vue +2 -2
- package/runtime/gxpStringsPlugin.js +159 -134
- package/runtime/index.html +17 -19
- package/runtime/main.js +24 -22
- package/runtime/mock-api/auth-middleware.js +15 -15
- package/runtime/mock-api/image-generator.js +46 -46
- package/runtime/mock-api/index.js +55 -55
- package/runtime/mock-api/response-generator.js +116 -105
- package/runtime/mock-api/route-generator.js +107 -84
- package/runtime/mock-api/socket-triggers.js +94 -93
- package/runtime/mock-api/spec-loader.js +79 -80
- package/runtime/package.json +3 -0
- package/runtime/server.js +68 -68
- package/runtime/stores/gxpPortalConfigStore.js +204 -186
- package/runtime/stores/index.js +2 -2
- package/runtime/vite-inspector-plugin.js +858 -707
- package/runtime/vite-source-tracker-plugin.js +132 -113
- package/runtime/vite.config.js +207 -132
- package/scripts/launch-chrome.js +41 -41
- package/scripts/pack-chrome.js +38 -39
- package/socket-events/AiSessionMessageCreated.json +17 -17
- package/socket-events/SocialStreamPostCreated.json +23 -23
- package/socket-events/SocialStreamPostVariantCompleted.json +22 -22
- package/template/.claude/agents/gxp-developer.md +100 -99
- package/template/.claude/settings.json +7 -7
- package/template/AGENTS.md +30 -23
- package/template/GEMINI.md +20 -20
- package/template/README.md +70 -53
- package/template/app-manifest.json +2 -4
- package/template/configuration.json +10 -10
- package/template/default-styling.css +1 -1
- package/template/index.html +18 -20
- package/template/main.js +24 -22
- package/template/src/DemoPage.vue +415 -362
- package/template/src/Plugin.vue +76 -85
- package/template/src/stores/index.js +3 -3
- package/template/src/stores/test-data.json +164 -172
- package/template/theme-layouts/AdditionalStyling.css +50 -50
- package/template/theme-layouts/PrivateLayout.vue +8 -12
- package/template/theme-layouts/PublicLayout.vue +8 -12
- package/template/theme-layouts/SystemLayout.vue +8 -12
- package/template/vite.extend.js +45 -0
- package/template/vite.config.js +0 -409
package/bin/lib/utils/files.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
* Handles file operations like safe copying and package.json management.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const path = require("path")
|
|
8
|
-
const fs = require("fs")
|
|
9
|
-
const shell = require("shelljs")
|
|
7
|
+
const path = require("path")
|
|
8
|
+
const fs = require("fs")
|
|
9
|
+
const shell = require("shelljs")
|
|
10
10
|
const {
|
|
11
11
|
REQUIRED_DEPENDENCIES,
|
|
12
12
|
REQUIRED_DEV_DEPENDENCIES,
|
|
13
13
|
DEFAULT_SCRIPTS,
|
|
14
|
-
} = require("../constants")
|
|
15
|
-
const { loadGlobalConfig } = require("./paths")
|
|
14
|
+
} = require("../constants")
|
|
15
|
+
const { loadGlobalConfig } = require("./paths")
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Copies a file from source to destination, creating directories if needed
|
|
@@ -22,14 +22,14 @@ const { loadGlobalConfig } = require("./paths");
|
|
|
22
22
|
* @param {boolean} overwrite - If true, overwrite existing files
|
|
23
23
|
*/
|
|
24
24
|
function safeCopyFile(src, dest, description, overwrite = false) {
|
|
25
|
-
const exists = fs.existsSync(dest)
|
|
25
|
+
const exists = fs.existsSync(dest)
|
|
26
26
|
if (!exists || overwrite) {
|
|
27
|
-
console.log(`${exists ?
|
|
28
|
-
const destDir = path.dirname(dest)
|
|
27
|
+
console.log(`${exists ? "Overwriting" : "Creating"} ${description}`)
|
|
28
|
+
const destDir = path.dirname(dest)
|
|
29
29
|
if (!fs.existsSync(destDir)) {
|
|
30
|
-
fs.mkdirSync(destDir, { recursive: true })
|
|
30
|
+
fs.mkdirSync(destDir, { recursive: true })
|
|
31
31
|
}
|
|
32
|
-
fs.copyFileSync(src, dest)
|
|
32
|
+
fs.copyFileSync(src, dest)
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
@@ -40,8 +40,8 @@ function safeCopyFile(src, dest, description, overwrite = false) {
|
|
|
40
40
|
* @param {string} description - Optional project description
|
|
41
41
|
*/
|
|
42
42
|
function createPackageJson(projectPath, projectName, description = "") {
|
|
43
|
-
const packageJsonPath = path.join(projectPath, "package.json")
|
|
44
|
-
const globalConfig = loadGlobalConfig()
|
|
43
|
+
const packageJsonPath = path.join(projectPath, "package.json")
|
|
44
|
+
const globalConfig = loadGlobalConfig()
|
|
45
45
|
|
|
46
46
|
const packageJson = {
|
|
47
47
|
name: projectName,
|
|
@@ -57,10 +57,10 @@ function createPackageJson(projectPath, projectName, description = "") {
|
|
|
57
57
|
devDependencies: REQUIRED_DEV_DEPENDENCIES,
|
|
58
58
|
author: globalConfig.author || "Your Name",
|
|
59
59
|
license: "ISC",
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
|
|
62
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
63
|
-
console.log("✓ Created package.json")
|
|
62
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
63
|
+
console.log("✓ Created package.json")
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
/**
|
|
@@ -70,33 +70,33 @@ function createPackageJson(projectPath, projectName, description = "") {
|
|
|
70
70
|
* @param {string} description - Optional project description
|
|
71
71
|
*/
|
|
72
72
|
function updateAppManifest(projectPath, projectName, description = "") {
|
|
73
|
-
const manifestPath = path.join(projectPath, "app-manifest.json")
|
|
73
|
+
const manifestPath = path.join(projectPath, "app-manifest.json")
|
|
74
74
|
|
|
75
75
|
if (!fs.existsSync(manifestPath)) {
|
|
76
|
-
console.warn("⚠ app-manifest.json not found, skipping update")
|
|
77
|
-
return
|
|
76
|
+
console.warn("⚠ app-manifest.json not found, skipping update")
|
|
77
|
+
return
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
try {
|
|
81
|
-
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"))
|
|
81
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf-8"))
|
|
82
82
|
|
|
83
83
|
// Update name and description
|
|
84
|
-
manifest.name = projectName
|
|
84
|
+
manifest.name = projectName
|
|
85
85
|
if (description) {
|
|
86
|
-
manifest.description = description
|
|
86
|
+
manifest.description = description
|
|
87
87
|
} else {
|
|
88
|
-
manifest.description = `GxP Plugin: ${projectName}
|
|
88
|
+
manifest.description = `GxP Plugin: ${projectName}`
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
// Update strings with project name
|
|
92
92
|
if (manifest.strings && manifest.strings.default) {
|
|
93
|
-
manifest.strings.default.welcome_text = `Welcome to ${projectName}
|
|
93
|
+
manifest.strings.default.welcome_text = `Welcome to ${projectName}`
|
|
94
94
|
}
|
|
95
95
|
|
|
96
|
-
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, "\t"))
|
|
97
|
-
console.log("✓ Updated app-manifest.json with project details")
|
|
96
|
+
fs.writeFileSync(manifestPath, JSON.stringify(manifest, null, "\t"))
|
|
97
|
+
console.log("✓ Updated app-manifest.json with project details")
|
|
98
98
|
} catch (error) {
|
|
99
|
-
console.warn("⚠ Could not update app-manifest.json:", error.message)
|
|
99
|
+
console.warn("⚠ Could not update app-manifest.json:", error.message)
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
|
|
@@ -104,17 +104,17 @@ function updateAppManifest(projectPath, projectName, description = "") {
|
|
|
104
104
|
* Installs npm dependencies
|
|
105
105
|
*/
|
|
106
106
|
function installDependencies(projectPath) {
|
|
107
|
-
console.log("\n📦 Installing dependencies...")
|
|
108
|
-
const currentDir = process.cwd()
|
|
107
|
+
console.log("\n📦 Installing dependencies...")
|
|
108
|
+
const currentDir = process.cwd()
|
|
109
109
|
|
|
110
110
|
try {
|
|
111
|
-
process.chdir(projectPath)
|
|
112
|
-
const result = shell.exec("npm install", { silent: false })
|
|
111
|
+
process.chdir(projectPath)
|
|
112
|
+
const result = shell.exec("npm install", { silent: false })
|
|
113
113
|
if (result.code !== 0) {
|
|
114
|
-
console.warn("⚠ npm install completed with warnings")
|
|
114
|
+
console.warn("⚠ npm install completed with warnings")
|
|
115
115
|
}
|
|
116
116
|
} finally {
|
|
117
|
-
process.chdir(currentDir)
|
|
117
|
+
process.chdir(currentDir)
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
@@ -122,83 +122,79 @@ function installDependencies(projectPath) {
|
|
|
122
122
|
* Updates existing project's package.json with missing dependencies and scripts
|
|
123
123
|
*/
|
|
124
124
|
function updateExistingProject(projectPath) {
|
|
125
|
-
const packageJsonPath = path.join(projectPath, "package.json")
|
|
125
|
+
const packageJsonPath = path.join(projectPath, "package.json")
|
|
126
126
|
|
|
127
127
|
if (!fs.existsSync(packageJsonPath)) {
|
|
128
|
-
return false
|
|
128
|
+
return false
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
try {
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
if (fs.existsSync(viteConfigPath)) {
|
|
135
|
-
const backupPath = path.join(projectPath, "vite.config.js.backup");
|
|
136
|
-
fs.renameSync(viteConfigPath, backupPath);
|
|
137
|
-
console.log(" → Renamed vite.config.js to vite.config.js.backup");
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
141
|
-
let updated = false;
|
|
132
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"))
|
|
133
|
+
let updated = false
|
|
142
134
|
|
|
143
135
|
// Check and add/update dependencies
|
|
144
136
|
if (!packageJson.dependencies) {
|
|
145
|
-
packageJson.dependencies = {}
|
|
137
|
+
packageJson.dependencies = {}
|
|
146
138
|
}
|
|
147
139
|
|
|
148
140
|
for (const [dep, version] of Object.entries(REQUIRED_DEPENDENCIES)) {
|
|
149
|
-
const existingVersion = packageJson.dependencies[dep]
|
|
141
|
+
const existingVersion = packageJson.dependencies[dep]
|
|
150
142
|
if (!existingVersion) {
|
|
151
|
-
packageJson.dependencies[dep] = version
|
|
152
|
-
console.log(` + Adding dependency: ${dep}@${version}`)
|
|
153
|
-
updated = true
|
|
143
|
+
packageJson.dependencies[dep] = version
|
|
144
|
+
console.log(` + Adding dependency: ${dep}@${version}`)
|
|
145
|
+
updated = true
|
|
154
146
|
} else if (existingVersion !== version) {
|
|
155
|
-
packageJson.dependencies[dep] = version
|
|
156
|
-
console.log(
|
|
157
|
-
|
|
147
|
+
packageJson.dependencies[dep] = version
|
|
148
|
+
console.log(
|
|
149
|
+
` ↑ Updating dependency: ${dep} (${existingVersion} → ${version})`,
|
|
150
|
+
)
|
|
151
|
+
updated = true
|
|
158
152
|
}
|
|
159
153
|
}
|
|
160
154
|
|
|
161
155
|
// Check and add/update dev dependencies
|
|
162
156
|
if (!packageJson.devDependencies) {
|
|
163
|
-
packageJson.devDependencies = {}
|
|
157
|
+
packageJson.devDependencies = {}
|
|
164
158
|
}
|
|
165
159
|
|
|
166
160
|
for (const [dep, version] of Object.entries(REQUIRED_DEV_DEPENDENCIES)) {
|
|
167
|
-
const existingVersion = packageJson.devDependencies[dep]
|
|
161
|
+
const existingVersion = packageJson.devDependencies[dep]
|
|
168
162
|
if (!existingVersion) {
|
|
169
|
-
packageJson.devDependencies[dep] = version
|
|
170
|
-
console.log(` + Adding devDependency: ${dep}@${version}`)
|
|
171
|
-
updated = true
|
|
163
|
+
packageJson.devDependencies[dep] = version
|
|
164
|
+
console.log(` + Adding devDependency: ${dep}@${version}`)
|
|
165
|
+
updated = true
|
|
172
166
|
} else if (existingVersion !== version) {
|
|
173
|
-
packageJson.devDependencies[dep] = version
|
|
174
|
-
console.log(
|
|
175
|
-
|
|
167
|
+
packageJson.devDependencies[dep] = version
|
|
168
|
+
console.log(
|
|
169
|
+
` ↑ Updating devDependency: ${dep} (${existingVersion} → ${version})`,
|
|
170
|
+
)
|
|
171
|
+
updated = true
|
|
176
172
|
}
|
|
177
173
|
}
|
|
178
174
|
|
|
179
175
|
// Check and add missing scripts
|
|
180
176
|
if (!packageJson.scripts) {
|
|
181
|
-
packageJson.scripts = {}
|
|
177
|
+
packageJson.scripts = {}
|
|
182
178
|
}
|
|
183
179
|
|
|
184
180
|
for (const [script, command] of Object.entries(DEFAULT_SCRIPTS)) {
|
|
185
181
|
if (!packageJson.scripts[script]) {
|
|
186
|
-
packageJson.scripts[script] = command
|
|
187
|
-
console.log(` + Adding script: ${script}`)
|
|
188
|
-
updated = true
|
|
182
|
+
packageJson.scripts[script] = command
|
|
183
|
+
console.log(` + Adding script: ${script}`)
|
|
184
|
+
updated = true
|
|
189
185
|
}
|
|
190
186
|
}
|
|
191
187
|
|
|
192
188
|
if (updated) {
|
|
193
|
-
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
194
|
-
console.log("✓ Updated package.json")
|
|
195
|
-
return true
|
|
189
|
+
fs.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2))
|
|
190
|
+
console.log("✓ Updated package.json")
|
|
191
|
+
return true
|
|
196
192
|
}
|
|
197
193
|
|
|
198
|
-
return false
|
|
194
|
+
return false
|
|
199
195
|
} catch (error) {
|
|
200
|
-
console.error("Error updating package.json:", error.message)
|
|
201
|
-
return false
|
|
196
|
+
console.error("Error updating package.json:", error.message)
|
|
197
|
+
return false
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
200
|
|
|
@@ -206,7 +202,7 @@ function updateExistingProject(projectPath) {
|
|
|
206
202
|
* Checks if ImageMagick is available globally
|
|
207
203
|
*/
|
|
208
204
|
function isImageMagickInstalled() {
|
|
209
|
-
return shell.which("magick") !== null || shell.which("convert") !== null
|
|
205
|
+
return shell.which("magick") !== null || shell.which("convert") !== null
|
|
210
206
|
}
|
|
211
207
|
|
|
212
208
|
/**
|
|
@@ -214,23 +210,23 @@ function isImageMagickInstalled() {
|
|
|
214
210
|
*/
|
|
215
211
|
function ensureImageMagickInstalled() {
|
|
216
212
|
if (isImageMagickInstalled()) {
|
|
217
|
-
console.log("✓ ImageMagick is available")
|
|
218
|
-
return true
|
|
213
|
+
console.log("✓ ImageMagick is available")
|
|
214
|
+
return true
|
|
219
215
|
}
|
|
220
216
|
|
|
221
|
-
console.log("⚠️ ImageMagick not found")
|
|
222
|
-
console.log("📦 ImageMagick is required for generating placeholder images")
|
|
223
|
-
console.log("")
|
|
224
|
-
console.log("🍎 macOS: brew install imagemagick")
|
|
225
|
-
console.log("🐧 Ubuntu/Debian: sudo apt-get install imagemagick")
|
|
217
|
+
console.log("⚠️ ImageMagick not found")
|
|
218
|
+
console.log("📦 ImageMagick is required for generating placeholder images")
|
|
219
|
+
console.log("")
|
|
220
|
+
console.log("🍎 macOS: brew install imagemagick")
|
|
221
|
+
console.log("🐧 Ubuntu/Debian: sudo apt-get install imagemagick")
|
|
226
222
|
console.log(
|
|
227
|
-
"🟦 Windows: Download from https://imagemagick.org/script/download.php#windows"
|
|
228
|
-
)
|
|
229
|
-
console.log("")
|
|
230
|
-
console.log("💡 After installation, you can generate placeholders with:")
|
|
231
|
-
console.log(" gxdev assets generate --size 400x300 --name my-placeholder")
|
|
232
|
-
console.log(" gxdev assets generate --name icons --count 3 --size 64x64")
|
|
233
|
-
return false
|
|
223
|
+
"🟦 Windows: Download from https://imagemagick.org/script/download.php#windows",
|
|
224
|
+
)
|
|
225
|
+
console.log("")
|
|
226
|
+
console.log("💡 After installation, you can generate placeholders with:")
|
|
227
|
+
console.log(" gxdev assets generate --size 400x300 --name my-placeholder")
|
|
228
|
+
console.log(" gxdev assets generate --name icons --count 3 --size 64x64")
|
|
229
|
+
return false
|
|
234
230
|
}
|
|
235
231
|
|
|
236
232
|
module.exports = {
|
|
@@ -241,4 +237,4 @@ module.exports = {
|
|
|
241
237
|
updateExistingProject,
|
|
242
238
|
isImageMagickInstalled,
|
|
243
239
|
ensureImageMagickInstalled,
|
|
244
|
-
}
|
|
240
|
+
}
|
package/bin/lib/utils/index.js
CHANGED
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
* Re-exports all utility modules for convenient importing.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const paths = require("./paths")
|
|
8
|
-
const ssl = require("./ssl")
|
|
9
|
-
const files = require("./files")
|
|
10
|
-
const prompts = require("./prompts")
|
|
11
|
-
const aiScaffold = require("./ai-scaffold")
|
|
12
|
-
const extractConfig = require("./extract-config")
|
|
7
|
+
const paths = require("./paths")
|
|
8
|
+
const ssl = require("./ssl")
|
|
9
|
+
const files = require("./files")
|
|
10
|
+
const prompts = require("./prompts")
|
|
11
|
+
const aiScaffold = require("./ai-scaffold")
|
|
12
|
+
const extractConfig = require("./extract-config")
|
|
13
13
|
|
|
14
14
|
module.exports = {
|
|
15
15
|
...paths,
|
|
@@ -18,4 +18,4 @@ module.exports = {
|
|
|
18
18
|
...prompts,
|
|
19
19
|
...aiScaffold,
|
|
20
20
|
...extractConfig,
|
|
21
|
-
}
|
|
21
|
+
}
|
package/bin/lib/utils/paths.js
CHANGED
|
@@ -4,34 +4,34 @@
|
|
|
4
4
|
* Handles finding project roots and resolving paths to toolkit resources.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
const path = require("path")
|
|
8
|
-
const fs = require("fs")
|
|
9
|
-
const os = require("os")
|
|
10
|
-
const { isWin, PACKAGE_NAME } = require("../constants")
|
|
7
|
+
const path = require("path")
|
|
8
|
+
const fs = require("fs")
|
|
9
|
+
const os = require("os")
|
|
10
|
+
const { isWin, PACKAGE_NAME } = require("../constants")
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Determines the correct binary name based on platform and architecture
|
|
14
14
|
*/
|
|
15
15
|
function getBinaryName() {
|
|
16
|
-
if (isWin) return "gento-win"
|
|
17
|
-
if (process.arch === "x64") return "gento-darwin-amd64"
|
|
18
|
-
return "gento"
|
|
16
|
+
if (isWin) return "gento-win"
|
|
17
|
+
if (process.arch === "x64") return "gento-darwin-amd64"
|
|
18
|
+
return "gento"
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* Finds the project root directory by looking for package.json
|
|
23
23
|
*/
|
|
24
24
|
function findProjectRoot() {
|
|
25
|
-
let currentDir = process.cwd()
|
|
25
|
+
let currentDir = process.cwd()
|
|
26
26
|
|
|
27
27
|
while (currentDir !== path.dirname(currentDir)) {
|
|
28
28
|
if (fs.existsSync(path.join(currentDir, "package.json"))) {
|
|
29
|
-
return currentDir
|
|
29
|
+
return currentDir
|
|
30
30
|
}
|
|
31
|
-
currentDir = path.dirname(currentDir)
|
|
31
|
+
currentDir = path.dirname(currentDir)
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
return process.cwd()
|
|
34
|
+
return process.cwd() // Fallback to current directory
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
@@ -43,10 +43,10 @@ function findProjectRoot() {
|
|
|
43
43
|
* - /socket-events/ - Socket event templates
|
|
44
44
|
*/
|
|
45
45
|
function resolveGxPaths() {
|
|
46
|
-
const projectRoot = findProjectRoot()
|
|
46
|
+
const projectRoot = findProjectRoot()
|
|
47
47
|
|
|
48
48
|
// Try local installation first
|
|
49
|
-
const localNodeModules = path.join(projectRoot, "node_modules", PACKAGE_NAME)
|
|
49
|
+
const localNodeModules = path.join(projectRoot, "node_modules", PACKAGE_NAME)
|
|
50
50
|
if (fs.existsSync(localNodeModules)) {
|
|
51
51
|
return {
|
|
52
52
|
gentoPath: path.join(localNodeModules, "bin", getBinaryName()),
|
|
@@ -57,11 +57,11 @@ function resolveGxPaths() {
|
|
|
57
57
|
packageRoot: localNodeModules,
|
|
58
58
|
// Legacy alias for backward compatibility
|
|
59
59
|
configDir: path.join(localNodeModules, "template"),
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// Try global installation (or running from the toolkit itself)
|
|
64
|
-
const globalNodeModules = path.join(__dirname, "..", "..", "..")
|
|
64
|
+
const globalNodeModules = path.join(__dirname, "..", "..", "..")
|
|
65
65
|
return {
|
|
66
66
|
gentoPath: path.join(globalNodeModules, "bin", getBinaryName()),
|
|
67
67
|
viteConfigPath: path.join(globalNodeModules, "runtime", "vite.config.js"),
|
|
@@ -71,7 +71,7 @@ function resolveGxPaths() {
|
|
|
71
71
|
packageRoot: globalNodeModules,
|
|
72
72
|
// Legacy alias for backward compatibility
|
|
73
73
|
configDir: path.join(globalNodeModules, "template"),
|
|
74
|
-
}
|
|
74
|
+
}
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
/**
|
|
@@ -82,51 +82,51 @@ function resolveGxPaths() {
|
|
|
82
82
|
* @param {string} packageLocation - Which package directory to check: 'template', 'runtime', or 'socket-events'
|
|
83
83
|
*/
|
|
84
84
|
function resolveFilePath(fileName, subDir = "", packageLocation = "template") {
|
|
85
|
-
const projectRoot = findProjectRoot()
|
|
86
|
-
const paths = resolveGxPaths()
|
|
85
|
+
const projectRoot = findProjectRoot()
|
|
86
|
+
const paths = resolveGxPaths()
|
|
87
87
|
|
|
88
88
|
// Check local project first
|
|
89
|
-
const localPath = path.join(projectRoot, subDir, fileName)
|
|
89
|
+
const localPath = path.join(projectRoot, subDir, fileName)
|
|
90
90
|
if (fs.existsSync(localPath)) {
|
|
91
|
-
return { path: localPath, isLocal: true }
|
|
91
|
+
return { path: localPath, isLocal: true }
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
// Determine which package directory to check
|
|
95
|
-
let packageDir
|
|
95
|
+
let packageDir
|
|
96
96
|
switch (packageLocation) {
|
|
97
97
|
case "runtime":
|
|
98
|
-
packageDir = paths.runtimeDir
|
|
99
|
-
break
|
|
98
|
+
packageDir = paths.runtimeDir
|
|
99
|
+
break
|
|
100
100
|
case "socket-events":
|
|
101
|
-
packageDir = paths.socketEventsDir
|
|
102
|
-
break
|
|
101
|
+
packageDir = paths.socketEventsDir
|
|
102
|
+
break
|
|
103
103
|
default:
|
|
104
|
-
packageDir = paths.templateDir
|
|
104
|
+
packageDir = paths.templateDir
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
// Fall back to package version
|
|
108
|
-
const packagePath = path.join(packageDir, subDir, fileName)
|
|
108
|
+
const packagePath = path.join(packageDir, subDir, fileName)
|
|
109
109
|
if (fs.existsSync(packagePath)) {
|
|
110
|
-
return { path: packagePath, isLocal: false }
|
|
110
|
+
return { path: packagePath, isLocal: false }
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
// Return package path even if doesn't exist (for error handling)
|
|
114
|
-
return { path: packagePath, isLocal: false }
|
|
114
|
+
return { path: packagePath, isLocal: false }
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
/**
|
|
118
118
|
* Loads global configuration if available
|
|
119
119
|
*/
|
|
120
120
|
function loadGlobalConfig() {
|
|
121
|
-
const globalConfigPath = path.join(os.homedir(), "gxdev-default-config.json")
|
|
121
|
+
const globalConfigPath = path.join(os.homedir(), "gxdev-default-config.json")
|
|
122
122
|
if (fs.existsSync(globalConfigPath)) {
|
|
123
123
|
try {
|
|
124
|
-
return JSON.parse(fs.readFileSync(globalConfigPath, "utf-8"))
|
|
124
|
+
return JSON.parse(fs.readFileSync(globalConfigPath, "utf-8"))
|
|
125
125
|
} catch (error) {
|
|
126
|
-
console.warn("Warning: Could not parse global configuration")
|
|
126
|
+
console.warn("Warning: Could not parse global configuration")
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
|
-
return {}
|
|
129
|
+
return {}
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
module.exports = {
|
|
@@ -135,4 +135,4 @@ module.exports = {
|
|
|
135
135
|
resolveGxPaths,
|
|
136
136
|
resolveFilePath,
|
|
137
137
|
loadGlobalConfig,
|
|
138
|
-
}
|
|
138
|
+
}
|