@gxp-dev/tools 2.0.63 → 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 +191 -139
- 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
|
@@ -4,148 +4,146 @@
|
|
|
4
4
|
* Manages development assets and placeholder image generation.
|
|
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
|
findProjectRoot,
|
|
12
12
|
resolveGxPaths,
|
|
13
13
|
safeCopyFile,
|
|
14
14
|
isImageMagickInstalled,
|
|
15
15
|
ensureImageMagickInstalled,
|
|
16
|
-
} = require("../utils")
|
|
16
|
+
} = require("../utils")
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Assets management command - manages development assets and placeholder generation
|
|
20
20
|
*/
|
|
21
21
|
async function assetsCommand(argv) {
|
|
22
|
-
const action = argv.action
|
|
22
|
+
const action = argv.action
|
|
23
23
|
|
|
24
24
|
if (action === "list") {
|
|
25
|
-
listDevelopmentAssets(argv)
|
|
25
|
+
listDevelopmentAssets(argv)
|
|
26
26
|
} else if (action === "generate") {
|
|
27
|
-
await generatePlaceholderImage(argv)
|
|
27
|
+
await generatePlaceholderImage(argv)
|
|
28
28
|
} else if (action === "init") {
|
|
29
|
-
await initDevelopmentAssets()
|
|
29
|
+
await initDevelopmentAssets()
|
|
30
30
|
} else {
|
|
31
|
-
console.error(
|
|
32
|
-
|
|
33
|
-
);
|
|
34
|
-
process.exit(1);
|
|
31
|
+
console.error("❌ Invalid assets action. Use 'list', 'generate', or 'init'")
|
|
32
|
+
process.exit(1)
|
|
35
33
|
}
|
|
36
34
|
}
|
|
37
35
|
|
|
38
36
|
function listDevelopmentAssets(argv) {
|
|
39
|
-
const projectPath = findProjectRoot()
|
|
40
|
-
const devAssetsDir = path.join(projectPath, "dev-assets")
|
|
37
|
+
const projectPath = findProjectRoot()
|
|
38
|
+
const devAssetsDir = path.join(projectPath, "dev-assets")
|
|
41
39
|
|
|
42
40
|
if (!fs.existsSync(devAssetsDir)) {
|
|
43
|
-
console.log("❌ No dev-assets directory found")
|
|
44
|
-
console.log("💡 Run 'gxdev assets init' to set up development assets")
|
|
45
|
-
return
|
|
41
|
+
console.log("❌ No dev-assets directory found")
|
|
42
|
+
console.log("💡 Run 'gxdev assets init' to set up development assets")
|
|
43
|
+
return
|
|
46
44
|
}
|
|
47
|
-
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
45
|
+
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
48
46
|
|
|
49
|
-
console.log("📁 Development Assets:")
|
|
50
|
-
console.log("")
|
|
47
|
+
console.log("📁 Development Assets:")
|
|
48
|
+
console.log("")
|
|
51
49
|
|
|
52
|
-
const dirs = ["images", "videos"]
|
|
50
|
+
const dirs = ["images", "videos"]
|
|
53
51
|
dirs.forEach((dir) => {
|
|
54
|
-
const dirPath = path.join(devAssetsDir, dir)
|
|
52
|
+
const dirPath = path.join(devAssetsDir, dir)
|
|
55
53
|
if (fs.existsSync(dirPath)) {
|
|
56
|
-
const files = fs.readdirSync(dirPath)
|
|
54
|
+
const files = fs.readdirSync(dirPath)
|
|
57
55
|
if (files.length > 0) {
|
|
58
|
-
console.log(`📸 ${dir}/`)
|
|
56
|
+
console.log(`📸 ${dir}/`)
|
|
59
57
|
files.forEach((file) => {
|
|
60
|
-
const stats = fs.statSync(path.join(dirPath, file))
|
|
61
|
-
const size = (stats.size / 1024).toFixed(1)
|
|
62
|
-
console.log(` • ${file} (${size} KB)`)
|
|
58
|
+
const stats = fs.statSync(path.join(dirPath, file))
|
|
59
|
+
const size = (stats.size / 1024).toFixed(1)
|
|
60
|
+
console.log(` • ${file} (${size} KB)`)
|
|
63
61
|
console.log(
|
|
64
|
-
` URL: https://localhost:${finalPort}/dev-assets/${dir}/${file}
|
|
65
|
-
)
|
|
66
|
-
})
|
|
67
|
-
console.log("")
|
|
62
|
+
` URL: https://localhost:${finalPort}/dev-assets/${dir}/${file}`,
|
|
63
|
+
)
|
|
64
|
+
})
|
|
65
|
+
console.log("")
|
|
68
66
|
}
|
|
69
67
|
}
|
|
70
|
-
})
|
|
68
|
+
})
|
|
71
69
|
|
|
72
|
-
console.log("💡 Usage:")
|
|
73
|
-
console.log(" Add assets to your store:")
|
|
70
|
+
console.log("💡 Usage:")
|
|
71
|
+
console.log(" Add assets to your store:")
|
|
74
72
|
console.log(
|
|
75
|
-
` gxpStore.updateAsset("my_image", "https://localhost:${finalPort}/dev-assets/images/my-image.jpg")
|
|
76
|
-
)
|
|
73
|
+
` gxpStore.updateAsset("my_image", "https://localhost:${finalPort}/dev-assets/images/my-image.jpg")`,
|
|
74
|
+
)
|
|
77
75
|
}
|
|
78
76
|
|
|
79
77
|
async function generatePlaceholderImage(argv) {
|
|
80
78
|
if (!ensureImageMagickInstalled()) {
|
|
81
|
-
process.exit(1)
|
|
79
|
+
process.exit(1)
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
const projectPath = findProjectRoot()
|
|
85
|
-
const size = argv.size || "400x300"
|
|
86
|
-
const name = argv.name || "placeholder"
|
|
87
|
-
const format = argv.format || "png"
|
|
88
|
-
const count = Math.max(1, argv.count || 1)
|
|
82
|
+
const projectPath = findProjectRoot()
|
|
83
|
+
const size = argv.size || "400x300"
|
|
84
|
+
const name = argv.name || "placeholder"
|
|
85
|
+
const format = argv.format || "png"
|
|
86
|
+
const count = Math.max(1, argv.count || 1)
|
|
89
87
|
|
|
90
|
-
const devAssetsDir = path.join(projectPath, "dev-assets", "images")
|
|
88
|
+
const devAssetsDir = path.join(projectPath, "dev-assets", "images")
|
|
91
89
|
if (!fs.existsSync(devAssetsDir)) {
|
|
92
|
-
fs.mkdirSync(devAssetsDir, { recursive: true })
|
|
90
|
+
fs.mkdirSync(devAssetsDir, { recursive: true })
|
|
93
91
|
}
|
|
94
92
|
|
|
95
93
|
// Use magick command (ImageMagick 7) or convert (ImageMagick 6)
|
|
96
|
-
const magickCmd = shell.which("magick") ? "magick" : "convert"
|
|
97
|
-
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
94
|
+
const magickCmd = shell.which("magick") ? "magick" : "convert"
|
|
95
|
+
const finalPort = argv.port || process.env.NODE_PORT || 3000
|
|
98
96
|
|
|
99
|
-
const generatedAssets = []
|
|
97
|
+
const generatedAssets = []
|
|
100
98
|
|
|
101
|
-
console.log(`🎨 Generating ${count} placeholder${count > 1 ? "s" : ""}...`)
|
|
102
|
-
console.log(`📐 Size: ${size}`)
|
|
99
|
+
console.log(`🎨 Generating ${count} placeholder${count > 1 ? "s" : ""}...`)
|
|
100
|
+
console.log(`📐 Size: ${size}`)
|
|
103
101
|
|
|
104
102
|
for (let i = 0; i < count; i++) {
|
|
105
|
-
const color = argv.color || getRandomColor()
|
|
106
|
-
const style = getRandomStyle()
|
|
107
|
-
const suffix = count > 1 ? `-${i + 1}` : ""
|
|
108
|
-
const filename = `${name}${suffix}.${format}
|
|
103
|
+
const color = argv.color || getRandomColor()
|
|
104
|
+
const style = getRandomStyle()
|
|
105
|
+
const suffix = count > 1 ? `-${i + 1}` : ""
|
|
106
|
+
const filename = `${name}${suffix}.${format}`
|
|
109
107
|
const text =
|
|
110
108
|
argv.text ||
|
|
111
|
-
(count > 1 ? `${name} ${i + 1}\n${size}` : `${name}\n${size}`)
|
|
112
|
-
const outputPath = path.join(devAssetsDir, filename)
|
|
109
|
+
(count > 1 ? `${name} ${i + 1}\n${size}` : `${name}\n${size}`)
|
|
110
|
+
const outputPath = path.join(devAssetsDir, filename)
|
|
113
111
|
|
|
114
112
|
// Create command with style variations
|
|
115
|
-
const styleOptions = getStyleOptions(style, color)
|
|
116
|
-
const command = `${magickCmd} -size ${size} ${styleOptions.background} -gravity center ${styleOptions.text} -annotate +0+0 "${text}" "${outputPath}"
|
|
113
|
+
const styleOptions = getStyleOptions(style, color)
|
|
114
|
+
const command = `${magickCmd} -size ${size} ${styleOptions.background} -gravity center ${styleOptions.text} -annotate +0+0 "${text}" "${outputPath}"`
|
|
117
115
|
|
|
118
|
-
console.log(`🎨 Generating: ${filename} (${color}, ${style.name})`)
|
|
116
|
+
console.log(`🎨 Generating: ${filename} (${color}, ${style.name})`)
|
|
119
117
|
|
|
120
|
-
const result = shell.exec(command, { silent: true })
|
|
118
|
+
const result = shell.exec(command, { silent: true })
|
|
121
119
|
|
|
122
120
|
if (result.code === 0) {
|
|
123
|
-
console.log(`✅ Generated: ${filename}`)
|
|
121
|
+
console.log(`✅ Generated: ${filename}`)
|
|
124
122
|
generatedAssets.push({
|
|
125
123
|
name: count > 1 ? `${name}_${i + 1}` : name,
|
|
126
124
|
filename,
|
|
127
125
|
url: `https://localhost:${finalPort}/dev-assets/images/${filename}`,
|
|
128
126
|
color,
|
|
129
127
|
style: style.name,
|
|
130
|
-
})
|
|
128
|
+
})
|
|
131
129
|
} else {
|
|
132
|
-
console.error(`❌ Failed to generate ${filename}: ${result.stderr}`)
|
|
133
|
-
process.exit(1)
|
|
130
|
+
console.error(`❌ Failed to generate ${filename}: ${result.stderr}`)
|
|
131
|
+
process.exit(1)
|
|
134
132
|
}
|
|
135
133
|
}
|
|
136
134
|
|
|
137
|
-
console.log("")
|
|
138
|
-
console.log("📁 Generated assets:")
|
|
135
|
+
console.log("")
|
|
136
|
+
console.log("📁 Generated assets:")
|
|
139
137
|
generatedAssets.forEach((asset) => {
|
|
140
|
-
console.log(` • ${asset.filename} (${asset.color}, ${asset.style})`)
|
|
141
|
-
console.log(` URL: ${asset.url}`)
|
|
142
|
-
})
|
|
138
|
+
console.log(` • ${asset.filename} (${asset.color}, ${asset.style})`)
|
|
139
|
+
console.log(` URL: ${asset.url}`)
|
|
140
|
+
})
|
|
143
141
|
|
|
144
|
-
console.log("")
|
|
145
|
-
console.log("💡 Add to your store:")
|
|
142
|
+
console.log("")
|
|
143
|
+
console.log("💡 Add to your store:")
|
|
146
144
|
generatedAssets.forEach((asset) => {
|
|
147
|
-
console.log(` gxpStore.updateAsset("${asset.name}", "${asset.url}")`)
|
|
148
|
-
})
|
|
145
|
+
console.log(` gxpStore.updateAsset("${asset.name}", "${asset.url}")`)
|
|
146
|
+
})
|
|
149
147
|
}
|
|
150
148
|
|
|
151
149
|
function getRandomColor() {
|
|
@@ -160,8 +158,8 @@ function getRandomColor() {
|
|
|
160
158
|
"#F7DC6F",
|
|
161
159
|
"#BB8FCE",
|
|
162
160
|
"#85C1E9",
|
|
163
|
-
]
|
|
164
|
-
return colors[Math.floor(Math.random() * colors.length)]
|
|
161
|
+
]
|
|
162
|
+
return colors[Math.floor(Math.random() * colors.length)]
|
|
165
163
|
}
|
|
166
164
|
|
|
167
165
|
function getRandomStyle() {
|
|
@@ -186,152 +184,152 @@ function getRandomStyle() {
|
|
|
186
184
|
name: "minimal",
|
|
187
185
|
description: "Clean minimal style with dark text",
|
|
188
186
|
},
|
|
189
|
-
]
|
|
190
|
-
return styles[Math.floor(Math.random() * styles.length)]
|
|
187
|
+
]
|
|
188
|
+
return styles[Math.floor(Math.random() * styles.length)]
|
|
191
189
|
}
|
|
192
190
|
|
|
193
191
|
function getStyleOptions(style, color) {
|
|
194
|
-
const darkerColor = adjustColor(color, -30)
|
|
195
|
-
const lighterColor = adjustColor(color, 30)
|
|
192
|
+
const darkerColor = adjustColor(color, -30)
|
|
193
|
+
const lighterColor = adjustColor(color, 30)
|
|
196
194
|
|
|
197
195
|
switch (style.name) {
|
|
198
196
|
case "bright":
|
|
199
197
|
return {
|
|
200
198
|
background: `"xc:${lighterColor}"`,
|
|
201
199
|
text: `-pointsize 24 -fill "${darkerColor}"`,
|
|
202
|
-
}
|
|
200
|
+
}
|
|
203
201
|
case "outline":
|
|
204
202
|
return {
|
|
205
203
|
background: `"xc:${color}"`,
|
|
206
204
|
text: `-pointsize 24 -fill none -stroke white -strokewidth 2`,
|
|
207
|
-
}
|
|
205
|
+
}
|
|
208
206
|
case "shadow":
|
|
209
207
|
return {
|
|
210
208
|
background: `"xc:${color}"`,
|
|
211
209
|
text: `-pointsize 24 -fill white -stroke black -strokewidth 1`,
|
|
212
|
-
}
|
|
210
|
+
}
|
|
213
211
|
case "minimal":
|
|
214
212
|
return {
|
|
215
213
|
background: `"xc:${lighterColor}"`,
|
|
216
214
|
text: `-pointsize 20 -fill "${darkerColor}"`,
|
|
217
|
-
}
|
|
215
|
+
}
|
|
218
216
|
default: // solid
|
|
219
217
|
return {
|
|
220
218
|
background: `"xc:${color}"`,
|
|
221
219
|
text: `-pointsize 24 -fill white`,
|
|
222
|
-
}
|
|
220
|
+
}
|
|
223
221
|
}
|
|
224
222
|
}
|
|
225
223
|
|
|
226
224
|
function adjustColor(hex, percent) {
|
|
227
225
|
// Remove # if present
|
|
228
|
-
hex = hex.replace("#", "")
|
|
226
|
+
hex = hex.replace("#", "")
|
|
229
227
|
|
|
230
228
|
// Ensure we have a valid 6-character hex
|
|
231
229
|
if (hex.length !== 6) {
|
|
232
|
-
console.error(`Invalid hex color: ${hex}`)
|
|
233
|
-
return "#000000"
|
|
230
|
+
console.error(`Invalid hex color: ${hex}`)
|
|
231
|
+
return "#000000"
|
|
234
232
|
}
|
|
235
233
|
|
|
236
234
|
// Parse RGB values
|
|
237
|
-
const r = parseInt(hex.substr(0, 2), 16)
|
|
238
|
-
const g = parseInt(hex.substr(2, 2), 16)
|
|
239
|
-
const b = parseInt(hex.substr(4, 2), 16)
|
|
235
|
+
const r = parseInt(hex.substr(0, 2), 16)
|
|
236
|
+
const g = parseInt(hex.substr(2, 2), 16)
|
|
237
|
+
const b = parseInt(hex.substr(4, 2), 16)
|
|
240
238
|
|
|
241
239
|
// Check for NaN values
|
|
242
240
|
if (isNaN(r) || isNaN(g) || isNaN(b)) {
|
|
243
|
-
console.error(`Failed to parse hex color: ${hex}`)
|
|
244
|
-
return "#000000"
|
|
241
|
+
console.error(`Failed to parse hex color: ${hex}`)
|
|
242
|
+
return "#000000"
|
|
245
243
|
}
|
|
246
244
|
|
|
247
245
|
// Adjust brightness
|
|
248
246
|
const adjustValue = (value, percent) => {
|
|
249
|
-
const adjusted = value + (percent * 255) / 100
|
|
250
|
-
return Math.max(0, Math.min(255, Math.round(adjusted)))
|
|
251
|
-
}
|
|
247
|
+
const adjusted = value + (percent * 255) / 100
|
|
248
|
+
return Math.max(0, Math.min(255, Math.round(adjusted)))
|
|
249
|
+
}
|
|
252
250
|
|
|
253
|
-
const newR = adjustValue(r, percent)
|
|
254
|
-
const newG = adjustValue(g, percent)
|
|
255
|
-
const newB = adjustValue(b, percent)
|
|
251
|
+
const newR = adjustValue(r, percent)
|
|
252
|
+
const newG = adjustValue(g, percent)
|
|
253
|
+
const newB = adjustValue(b, percent)
|
|
256
254
|
|
|
257
255
|
// Convert back to hex
|
|
258
|
-
const toHex = (value) => value.toString(16).padStart(2, "0")
|
|
259
|
-
return `#${toHex(newR)}${toHex(newG)}${toHex(newB)}
|
|
256
|
+
const toHex = (value) => value.toString(16).padStart(2, "0")
|
|
257
|
+
return `#${toHex(newR)}${toHex(newG)}${toHex(newB)}`
|
|
260
258
|
}
|
|
261
259
|
|
|
262
260
|
async function initDevelopmentAssets() {
|
|
263
|
-
const projectPath = findProjectRoot()
|
|
264
|
-
const devAssetsDir = path.join(projectPath, "dev-assets")
|
|
261
|
+
const projectPath = findProjectRoot()
|
|
262
|
+
const devAssetsDir = path.join(projectPath, "dev-assets")
|
|
265
263
|
|
|
266
|
-
console.log("🎨 Setting up development assets...")
|
|
264
|
+
console.log("🎨 Setting up development assets...")
|
|
267
265
|
|
|
268
266
|
// Create directories
|
|
269
|
-
const dirs = ["images", "videos"]
|
|
267
|
+
const dirs = ["images", "videos"]
|
|
270
268
|
dirs.forEach((dir) => {
|
|
271
|
-
const dirPath = path.join(devAssetsDir, dir)
|
|
269
|
+
const dirPath = path.join(devAssetsDir, dir)
|
|
272
270
|
if (!fs.existsSync(dirPath)) {
|
|
273
|
-
fs.mkdirSync(dirPath, { recursive: true })
|
|
274
|
-
console.log(`✓ Created ${dir}/ directory`)
|
|
271
|
+
fs.mkdirSync(dirPath, { recursive: true })
|
|
272
|
+
console.log(`✓ Created ${dir}/ directory`)
|
|
275
273
|
}
|
|
276
|
-
})
|
|
274
|
+
})
|
|
277
275
|
|
|
278
276
|
// Copy starter assets from toolkit
|
|
279
|
-
const paths = resolveGxPaths()
|
|
280
|
-
const sourceAssetsDir = path.join(paths.templateDir, "dev-assets")
|
|
277
|
+
const paths = resolveGxPaths()
|
|
278
|
+
const sourceAssetsDir = path.join(paths.templateDir, "dev-assets")
|
|
281
279
|
|
|
282
280
|
if (fs.existsSync(sourceAssetsDir)) {
|
|
283
|
-
console.log("📋 Copying starter assets...")
|
|
281
|
+
console.log("📋 Copying starter assets...")
|
|
284
282
|
|
|
285
283
|
// Copy image assets
|
|
286
|
-
const sourceImagesDir = path.join(sourceAssetsDir, "images")
|
|
287
|
-
const destImagesDir = path.join(devAssetsDir, "images")
|
|
284
|
+
const sourceImagesDir = path.join(sourceAssetsDir, "images")
|
|
285
|
+
const destImagesDir = path.join(devAssetsDir, "images")
|
|
288
286
|
|
|
289
287
|
if (fs.existsSync(sourceImagesDir)) {
|
|
290
|
-
const imageFiles = fs.readdirSync(sourceImagesDir)
|
|
288
|
+
const imageFiles = fs.readdirSync(sourceImagesDir)
|
|
291
289
|
imageFiles.forEach((file) => {
|
|
292
|
-
const srcPath = path.join(sourceImagesDir, file)
|
|
293
|
-
const destPath = path.join(destImagesDir, file)
|
|
290
|
+
const srcPath = path.join(sourceImagesDir, file)
|
|
291
|
+
const destPath = path.join(destImagesDir, file)
|
|
294
292
|
if (!fs.existsSync(destPath)) {
|
|
295
|
-
safeCopyFile(srcPath, destPath, `Asset: ${file}`)
|
|
293
|
+
safeCopyFile(srcPath, destPath, `Asset: ${file}`)
|
|
296
294
|
}
|
|
297
|
-
})
|
|
295
|
+
})
|
|
298
296
|
}
|
|
299
297
|
}
|
|
300
298
|
|
|
301
299
|
// Add to .gitignore
|
|
302
|
-
const gitignorePath = path.join(projectPath, ".gitignore")
|
|
300
|
+
const gitignorePath = path.join(projectPath, ".gitignore")
|
|
303
301
|
if (fs.existsSync(gitignorePath)) {
|
|
304
|
-
let gitignoreContent = fs.readFileSync(gitignorePath, "utf-8")
|
|
302
|
+
let gitignoreContent = fs.readFileSync(gitignorePath, "utf-8")
|
|
305
303
|
if (!gitignoreContent.includes("dev-assets/")) {
|
|
306
304
|
gitignoreContent +=
|
|
307
|
-
"\n# Development assets (add your own files here)\ndev-assets/\n"
|
|
308
|
-
fs.writeFileSync(gitignorePath, gitignoreContent)
|
|
309
|
-
console.log("✓ Added dev-assets/ to .gitignore")
|
|
305
|
+
"\n# Development assets (add your own files here)\ndev-assets/\n"
|
|
306
|
+
fs.writeFileSync(gitignorePath, gitignoreContent)
|
|
307
|
+
console.log("✓ Added dev-assets/ to .gitignore")
|
|
310
308
|
}
|
|
311
309
|
}
|
|
312
310
|
|
|
313
|
-
console.log("✅ Development assets setup complete!")
|
|
314
|
-
console.log("")
|
|
315
|
-
console.log("📁 Directory structure:")
|
|
316
|
-
console.log(" dev-assets/")
|
|
317
|
-
console.log(" ├── images/ # Image placeholders")
|
|
318
|
-
console.log(" └── videos/ # Video placeholders")
|
|
319
|
-
console.log("")
|
|
320
|
-
console.log("💡 Commands:")
|
|
311
|
+
console.log("✅ Development assets setup complete!")
|
|
312
|
+
console.log("")
|
|
313
|
+
console.log("📁 Directory structure:")
|
|
314
|
+
console.log(" dev-assets/")
|
|
315
|
+
console.log(" ├── images/ # Image placeholders")
|
|
316
|
+
console.log(" └── videos/ # Video placeholders")
|
|
317
|
+
console.log("")
|
|
318
|
+
console.log("💡 Commands:")
|
|
321
319
|
console.log(
|
|
322
|
-
" gxdev assets list # List all assets"
|
|
323
|
-
)
|
|
320
|
+
" gxdev assets list # List all assets",
|
|
321
|
+
)
|
|
324
322
|
console.log(
|
|
325
|
-
" gxdev assets generate --size 800x600 # Generate placeholder"
|
|
326
|
-
)
|
|
323
|
+
" gxdev assets generate --size 800x600 # Generate placeholder",
|
|
324
|
+
)
|
|
327
325
|
console.log(
|
|
328
|
-
" gxdev assets generate --name logo --size 200x200 # Custom placeholder"
|
|
329
|
-
)
|
|
326
|
+
" gxdev assets generate --name logo --size 200x200 # Custom placeholder",
|
|
327
|
+
)
|
|
330
328
|
console.log(
|
|
331
|
-
" gxdev assets generate --name banner --count 5 # Generate 5 variants"
|
|
332
|
-
)
|
|
329
|
+
" gxdev assets generate --name banner --count 5 # Generate 5 variants",
|
|
330
|
+
)
|
|
333
331
|
}
|
|
334
332
|
|
|
335
333
|
module.exports = {
|
|
336
334
|
assetsCommand,
|
|
337
|
-
}
|
|
335
|
+
}
|