repoburg 1.2.1 → 1.2.2

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.
Files changed (152) hide show
  1. package/CODEMAP.md +27 -2
  2. package/backend/.env +2 -1
  3. package/backend/dist/src/app.module.js +2 -0
  4. package/backend/dist/src/app.module.js.map +1 -1
  5. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.d.ts +1 -1
  6. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js +18 -0
  7. package/backend/dist/src/seeding/data/system-prompts/default_master-agent.js.map +1 -1
  8. package/backend/dist/src/visual-editor/visual-editor.controller.d.ts +14 -0
  9. package/backend/dist/src/visual-editor/visual-editor.controller.js +86 -0
  10. package/backend/dist/src/visual-editor/visual-editor.controller.js.map +1 -0
  11. package/backend/dist/src/visual-editor/visual-editor.dto.d.ts +5 -0
  12. package/backend/dist/src/visual-editor/visual-editor.dto.js +32 -0
  13. package/backend/dist/src/visual-editor/visual-editor.dto.js.map +1 -0
  14. package/backend/dist/src/visual-editor/visual-editor.module.d.ts +2 -0
  15. package/backend/dist/src/visual-editor/visual-editor.module.js +24 -0
  16. package/backend/dist/src/visual-editor/visual-editor.module.js.map +1 -0
  17. package/backend/dist/tsconfig.build.tsbuildinfo +1 -1
  18. package/client/dist/main.js +2 -0
  19. package/package.json +5 -3
  20. package/platform-cli.js +51 -0
  21. package/visual-editor-proxy/client/dist/main.js +89 -0
  22. package/visual-editor-proxy/client/tsconfig.json +14 -0
  23. package/visual-editor-proxy/dist/client/src/inspector.d.ts +9 -0
  24. package/visual-editor-proxy/dist/client/src/inspector.js +96 -0
  25. package/visual-editor-proxy/dist/client/src/inspector.js.map +1 -0
  26. package/visual-editor-proxy/dist/client/src/main.d.ts +6 -0
  27. package/visual-editor-proxy/dist/client/src/main.js +108 -0
  28. package/visual-editor-proxy/dist/client/src/main.js.map +1 -0
  29. package/visual-editor-proxy/dist/client/src/ui.d.ts +6 -0
  30. package/visual-editor-proxy/dist/client/src/ui.js +153 -0
  31. package/visual-editor-proxy/dist/client/src/ui.js.map +1 -0
  32. package/visual-editor-proxy/dist/main.d.ts +1 -0
  33. package/visual-editor-proxy/dist/main.js +61 -0
  34. package/visual-editor-proxy/dist/main.js.map +1 -0
  35. package/visual-editor-proxy/dist/src/main.d.ts +1 -0
  36. package/visual-editor-proxy/dist/src/main.js +61 -0
  37. package/visual-editor-proxy/dist/src/main.js.map +1 -0
  38. package/visual-editor-proxy/dist/tsconfig.tsbuildinfo +1 -0
  39. package/visual-editor-proxy/node_modules/@types/node/LICENSE +21 -0
  40. package/visual-editor-proxy/node_modules/@types/node/README.md +15 -0
  41. package/visual-editor-proxy/node_modules/@types/node/assert/strict.d.ts +8 -0
  42. package/visual-editor-proxy/node_modules/@types/node/assert.d.ts +1062 -0
  43. package/visual-editor-proxy/node_modules/@types/node/async_hooks.d.ts +605 -0
  44. package/visual-editor-proxy/node_modules/@types/node/buffer.buffer.d.ts +462 -0
  45. package/visual-editor-proxy/node_modules/@types/node/buffer.d.ts +1932 -0
  46. package/visual-editor-proxy/node_modules/@types/node/child_process.d.ts +1458 -0
  47. package/visual-editor-proxy/node_modules/@types/node/cluster.d.ts +577 -0
  48. package/visual-editor-proxy/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
  49. package/visual-editor-proxy/node_modules/@types/node/compatibility/index.d.ts +9 -0
  50. package/visual-editor-proxy/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
  51. package/visual-editor-proxy/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
  52. package/visual-editor-proxy/node_modules/@types/node/console.d.ts +452 -0
  53. package/visual-editor-proxy/node_modules/@types/node/constants.d.ts +21 -0
  54. package/visual-editor-proxy/node_modules/@types/node/crypto.d.ts +4570 -0
  55. package/visual-editor-proxy/node_modules/@types/node/dgram.d.ts +596 -0
  56. package/visual-editor-proxy/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
  57. package/visual-editor-proxy/node_modules/@types/node/dns/promises.d.ts +479 -0
  58. package/visual-editor-proxy/node_modules/@types/node/dns.d.ts +871 -0
  59. package/visual-editor-proxy/node_modules/@types/node/domain.d.ts +170 -0
  60. package/visual-editor-proxy/node_modules/@types/node/events.d.ts +977 -0
  61. package/visual-editor-proxy/node_modules/@types/node/fs/promises.d.ts +1248 -0
  62. package/visual-editor-proxy/node_modules/@types/node/fs.d.ts +4362 -0
  63. package/visual-editor-proxy/node_modules/@types/node/globals.d.ts +172 -0
  64. package/visual-editor-proxy/node_modules/@types/node/globals.typedarray.d.ts +21 -0
  65. package/visual-editor-proxy/node_modules/@types/node/http.d.ts +2030 -0
  66. package/visual-editor-proxy/node_modules/@types/node/http2.d.ts +2624 -0
  67. package/visual-editor-proxy/node_modules/@types/node/https.d.ts +546 -0
  68. package/visual-editor-proxy/node_modules/@types/node/index.d.ts +93 -0
  69. package/visual-editor-proxy/node_modules/@types/node/inspector.generated.d.ts +3966 -0
  70. package/visual-editor-proxy/node_modules/@types/node/module.d.ts +539 -0
  71. package/visual-editor-proxy/node_modules/@types/node/net.d.ts +1011 -0
  72. package/visual-editor-proxy/node_modules/@types/node/os.d.ts +505 -0
  73. package/visual-editor-proxy/node_modules/@types/node/package.json +140 -0
  74. package/visual-editor-proxy/node_modules/@types/node/path.d.ts +200 -0
  75. package/visual-editor-proxy/node_modules/@types/node/perf_hooks.d.ts +961 -0
  76. package/visual-editor-proxy/node_modules/@types/node/process.d.ts +1944 -0
  77. package/visual-editor-proxy/node_modules/@types/node/punycode.d.ts +117 -0
  78. package/visual-editor-proxy/node_modules/@types/node/querystring.d.ts +152 -0
  79. package/visual-editor-proxy/node_modules/@types/node/readline/promises.d.ts +162 -0
  80. package/visual-editor-proxy/node_modules/@types/node/readline.d.ts +589 -0
  81. package/visual-editor-proxy/node_modules/@types/node/repl.d.ts +430 -0
  82. package/visual-editor-proxy/node_modules/@types/node/sea.d.ts +153 -0
  83. package/visual-editor-proxy/node_modules/@types/node/stream/consumers.d.ts +38 -0
  84. package/visual-editor-proxy/node_modules/@types/node/stream/promises.d.ts +90 -0
  85. package/visual-editor-proxy/node_modules/@types/node/stream/web.d.ts +533 -0
  86. package/visual-editor-proxy/node_modules/@types/node/stream.d.ts +1675 -0
  87. package/visual-editor-proxy/node_modules/@types/node/string_decoder.d.ts +67 -0
  88. package/visual-editor-proxy/node_modules/@types/node/test.d.ts +1787 -0
  89. package/visual-editor-proxy/node_modules/@types/node/timers/promises.d.ts +108 -0
  90. package/visual-editor-proxy/node_modules/@types/node/timers.d.ts +286 -0
  91. package/visual-editor-proxy/node_modules/@types/node/tls.d.ts +1231 -0
  92. package/visual-editor-proxy/node_modules/@types/node/trace_events.d.ts +197 -0
  93. package/visual-editor-proxy/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +460 -0
  94. package/visual-editor-proxy/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
  95. package/visual-editor-proxy/node_modules/@types/node/ts5.6/index.d.ts +93 -0
  96. package/visual-editor-proxy/node_modules/@types/node/tty.d.ts +208 -0
  97. package/visual-editor-proxy/node_modules/@types/node/url.d.ts +964 -0
  98. package/visual-editor-proxy/node_modules/@types/node/util.d.ts +2331 -0
  99. package/visual-editor-proxy/node_modules/@types/node/v8.d.ts +808 -0
  100. package/visual-editor-proxy/node_modules/@types/node/vm.d.ts +1000 -0
  101. package/visual-editor-proxy/node_modules/@types/node/wasi.d.ts +181 -0
  102. package/visual-editor-proxy/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
  103. package/visual-editor-proxy/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
  104. package/visual-editor-proxy/node_modules/@types/node/web-globals/events.d.ts +97 -0
  105. package/visual-editor-proxy/node_modules/@types/node/web-globals/fetch.d.ts +46 -0
  106. package/visual-editor-proxy/node_modules/@types/node/worker_threads.d.ts +715 -0
  107. package/visual-editor-proxy/node_modules/@types/node/zlib.d.ts +539 -0
  108. package/visual-editor-proxy/node_modules/undici-types/LICENSE +21 -0
  109. package/visual-editor-proxy/node_modules/undici-types/README.md +6 -0
  110. package/visual-editor-proxy/node_modules/undici-types/agent.d.ts +31 -0
  111. package/visual-editor-proxy/node_modules/undici-types/api.d.ts +43 -0
  112. package/visual-editor-proxy/node_modules/undici-types/balanced-pool.d.ts +29 -0
  113. package/visual-editor-proxy/node_modules/undici-types/cache.d.ts +36 -0
  114. package/visual-editor-proxy/node_modules/undici-types/client.d.ts +108 -0
  115. package/visual-editor-proxy/node_modules/undici-types/connector.d.ts +34 -0
  116. package/visual-editor-proxy/node_modules/undici-types/content-type.d.ts +21 -0
  117. package/visual-editor-proxy/node_modules/undici-types/cookies.d.ts +28 -0
  118. package/visual-editor-proxy/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
  119. package/visual-editor-proxy/node_modules/undici-types/dispatcher.d.ts +256 -0
  120. package/visual-editor-proxy/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
  121. package/visual-editor-proxy/node_modules/undici-types/errors.d.ts +149 -0
  122. package/visual-editor-proxy/node_modules/undici-types/eventsource.d.ts +61 -0
  123. package/visual-editor-proxy/node_modules/undici-types/fetch.d.ts +209 -0
  124. package/visual-editor-proxy/node_modules/undici-types/file.d.ts +39 -0
  125. package/visual-editor-proxy/node_modules/undici-types/filereader.d.ts +54 -0
  126. package/visual-editor-proxy/node_modules/undici-types/formdata.d.ts +108 -0
  127. package/visual-editor-proxy/node_modules/undici-types/global-dispatcher.d.ts +9 -0
  128. package/visual-editor-proxy/node_modules/undici-types/global-origin.d.ts +7 -0
  129. package/visual-editor-proxy/node_modules/undici-types/handlers.d.ts +15 -0
  130. package/visual-editor-proxy/node_modules/undici-types/header.d.ts +4 -0
  131. package/visual-editor-proxy/node_modules/undici-types/index.d.ts +71 -0
  132. package/visual-editor-proxy/node_modules/undici-types/interceptors.d.ts +17 -0
  133. package/visual-editor-proxy/node_modules/undici-types/mock-agent.d.ts +50 -0
  134. package/visual-editor-proxy/node_modules/undici-types/mock-client.d.ts +25 -0
  135. package/visual-editor-proxy/node_modules/undici-types/mock-errors.d.ts +12 -0
  136. package/visual-editor-proxy/node_modules/undici-types/mock-interceptor.d.ts +93 -0
  137. package/visual-editor-proxy/node_modules/undici-types/mock-pool.d.ts +25 -0
  138. package/visual-editor-proxy/node_modules/undici-types/package.json +55 -0
  139. package/visual-editor-proxy/node_modules/undici-types/patch.d.ts +33 -0
  140. package/visual-editor-proxy/node_modules/undici-types/pool-stats.d.ts +19 -0
  141. package/visual-editor-proxy/node_modules/undici-types/pool.d.ts +39 -0
  142. package/visual-editor-proxy/node_modules/undici-types/proxy-agent.d.ts +28 -0
  143. package/visual-editor-proxy/node_modules/undici-types/readable.d.ts +65 -0
  144. package/visual-editor-proxy/node_modules/undici-types/retry-agent.d.ts +8 -0
  145. package/visual-editor-proxy/node_modules/undici-types/retry-handler.d.ts +116 -0
  146. package/visual-editor-proxy/node_modules/undici-types/util.d.ts +18 -0
  147. package/visual-editor-proxy/node_modules/undici-types/webidl.d.ts +228 -0
  148. package/visual-editor-proxy/node_modules/undici-types/websocket.d.ts +150 -0
  149. package/visual-editor-proxy/package.json +21 -0
  150. package/visual-editor-proxy/tsconfig.json +21 -0
  151. package/backend/orchestration-test-2.txt +0 -1
  152. package/backend/orchestration-test.txt +0 -1
@@ -0,0 +1,2 @@
1
+ // This is the main entry point for the client application.
2
+ // It will be bundled and served to the browser.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repoburg",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "description": "A local AI-powered software developer assistant that runs on your own machine.",
5
5
  "author": "Celal Ertug",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -12,7 +12,8 @@
12
12
  "frontend",
13
13
  "backend",
14
14
  "website",
15
- "daemon"
15
+ "daemon",
16
+ "visual-editor-proxy"
16
17
  ],
17
18
  "bin": {
18
19
  "repoburg": "./platform-cli.js",
@@ -31,7 +32,7 @@
31
32
  "dev:daemon": "npm run dev -w daemon",
32
33
  "jaeger:start": "docker run -d --rm --name jaeger -e COLLECTOR_OTLP_ENABLED=true -p 16686:16686 -p 4318:4318 jaegertracing/all-in-one:latest",
33
34
  "jaeger:stop": "docker stop jaeger",
34
- "lo:build": "npm run build -w backend && npm run build -w frontend && npm run build -w website && npm run build -w daemon",
35
+ "lo:build": "npm run build -w backend && npm run build -w frontend && npm run build -w website && npm run build -w daemon && npm run build -w visual-editor-proxy",
35
36
  "lo:publish": "npm publish"
36
37
  },
37
38
  "dependencies": {
@@ -57,6 +58,7 @@
57
58
  "fs-extra": "^11.2.0",
58
59
  "glob": "^10.3.10",
59
60
  "gpt-tokenizer": "^3.0.1",
61
+ "http-proxy-middleware": "^3.0.0",
60
62
  "jose": "^5.6.3",
61
63
  "libphonenumber-js": "^1.12.10",
62
64
  "mermaid": "^11.10.1",
package/platform-cli.js CHANGED
@@ -180,6 +180,57 @@ program
180
180
  }
181
181
  });
182
182
 
183
+ program
184
+ .command('start-live')
185
+ .description('Start the Visual Editor proxy for a live frontend application.')
186
+ .requiredOption('-u, --url <url>', 'The URL of the target application (e.g., http://localhost:5173)')
187
+ .action(async (options) => {
188
+ const { default: chalk } = await import('chalk');
189
+
190
+ // 1. Get active backend port from daemon
191
+ let backendPort;
192
+ try {
193
+ const response = await axios.get(`${DAEMON_BASE_URL}/registry/get-active-port`);
194
+ backendPort = response.data.port;
195
+ if (!backendPort) {
196
+ // This will be caught by the catch block
197
+ throw new Error('No active port returned from daemon.');
198
+ }
199
+ console.log(chalk.green(`✓ Found active Repoburg backend on port ${backendPort}`));
200
+ } catch (error) {
201
+ console.error(chalk.red('Could not find an active Repoburg backend service.'));
202
+ console.error(chalk.yellow('Please start a service first with `repoburg start`.'));
203
+ process.exit(1);
204
+ }
205
+
206
+ // 2. Spawn the proxy server process
207
+ const proxyPath = path.resolve(__dirname, 'visual-editor-proxy');
208
+ console.log(chalk.cyan(`Starting Visual Editor proxy for: ${options.url}`));
209
+
210
+ const child = spawn('npm', ['run', 'dev'], {
211
+ cwd: proxyPath,
212
+ stdio: 'inherit', // Pipe output to the parent terminal
213
+ shell: true,
214
+ env: {
215
+ ...process.env,
216
+ TARGET_URL: options.url,
217
+ BACKEND_PORT: backendPort,
218
+ }
219
+ });
220
+
221
+ child.on('error', (error) => {
222
+ console.error(chalk.red(`Failed to start Visual Editor proxy:`));
223
+ console.error(error);
224
+ process.exit(1);
225
+ });
226
+
227
+ child.on('exit', (code, signal) => {
228
+ if (code !== 0) {
229
+ console.log(chalk.yellow(`Visual Editor proxy process exited with code ${code} and signal ${signal}`));
230
+ }
231
+ });
232
+ });
233
+
183
234
  program
184
235
  .command('stop <name>')
185
236
  .alias('st')
@@ -0,0 +1,89 @@
1
+ "use strict";(()=>{function m(e,t=new WeakSet){if(e==null)return e;if(typeof e=="function")return`[Function: ${e.name||"anonymous"}]`;if(typeof e!="object")return e;if(e.$$typeof&&typeof e.$$typeof=="symbol")return`[ReactElement: <${e.type?.displayName||e.type?.name||(typeof e.type=="string"?e.type:"ReactElement")}>]`;if(t.has(e))return"[Circular Reference]";if(t.add(e),Array.isArray(e))return e.map(o=>m(o,t));let n={};for(let o in e)if(Object.prototype.hasOwnProperty.call(e,o)){if(o==="className")continue;n[o]=m(e[o],t)}return n}function g(e){if(e===null||typeof e!="object")return e;if(Array.isArray(e))return e.map(g);let t={};for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let o=e[n];o!==null&&(t[n]=g(o))}return t}function $(e){let t=Object.keys(e).find(n=>n.startsWith("__reactFiber$"));return t?e[t]:null}function I(e){let t=e.elementType;return t?typeof t=="string"?t:t.displayName||t.name||"Anonymous":"FiberRoot"}function y(e){let t=$(e);if(!t)return{error:"Could not find React Fiber for the selected element."};let n=[];for(;t;){let s=t.elementType;if(typeof s=="function"||typeof s=="string"){let d=I(t);n.push({name:d,props:m(t.memoizedProps),state:m(t.memoizedState)})}t=t.return}return n.length===0?{error:"Could not identify any components or elements in this element's hierarchy."}:{hierarchy:n.map(s=>({...s,props:g(s.props),state:g(s.state)}))}}var x;function v(){let e=document.createElement("style");e.textContent=`
2
+ #repoburg-float-btn {
3
+ position: fixed;
4
+ bottom: 20px;
5
+ right: 20px;
6
+ background-color: #7c3aed;
7
+ color: white;
8
+ border: none;
9
+ border-radius: 50%;
10
+ width: 60px;
11
+ height: 60px;
12
+ font-size: 12px;
13
+ font-weight: bold;
14
+ cursor: pointer;
15
+ box-shadow: 0 4px 12px rgba(0,0,0,0.2);
16
+ z-index: 999999;
17
+ display: flex;
18
+ align-items: center;
19
+ justify-content: center;
20
+ transition: transform 0.2s ease, background-color 0.2s ease;
21
+ }
22
+ #repoburg-float-btn:hover {
23
+ transform: scale(1.1);
24
+ }
25
+ #repoburg-float-btn:disabled {
26
+ background-color: #585858;
27
+ cursor: not-allowed;
28
+ transform: none;
29
+ }
30
+ #repoburg-float-btn.active {
31
+ background-color: #c026d3;
32
+ }
33
+ .repoburg-highlight {
34
+ outline: 2px dashed #c026d3 !important;
35
+ box-shadow: 0 0 10px rgba(192, 38, 211, 0.5) !important;
36
+ background-color: rgba(192, 38, 211, 0.1) !important;
37
+ }
38
+ #repoburg-modal-overlay {
39
+ position: fixed;
40
+ top: 0; left: 0; width: 100%; height: 100%;
41
+ background-color: rgba(0,0,0,0.5);
42
+ z-index: 1000000;
43
+ display: flex;
44
+ align-items: center;
45
+ justify-content: center;
46
+ }
47
+ #repoburg-modal {
48
+ background-color: #2d3748;
49
+ color: #e2e8f0;
50
+ padding: 24px;
51
+ border-radius: 8px;
52
+ width: 90%;
53
+ max-width: 600px;
54
+ box-shadow: 0 5px 15px rgba(0,0,0,0.3);
55
+ }
56
+ #repoburg-modal-header { font-size: 1.25rem; font-weight: bold; margin-bottom: 16px; }
57
+ #repoburg-modal-textarea { width: 100%; background-color: #1a202c; color: white; border-radius: 4px; padding: 8px; min-height: 150px; border: 1px solid #4a5568; margin-bottom: 16px; }
58
+ #repoburg-modal-footer { display: flex; justify-content: flex-end; gap: 8px; }
59
+ .repoburg-modal-btn { padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; }
60
+ .repoburg-modal-btn-primary { background-color: #7c3aed; color: white; }
61
+ .repoburg-modal-btn-secondary { background-color: #4a5568; color: white; }
62
+ #repoburg-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #1a202c; color: white; padding: 12px 20px; border-radius: 6px; z-index: 1000001; opacity: 0; transition: opacity 0.3s ease; text-align: center; }
63
+ #repoburg-toast.show { opacity: 1; }
64
+ #repoburg-toast.error { background-color: #c53030; }
65
+ `,document.head.appendChild(e)}function w(e){let t=document.createElement("button");return t.id="repoburg-float-btn",t.textContent="Repo",t.onclick=e,document.body.appendChild(t),t}function E(){let e=document.createElement("div");e.id="repoburg-toast",document.body.appendChild(e)}function k(e,t,n){let o=document.createElement("div");o.id="repoburg-modal-overlay";let s=e[0],d=e.length>1?e[1]:void 0,b=d?d.name:"N/A",h=e.map(a=>a.name).reverse().join(" > ");o.innerHTML=`
66
+ <div id="repoburg-modal">
67
+ <div id="repoburg-modal-header">Edit Component</div>
68
+ <p style="font-size: 0.9rem; margin-bottom: 8px;"><strong>Component:</strong> ${s.name}</p>
69
+ <p style="font-size: 0.9rem; margin-bottom: 16px;"><strong>Parent Context:</strong> ${b}</p>
70
+ <p style="font-size: 0.8rem; margin-bottom: 8px; word-break: break-all; opacity: 0.7;"><strong>Path:</strong> ${h}</p>
71
+ <p style="font-size: 0.8rem; margin-bottom: 16px; word-break: break-all; opacity: 0.7;"><strong>URL:</strong> ${t}</p>
72
+ <textarea id="repoburg-modal-textarea" placeholder="Enter your prompt... (e.g., 'add a confirmation icon to this button')"></textarea>
73
+ <div id="repoburg-modal-footer">
74
+ <button id="repoburg-modal-cancel" class="repoburg-modal-btn repoburg-modal-btn-secondary">Cancel</button>
75
+ <button id="repoburg-modal-submit" class="repoburg-modal-btn repoburg-modal-btn-primary">Submit</button>
76
+ </div>
77
+ </div>
78
+ `,document.body.appendChild(o);let u=document.getElementById("repoburg-modal-textarea"),r=document.getElementById("repoburg-modal-submit");u.focus();let c=a=>{a.key==="Escape"&&l(),a.key==="Enter"&&(a.metaKey||a.ctrlKey)&&(a.preventDefault(),r.click())};document.addEventListener("keydown",c);let l=()=>{document.removeEventListener("keydown",c),o.remove()};document.getElementById("repoburg-modal-cancel").onclick=l,o.onclick=a=>{a.target===o&&l()},r.onclick=async()=>{let a=u.value;a.trim()&&(await n(a,e,t),l())}}function p(e,t="success",n=3e3){let o=document.getElementById("repoburg-toast");o&&(o.textContent=e,o.className=t==="error"?"error":"",o.classList.add("show"),clearTimeout(x),x=window.setTimeout(()=>{o.classList.remove("show")},n))}var f=!1,i=null;function C(e){i&&i.classList.remove("repoburg-highlight"),i=e.target,i.classList.add("repoburg-highlight")}function T(){i&&(i.classList.remove("repoburg-highlight"),i=null)}function L(e){if(e.preventDefault(),e.stopPropagation(),P(),!i)return;let t=y(i);t.error||!t.hierarchy?p(t.error||"Unknown error","error"):k(t.hierarchy,window.location.href,O)}function P(){f=!f;let e=document.getElementById("repoburg-float-btn");f?(e.classList.add("active"),e.textContent="Exit",document.addEventListener("mouseover",C),document.addEventListener("mouseout",T),document.addEventListener("click",L,!0)):(e.classList.remove("active"),e.textContent="Repo",i&&i.classList.remove("repoburg-highlight"),document.removeEventListener("mouseover",C),document.removeEventListener("mouseout",T),document.removeEventListener("click",L,!0))}async function O(e,t,n){let o=window.REPOBURG_BACKEND_PORT;if(!o){p("Repoburg backend port not found.","error");return}let s=t.slice().reverse().map((r,c)=>{let l=" ".repeat(c),a=JSON.stringify(r.props),R=r.state&&Object.keys(r.state).length>0?`, state: ${JSON.stringify(r.state)}`:"";return`${l}- ${r.name} (props: ${a}${R})`}).join(`
79
+ `),u={prompt:`${`--- Visual Inspector Context ---
80
+ URL: ${n}
81
+
82
+ This data structure is a React Component Tree, representing the hierarchy of components from the application's root down to the element the user selected. The indentation signifies the parent-child nesting relationship. Each line contains the component/element name, its 'props' (data passed down to it), and its 'state' (internal data it manages). As an AI agent, use this structural and data context to understand the application's architecture and the flow of information related to the user's request. The last element in the list is the user's direct target.
83
+
84
+ Component Hierarchy:
85
+ ${s}
86
+
87
+ --- User Prompt ---`}
88
+
89
+ ${e}`,componentPath:"",parentComponentPath:void 0};try{let r=await fetch(`http://localhost:${o}/visual-editor/submit`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(u)});if(!r.ok){let c=await r.json().catch(()=>({message:"Failed to submit prompt"}));throw new Error(c.message)}p("Prompt submitted successfully!")}catch(r){console.error("Repoburg Error:",r),p(r instanceof Error?r.message:String(r),"error")}}function B(){document.getElementById("repoburg-float-btn")||(console.log("Repoburg Visual Editor: Initializing UI."),console.log("Repoburg Backend Port:",window.REPOBURG_BACKEND_PORT||"Not Set"),v(),E(),w(P))}B();})();
@@ -0,0 +1,14 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ESNext",
4
+ "module": "ESNext",
5
+ "strict": true,
6
+ "esModuleInterop": true,
7
+ "skipLibCheck": true,
8
+ "forceConsistentCasingInFileNames": true,
9
+ "outDir": "./dist",
10
+ "rootDir": "./src",
11
+ "lib": ["DOM", "ESNext"]
12
+ },
13
+ "include": ["src/**/*.ts"]
14
+ }
@@ -0,0 +1,9 @@
1
+ export interface ComponentInfo {
2
+ name: string;
3
+ props: any;
4
+ state: any;
5
+ }
6
+ export declare function getComponentTreeFromElement(element: HTMLElement): {
7
+ hierarchy?: ComponentInfo[];
8
+ error?: string;
9
+ };
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getComponentTreeFromElement = getComponentTreeFromElement;
4
+ function serializeComplexObject(obj, seen = new WeakSet()) {
5
+ if (obj === null || obj === undefined) {
6
+ return obj;
7
+ }
8
+ if (typeof obj === 'function') {
9
+ return `[Function: ${obj.name || 'anonymous'}]`;
10
+ }
11
+ if (typeof obj !== 'object') {
12
+ return obj;
13
+ }
14
+ if (obj.$$typeof && typeof obj.$$typeof === 'symbol') {
15
+ const componentName = obj.type?.displayName || obj.type?.name || (typeof obj.type === 'string' ? obj.type : 'ReactElement');
16
+ return `[ReactElement: <${componentName}>]`;
17
+ }
18
+ if (seen.has(obj)) {
19
+ return '[Circular Reference]';
20
+ }
21
+ seen.add(obj);
22
+ if (Array.isArray(obj)) {
23
+ return obj.map(item => serializeComplexObject(item, seen));
24
+ }
25
+ const newObj = {};
26
+ for (const key in obj) {
27
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
28
+ if (key === 'className') {
29
+ continue;
30
+ }
31
+ newObj[key] = serializeComplexObject(obj[key], seen);
32
+ }
33
+ }
34
+ return newObj;
35
+ }
36
+ function cleanupNullValues(obj) {
37
+ if (obj === null || typeof obj !== 'object') {
38
+ return obj;
39
+ }
40
+ if (Array.isArray(obj)) {
41
+ return obj.map(cleanupNullValues);
42
+ }
43
+ const newObj = {};
44
+ for (const key in obj) {
45
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
46
+ const value = obj[key];
47
+ if (value !== null) {
48
+ newObj[key] = cleanupNullValues(value);
49
+ }
50
+ }
51
+ }
52
+ return newObj;
53
+ }
54
+ function getFiberFromElement(element) {
55
+ const fiberKey = Object.keys(element).find(key => key.startsWith('__reactFiber$'));
56
+ return fiberKey ? element[fiberKey] : null;
57
+ }
58
+ function getComponentName(fiber) {
59
+ const componentType = fiber.elementType;
60
+ if (!componentType) {
61
+ return 'FiberRoot';
62
+ }
63
+ if (typeof componentType === 'string') {
64
+ return componentType;
65
+ }
66
+ return componentType.displayName || componentType.name || 'Anonymous';
67
+ }
68
+ function getComponentTreeFromElement(element) {
69
+ let fiber = getFiberFromElement(element);
70
+ if (!fiber) {
71
+ return { error: 'Could not find React Fiber for the selected element.' };
72
+ }
73
+ const hierarchy = [];
74
+ while (fiber) {
75
+ const elementType = fiber.elementType;
76
+ if (typeof elementType === 'function' || typeof elementType === 'string') {
77
+ const name = getComponentName(fiber);
78
+ hierarchy.push({
79
+ name,
80
+ props: serializeComplexObject(fiber.memoizedProps),
81
+ state: serializeComplexObject(fiber.memoizedState),
82
+ });
83
+ }
84
+ fiber = fiber.return;
85
+ }
86
+ if (hierarchy.length === 0) {
87
+ return { error: 'Could not identify any components or elements in this element\'s hierarchy.' };
88
+ }
89
+ const cleanedHierarchy = hierarchy.map(item => ({
90
+ ...item,
91
+ props: cleanupNullValues(item.props),
92
+ state: cleanupNullValues(item.state),
93
+ }));
94
+ return { hierarchy: cleanedHierarchy };
95
+ }
96
+ //# sourceMappingURL=inspector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspector.js","sourceRoot":"","sources":["../../../client/src/inspector.ts"],"names":[],"mappings":";;AAyGA,kEAsCC;AApID,SAAS,sBAAsB,CAAC,GAAQ,EAAE,IAAI,GAAG,IAAI,OAAO,EAAE;IAC1D,IAAI,GAAG,KAAK,IAAI,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACpC,OAAO,GAAG,CAAC;IACf,CAAC;IAGD,IAAI,OAAO,GAAG,KAAK,UAAU,EAAE,CAAC;QAC5B,OAAO,cAAc,GAAG,CAAC,IAAI,IAAI,WAAW,GAAG,CAAC;IACpD,CAAC;IAGD,IAAI,OAAO,GAAG,KAAK,QAAQ,EAAE,CAAC;QAC1B,OAAO,GAAG,CAAC;IACf,CAAC;IAGD,IAAI,GAAG,CAAC,QAAQ,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QACnD,MAAM,aAAa,GAAG,GAAG,CAAC,IAAI,EAAE,WAAW,IAAI,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,CAAC,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC;QAC5H,OAAO,mBAAmB,aAAa,IAAI,CAAC;IAChD,CAAC;IAGD,IAAI,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAChB,OAAO,sBAAsB,CAAC;IAClC,CAAC;IAC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,aAAa,CAAC;gBAClD,KAAK,EAAE,sBAAsB,CAAC,KAAK,CAAC,aAAa,CAAC;aACrD,CAAC,CAAC;QACP,CAAC;QAED,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC;IACzB,CAAC;IAED,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,EAAE,KAAK,EAAE,6EAA6E,EAAE,CAAC;IACpG,CAAC;IAGD,MAAM,gBAAgB,GAAG,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAC5C,GAAG,IAAI;QACP,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;QACpC,KAAK,EAAE,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC;KACvC,CAAC,CAAC,CAAC;IAEJ,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,CAAC;AAC3C,CAAC"}
@@ -0,0 +1,6 @@
1
+ declare global {
2
+ interface Window {
3
+ REPOBURG_BACKEND_PORT?: number;
4
+ }
5
+ }
6
+ export {};
@@ -0,0 +1,108 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const inspector_1 = require("./inspector");
4
+ const ui_1 = require("./ui");
5
+ let isSelectorModeActive = false;
6
+ let currentHoveredElement = null;
7
+ function handleMouseOver(e) {
8
+ if (currentHoveredElement) {
9
+ currentHoveredElement.classList.remove('repoburg-highlight');
10
+ }
11
+ currentHoveredElement = e.target;
12
+ currentHoveredElement.classList.add('repoburg-highlight');
13
+ }
14
+ function handleMouseOut() {
15
+ if (currentHoveredElement) {
16
+ currentHoveredElement.classList.remove('repoburg-highlight');
17
+ currentHoveredElement = null;
18
+ }
19
+ }
20
+ function handleClick(e) {
21
+ e.preventDefault();
22
+ e.stopPropagation();
23
+ toggleSelectorMode();
24
+ if (!currentHoveredElement)
25
+ return;
26
+ const result = (0, inspector_1.getComponentTreeFromElement)(currentHoveredElement);
27
+ if (result.error || !result.hierarchy) {
28
+ (0, ui_1.showToast)(result.error || 'Unknown error', 'error');
29
+ }
30
+ else {
31
+ (0, ui_1.showPromptModal)(result.hierarchy, window.location.href, submitPrompt);
32
+ }
33
+ }
34
+ function toggleSelectorMode() {
35
+ isSelectorModeActive = !isSelectorModeActive;
36
+ const button = document.getElementById('repoburg-float-btn');
37
+ if (isSelectorModeActive) {
38
+ button.classList.add('active');
39
+ button.textContent = 'Exit';
40
+ document.addEventListener('mouseover', handleMouseOver);
41
+ document.addEventListener('mouseout', handleMouseOut);
42
+ document.addEventListener('click', handleClick, true);
43
+ }
44
+ else {
45
+ button.classList.remove('active');
46
+ button.textContent = 'Repo';
47
+ if (currentHoveredElement) {
48
+ currentHoveredElement.classList.remove('repoburg-highlight');
49
+ }
50
+ document.removeEventListener('mouseover', handleMouseOver);
51
+ document.removeEventListener('mouseout', handleMouseOut);
52
+ document.removeEventListener('click', handleClick, true);
53
+ }
54
+ }
55
+ async function submitPrompt(prompt, hierarchy, url) {
56
+ const backendPort = window.REPOBURG_BACKEND_PORT;
57
+ if (!backendPort) {
58
+ (0, ui_1.showToast)('Repoburg backend port not found.', 'error');
59
+ return;
60
+ }
61
+ const hierarchyText = hierarchy
62
+ .slice()
63
+ .reverse()
64
+ .map((component, index) => {
65
+ const indent = ' '.repeat(index);
66
+ const propsString = JSON.stringify(component.props);
67
+ const stateString = component.state && Object.keys(component.state).length > 0
68
+ ? `, state: ${JSON.stringify(component.state)}`
69
+ : '';
70
+ return `${indent}- ${component.name} (props: ${propsString}${stateString})`;
71
+ })
72
+ .join('\n');
73
+ const explanationForAI = `This data structure is a React Component Tree, representing the hierarchy of components from the application's root down to the element the user selected. The indentation signifies the parent-child nesting relationship. Each line contains the component/element name, its 'props' (data passed down to it), and its 'state' (internal data it manages). As an AI agent, use this structural and data context to understand the application's architecture and the flow of information related to the user's request. The last element in the list is the user's direct target.`;
74
+ const contextHeader = `--- Visual Inspector Context ---\nURL: ${url}\n\n${explanationForAI}\n\nComponent Hierarchy:\n${hierarchyText}\n\n--- User Prompt ---`;
75
+ const fullPrompt = `${contextHeader}\n\n${prompt}`;
76
+ const payload = {
77
+ prompt: fullPrompt,
78
+ componentPath: '',
79
+ parentComponentPath: undefined,
80
+ };
81
+ try {
82
+ const response = await fetch(`http://localhost:${backendPort}/visual-editor/submit`, {
83
+ method: 'POST',
84
+ headers: { 'Content-Type': 'application/json' },
85
+ body: JSON.stringify(payload),
86
+ });
87
+ if (!response.ok) {
88
+ const errorData = await response.json().catch(() => ({ message: 'Failed to submit prompt' }));
89
+ throw new Error(errorData.message);
90
+ }
91
+ (0, ui_1.showToast)('Prompt submitted successfully!');
92
+ }
93
+ catch (error) {
94
+ console.error('Repoburg Error:', error);
95
+ (0, ui_1.showToast)(error instanceof Error ? error.message : String(error), 'error');
96
+ }
97
+ }
98
+ function initialize() {
99
+ if (document.getElementById('repoburg-float-btn'))
100
+ return;
101
+ console.log('Repoburg Visual Editor: Initializing UI.');
102
+ console.log('Repoburg Backend Port:', window.REPOBURG_BACKEND_PORT || 'Not Set');
103
+ (0, ui_1.injectStyles)();
104
+ (0, ui_1.createToast)();
105
+ (0, ui_1.createFloatingButton)(toggleSelectorMode);
106
+ }
107
+ initialize();
108
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../../../client/src/main.ts"],"names":[],"mappings":";;AAAA,2CAAyE;AACzE,6BAAmG;AAUnG,IAAI,oBAAoB,GAAG,KAAK,CAAC;AACjC,IAAI,qBAAqB,GAAuB,IAAI,CAAC;AAIrD,SAAS,eAAe,CAAC,CAAa;IAClC,IAAI,qBAAqB,EAAE,CAAC;QACxB,qBAAqB,CAAC,SAAS,CAAC,MAAM,CAAC,oBAAoB,CAAC,CAAC;IACjE,CAAC;IACD,qBAAqB,GAAG,CAAC,CAAC,MAAqB,CAAC;IAChD,qBAAqB,CAAC,SAAS,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAC9D,C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B,CAAC;QAAE,OAAO;IAE1D,OAAO,CAAC,GAAG,CAAC,0CAA0C,CAAC,CAAC;IACxD,OAAO,CAAC,GAAG,CAAC,wBAAwB,EAAE,MAAM,CAAC,qBAAqB,IAAI,SAAS,CAAC,CAAC;IAEjF,IAAA,iBAAY,GAAE,CAAC;IACf,IAAA,gBAAW,GAAE,CAAC;IACd,IAAA,yBAAoB,EAAC,kBAAkB,CAAC,CAAC;AAC7C,CAAC;AAGD,UAAU,EAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ComponentInfo } from './inspector';
2
+ export declare function injectStyles(): void;
3
+ export declare function createFloatingButton(onClick: () => void): HTMLButtonElement;
4
+ export declare function createToast(): void;
5
+ export declare function showPromptModal(hierarchy: ComponentInfo[], url: string, submitCallback: (prompt: string, hierarchy: ComponentInfo[], url: string) => Promise<void>): void;
6
+ export declare function showToast(message: string, type?: 'success' | 'error', duration?: number): void;
@@ -0,0 +1,153 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.injectStyles = injectStyles;
4
+ exports.createFloatingButton = createFloatingButton;
5
+ exports.createToast = createToast;
6
+ exports.showPromptModal = showPromptModal;
7
+ exports.showToast = showToast;
8
+ let toastTimeout;
9
+ function injectStyles() {
10
+ const style = document.createElement('style');
11
+ style.textContent = `
12
+ #repoburg-float-btn {
13
+ position: fixed;
14
+ bottom: 20px;
15
+ right: 20px;
16
+ background-color: #7c3aed;
17
+ color: white;
18
+ border: none;
19
+ border-radius: 50%;
20
+ width: 60px;
21
+ height: 60px;
22
+ font-size: 12px;
23
+ font-weight: bold;
24
+ cursor: pointer;
25
+ box-shadow: 0 4px 12px rgba(0,0,0,0.2);
26
+ z-index: 999999;
27
+ display: flex;
28
+ align-items: center;
29
+ justify-content: center;
30
+ transition: transform 0.2s ease, background-color 0.2s ease;
31
+ }
32
+ #repoburg-float-btn:hover {
33
+ transform: scale(1.1);
34
+ }
35
+ #repoburg-float-btn:disabled {
36
+ background-color: #585858;
37
+ cursor: not-allowed;
38
+ transform: none;
39
+ }
40
+ #repoburg-float-btn.active {
41
+ background-color: #c026d3;
42
+ }
43
+ .repoburg-highlight {
44
+ outline: 2px dashed #c026d3 !important;
45
+ box-shadow: 0 0 10px rgba(192, 38, 211, 0.5) !important;
46
+ background-color: rgba(192, 38, 211, 0.1) !important;
47
+ }
48
+ #repoburg-modal-overlay {
49
+ position: fixed;
50
+ top: 0; left: 0; width: 100%; height: 100%;
51
+ background-color: rgba(0,0,0,0.5);
52
+ z-index: 1000000;
53
+ display: flex;
54
+ align-items: center;
55
+ justify-content: center;
56
+ }
57
+ #repoburg-modal {
58
+ background-color: #2d3748;
59
+ color: #e2e8f0;
60
+ padding: 24px;
61
+ border-radius: 8px;
62
+ width: 90%;
63
+ max-width: 600px;
64
+ box-shadow: 0 5px 15px rgba(0,0,0,0.3);
65
+ }
66
+ #repoburg-modal-header { font-size: 1.25rem; font-weight: bold; margin-bottom: 16px; }
67
+ #repoburg-modal-textarea { width: 100%; background-color: #1a202c; color: white; border-radius: 4px; padding: 8px; min-height: 150px; border: 1px solid #4a5568; margin-bottom: 16px; }
68
+ #repoburg-modal-footer { display: flex; justify-content: flex-end; gap: 8px; }
69
+ .repoburg-modal-btn { padding: 8px 16px; border-radius: 4px; border: none; cursor: pointer; }
70
+ .repoburg-modal-btn-primary { background-color: #7c3aed; color: white; }
71
+ .repoburg-modal-btn-secondary { background-color: #4a5568; color: white; }
72
+ #repoburg-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background-color: #1a202c; color: white; padding: 12px 20px; border-radius: 6px; z-index: 1000001; opacity: 0; transition: opacity 0.3s ease; text-align: center; }
73
+ #repoburg-toast.show { opacity: 1; }
74
+ #repoburg-toast.error { background-color: #c53030; }
75
+ `;
76
+ document.head.appendChild(style);
77
+ }
78
+ function createFloatingButton(onClick) {
79
+ const button = document.createElement('button');
80
+ button.id = 'repoburg-float-btn';
81
+ button.textContent = 'Repo';
82
+ button.onclick = onClick;
83
+ document.body.appendChild(button);
84
+ return button;
85
+ }
86
+ function createToast() {
87
+ const toast = document.createElement('div');
88
+ toast.id = 'repoburg-toast';
89
+ document.body.appendChild(toast);
90
+ }
91
+ function showPromptModal(hierarchy, url, submitCallback) {
92
+ const overlay = document.createElement('div');
93
+ overlay.id = 'repoburg-modal-overlay';
94
+ const component = hierarchy[0];
95
+ const parent = hierarchy.length > 1 ? hierarchy[1] : undefined;
96
+ const parentName = parent ? parent.name : 'N/A';
97
+ const breadcrumbs = hierarchy.map(c => c.name).reverse().join(' > ');
98
+ overlay.innerHTML = `
99
+ <div id="repoburg-modal">
100
+ <div id="repoburg-modal-header">Edit Component</div>
101
+ <p style="font-size: 0.9rem; margin-bottom: 8px;"><strong>Component:</strong> ${component.name}</p>
102
+ <p style="font-size: 0.9rem; margin-bottom: 16px;"><strong>Parent Context:</strong> ${parentName}</p>
103
+ <p style="font-size: 0.8rem; margin-bottom: 8px; word-break: break-all; opacity: 0.7;"><strong>Path:</strong> ${breadcrumbs}</p>
104
+ <p style="font-size: 0.8rem; margin-bottom: 16px; word-break: break-all; opacity: 0.7;"><strong>URL:</strong> ${url}</p>
105
+ <textarea id="repoburg-modal-textarea" placeholder="Enter your prompt... (e.g., 'add a confirmation icon to this button')"></textarea>
106
+ <div id="repoburg-modal-footer">
107
+ <button id="repoburg-modal-cancel" class="repoburg-modal-btn repoburg-modal-btn-secondary">Cancel</button>
108
+ <button id="repoburg-modal-submit" class="repoburg-modal-btn repoburg-modal-btn-primary">Submit</button>
109
+ </div>
110
+ </div>
111
+ `;
112
+ document.body.appendChild(overlay);
113
+ const promptInput = document.getElementById('repoburg-modal-textarea');
114
+ const submitButton = document.getElementById('repoburg-modal-submit');
115
+ promptInput.focus();
116
+ const handleKeyDown = (event) => {
117
+ if (event.key === 'Escape') {
118
+ closeModal();
119
+ }
120
+ if (event.key === 'Enter' && (event.metaKey || event.ctrlKey)) {
121
+ event.preventDefault();
122
+ submitButton.click();
123
+ }
124
+ };
125
+ document.addEventListener('keydown', handleKeyDown);
126
+ const closeModal = () => {
127
+ document.removeEventListener('keydown', handleKeyDown);
128
+ overlay.remove();
129
+ };
130
+ document.getElementById('repoburg-modal-cancel').onclick = closeModal;
131
+ overlay.onclick = (e) => { if (e.target === overlay)
132
+ closeModal(); };
133
+ submitButton.onclick = async () => {
134
+ const prompt = promptInput.value;
135
+ if (!prompt.trim())
136
+ return;
137
+ await submitCallback(prompt, hierarchy, url);
138
+ closeModal();
139
+ };
140
+ }
141
+ function showToast(message, type = 'success', duration = 3000) {
142
+ const toast = document.getElementById('repoburg-toast');
143
+ if (!toast)
144
+ return;
145
+ toast.textContent = message;
146
+ toast.className = type === 'error' ? 'error' : '';
147
+ toast.classList.add('show');
148
+ clearTimeout(toastTimeout);
149
+ toastTimeout = window.setTimeout(() => {
150
+ toast.classList.remove('show');
151
+ }, duration);
152
+ }
153
+ //# sourceMappingURL=ui.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ui.js","sourceRoot":"","sources":["../../../client/src/ui.ts"],"names":[],"mappings":";;AAOA,oCAoEC;AAKD,oDAOC;AAKD,kCAIC;AAKD,0CA+DC;AAKD,8BAYC;AAnLD,IAAI,YAAoB,CAAC;AAKzB,SAAgB,YAAY;IACxB,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAgEnB,CAAC;IACF,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;AACrC,CAAC;AAKD,SAAgB,oBAAoB,CAAC,OAAmB;IACpD,MAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,CAAC,EAAE,GAAG,oBAAoB,CAAC;IACjC,MAAM,CAAC,WAAW,GAAG,MAAM,CAAC;IA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