@gxp-dev/tools 2.0.63 → 2.0.65
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
|
@@ -1,180 +1,200 @@
|
|
|
1
|
-
import React, { useState, useEffect } from
|
|
2
|
-
import { Box, Text, useInput, useStdout } from
|
|
3
|
-
import TextInput from
|
|
4
|
-
import {
|
|
5
|
-
aiService,
|
|
6
|
-
getProviderStatus,
|
|
7
|
-
} from '../services/index.js';
|
|
1
|
+
import React, { useState, useEffect } from "react"
|
|
2
|
+
import { Box, Text, useInput, useStdout } from "ink"
|
|
3
|
+
import TextInput from "ink-text-input"
|
|
4
|
+
import { aiService, getProviderStatus } from "../services/index.js"
|
|
8
5
|
|
|
9
6
|
interface AIPanelProps {
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
onClose: () => void
|
|
8
|
+
onLog: (message: string) => void
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
interface Message {
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
role: "user" | "assistant" | "system"
|
|
13
|
+
content: string
|
|
17
14
|
}
|
|
18
15
|
|
|
19
16
|
export default function AIPanel({ onClose, onLog }: AIPanelProps) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
17
|
+
const { stdout } = useStdout()
|
|
18
|
+
const [input, setInput] = useState("")
|
|
19
|
+
const [messages, setMessages] = useState<Message[]>([])
|
|
20
|
+
const [isLoading, setIsLoading] = useState(false)
|
|
21
|
+
const [scrollOffset, setScrollOffset] = useState(0)
|
|
22
|
+
|
|
23
|
+
// Calculate available height for messages
|
|
24
|
+
const maxMessageLines = stdout ? Math.max(5, stdout.rows - 8) : 10
|
|
25
|
+
|
|
26
|
+
// Get provider info for display
|
|
27
|
+
const providerInfo = aiService.getProviderInfo()
|
|
28
|
+
const providerName = providerInfo?.name || "AI"
|
|
29
|
+
|
|
30
|
+
// Check provider availability on mount
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (!aiService.isAvailable()) {
|
|
33
|
+
setMessages([
|
|
34
|
+
{
|
|
35
|
+
role: "system",
|
|
36
|
+
content: `${providerName} is not available. Run /ai model to select a different provider, or install the required CLI.`,
|
|
37
|
+
},
|
|
38
|
+
])
|
|
39
|
+
} else {
|
|
40
|
+
const status = getProviderStatus(providerInfo!)
|
|
41
|
+
setMessages([
|
|
42
|
+
{
|
|
43
|
+
role: "system",
|
|
44
|
+
content: `${status} ready.\nType your message and press Enter. Press Escape to close.`,
|
|
45
|
+
},
|
|
46
|
+
])
|
|
47
|
+
// Load project context
|
|
48
|
+
aiService.loadProjectContext(process.cwd())
|
|
49
|
+
}
|
|
50
|
+
}, [])
|
|
51
|
+
|
|
52
|
+
// Handle keyboard input
|
|
53
|
+
useInput((char, key) => {
|
|
54
|
+
if (key.escape) {
|
|
55
|
+
onClose()
|
|
56
|
+
return
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Scroll with Shift+Up/Down
|
|
60
|
+
if (key.shift && key.upArrow) {
|
|
61
|
+
setScrollOffset((prev) =>
|
|
62
|
+
Math.min(prev + 1, Math.max(0, messages.length - maxMessageLines)),
|
|
63
|
+
)
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
if (key.shift && key.downArrow) {
|
|
67
|
+
setScrollOffset((prev) => Math.max(0, prev - 1))
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
const handleSubmit = async (value: string) => {
|
|
73
|
+
if (!value.trim() || isLoading) return
|
|
74
|
+
|
|
75
|
+
const userMessage = value.trim()
|
|
76
|
+
setInput("")
|
|
77
|
+
|
|
78
|
+
// Add user message
|
|
79
|
+
setMessages((prev) => [...prev, { role: "user", content: userMessage }])
|
|
80
|
+
setIsLoading(true)
|
|
81
|
+
|
|
82
|
+
try {
|
|
83
|
+
const response = await aiService.sendMessage(userMessage)
|
|
84
|
+
setMessages((prev) => [...prev, { role: "assistant", content: response }])
|
|
85
|
+
setScrollOffset(0) // Auto-scroll to bottom
|
|
86
|
+
} catch (err) {
|
|
87
|
+
const errorMessage = err instanceof Error ? err.message : "Unknown error"
|
|
88
|
+
setMessages((prev) => [
|
|
89
|
+
...prev,
|
|
90
|
+
{
|
|
91
|
+
role: "system",
|
|
92
|
+
content: `Error: ${errorMessage}`,
|
|
93
|
+
},
|
|
94
|
+
])
|
|
95
|
+
onLog(`${providerName} error: ${errorMessage}`)
|
|
96
|
+
} finally {
|
|
97
|
+
setIsLoading(false)
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Render messages with scrolling
|
|
102
|
+
const renderMessages = () => {
|
|
103
|
+
const start = Math.max(0, messages.length - maxMessageLines - scrollOffset)
|
|
104
|
+
const end = messages.length - scrollOffset
|
|
105
|
+
const visibleMessages = messages.slice(start, end)
|
|
106
|
+
|
|
107
|
+
return visibleMessages.map((msg, idx) => {
|
|
108
|
+
let color: string
|
|
109
|
+
let prefix: string
|
|
110
|
+
|
|
111
|
+
switch (msg.role) {
|
|
112
|
+
case "user":
|
|
113
|
+
color = "cyan"
|
|
114
|
+
prefix = "You: "
|
|
115
|
+
break
|
|
116
|
+
case "assistant":
|
|
117
|
+
color = "green"
|
|
118
|
+
prefix = `${providerName}: `
|
|
119
|
+
break
|
|
120
|
+
default:
|
|
121
|
+
color = "yellow"
|
|
122
|
+
prefix = ""
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
return (
|
|
126
|
+
<Box key={start + idx} flexDirection="column" marginBottom={1}>
|
|
127
|
+
<Text color={color} bold>
|
|
128
|
+
{prefix}
|
|
129
|
+
</Text>
|
|
130
|
+
<Text wrap="wrap">{msg.content}</Text>
|
|
131
|
+
</Box>
|
|
132
|
+
)
|
|
133
|
+
})
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Get border color based on provider
|
|
137
|
+
const getBorderColor = (): string => {
|
|
138
|
+
switch (aiService.getProvider()) {
|
|
139
|
+
case "claude":
|
|
140
|
+
return "magenta"
|
|
141
|
+
case "codex":
|
|
142
|
+
return "green"
|
|
143
|
+
case "gemini":
|
|
144
|
+
return "blue"
|
|
145
|
+
default:
|
|
146
|
+
return "gray"
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
const borderColor = getBorderColor()
|
|
151
|
+
|
|
152
|
+
return (
|
|
153
|
+
<Box
|
|
154
|
+
flexDirection="column"
|
|
155
|
+
height="100%"
|
|
156
|
+
borderStyle="double"
|
|
157
|
+
borderColor={borderColor}
|
|
158
|
+
>
|
|
159
|
+
<Box paddingX={1} justifyContent="space-between">
|
|
160
|
+
<Text bold color={borderColor}>
|
|
161
|
+
{providerName} AI Assistant
|
|
162
|
+
</Text>
|
|
163
|
+
<Text color="gray" dimColor>
|
|
164
|
+
Esc to close · /ai model to switch
|
|
165
|
+
</Text>
|
|
166
|
+
</Box>
|
|
167
|
+
|
|
168
|
+
<Box flexDirection="column" flexGrow={1} paddingX={1} overflow="hidden">
|
|
169
|
+
{messages.length > maxMessageLines + scrollOffset && (
|
|
170
|
+
<Text color="gray" dimColor>
|
|
171
|
+
... {messages.length - maxMessageLines - scrollOffset} earlier
|
|
172
|
+
messages
|
|
173
|
+
</Text>
|
|
174
|
+
)}
|
|
175
|
+
{renderMessages()}
|
|
176
|
+
{scrollOffset > 0 && (
|
|
177
|
+
<Text color="gray" dimColor>
|
|
178
|
+
... {scrollOffset} newer messages below
|
|
179
|
+
</Text>
|
|
180
|
+
)}
|
|
181
|
+
</Box>
|
|
182
|
+
|
|
183
|
+
<Box borderStyle="single" borderColor="gray" paddingX={1}>
|
|
184
|
+
{isLoading ? (
|
|
185
|
+
<Text color="yellow">Thinking...</Text>
|
|
186
|
+
) : (
|
|
187
|
+
<Box>
|
|
188
|
+
<Text color={borderColor}>> </Text>
|
|
189
|
+
<TextInput
|
|
190
|
+
value={input}
|
|
191
|
+
onChange={setInput}
|
|
192
|
+
onSubmit={handleSubmit}
|
|
193
|
+
placeholder={`Ask ${providerName} something...`}
|
|
194
|
+
/>
|
|
195
|
+
</Box>
|
|
196
|
+
)}
|
|
197
|
+
</Box>
|
|
198
|
+
</Box>
|
|
199
|
+
)
|
|
180
200
|
}
|