claude-code-marketplace 0.5.1 → 0.5.3
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/package.json +1 -1
- package/public/app.js +40 -0
- package/public/style.css +2 -2
- package/server.js +13 -4
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -1002,6 +1002,25 @@ function restoreAppState() {
|
|
|
1002
1002
|
if (params.has('plugin')) {
|
|
1003
1003
|
selectedPluginId = params.get('plugin');
|
|
1004
1004
|
}
|
|
1005
|
+
if (params.has('project')) {
|
|
1006
|
+
const projectPath = params.get('project');
|
|
1007
|
+
fetch('/api/project', {
|
|
1008
|
+
method: 'PUT',
|
|
1009
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1010
|
+
body: JSON.stringify({ path: projectPath }),
|
|
1011
|
+
})
|
|
1012
|
+
.then((r) => {
|
|
1013
|
+
if (r.ok) {
|
|
1014
|
+
loadProject();
|
|
1015
|
+
loadData();
|
|
1016
|
+
}
|
|
1017
|
+
})
|
|
1018
|
+
.catch(() => {});
|
|
1019
|
+
const cleanParams = new URLSearchParams(window.location.search);
|
|
1020
|
+
cleanParams.delete('project');
|
|
1021
|
+
const qs = cleanParams.toString();
|
|
1022
|
+
history.replaceState(null, '', qs ? `?${qs}` : window.location.pathname);
|
|
1023
|
+
}
|
|
1005
1024
|
try {
|
|
1006
1025
|
const saved = JSON.parse(localStorage.getItem('expandedNodes') || '[]');
|
|
1007
1026
|
saved.forEach((n) => expandedNodes.add(n));
|
|
@@ -1337,3 +1356,24 @@ function showHelpModal() {
|
|
|
1337
1356
|
if ('serviceWorker' in navigator) {
|
|
1338
1357
|
navigator.serviceWorker.register('/sw.js');
|
|
1339
1358
|
}
|
|
1359
|
+
|
|
1360
|
+
// #region HUB_INTEGRATION
|
|
1361
|
+
(async function initHub() {
|
|
1362
|
+
const cfg = await fetch('/hub-config')
|
|
1363
|
+
.then((r) => r.json())
|
|
1364
|
+
.catch(() => ({}));
|
|
1365
|
+
if (!cfg.enabled) return;
|
|
1366
|
+
window.__HUB__ = cfg;
|
|
1367
|
+
document.addEventListener('keydown', (e) => {
|
|
1368
|
+
if (e.ctrlKey && e.altKey && (e.key === 'ArrowLeft' || e.key === 'ArrowRight')) {
|
|
1369
|
+
e.preventDefault();
|
|
1370
|
+
window.parent?.postMessage({ type: 'hub:keydown', key: e.key }, '*');
|
|
1371
|
+
}
|
|
1372
|
+
});
|
|
1373
|
+
})();
|
|
1374
|
+
|
|
1375
|
+
function hubNavigate(app, url) {
|
|
1376
|
+
if (!window.__HUB__?.enabled) return;
|
|
1377
|
+
window.parent?.postMessage({ type: 'hub:navigate', app, url }, '*');
|
|
1378
|
+
}
|
|
1379
|
+
// #endregion HUB_INTEGRATION
|
package/public/style.css
CHANGED
package/server.js
CHANGED
|
@@ -7,6 +7,11 @@ const { execFile } = require('child_process');
|
|
|
7
7
|
|
|
8
8
|
const app = express();
|
|
9
9
|
app.use(express.json());
|
|
10
|
+
|
|
11
|
+
app.get('/hub-config', (_req, res) => {
|
|
12
|
+
res.json({ enabled: !!process.env.CLAUDE_HUB, url: process.env.HUB_URL || null });
|
|
13
|
+
});
|
|
14
|
+
|
|
10
15
|
app.use(express.static(path.join(__dirname, 'public')));
|
|
11
16
|
|
|
12
17
|
const CLAUDE_DIR = path.join(os.homedir(), '.claude');
|
|
@@ -31,6 +36,10 @@ let projectPath = getArg('project') || process.cwd();
|
|
|
31
36
|
if (projectPath.startsWith('~')) projectPath = projectPath.replace('~', os.homedir());
|
|
32
37
|
const PORT = parseInt(getArg('port') || process.env.PORT || '3457', 10);
|
|
33
38
|
|
|
39
|
+
function toUnixPath(p) {
|
|
40
|
+
return p ? p.replace(/\\/g, '/') : p;
|
|
41
|
+
}
|
|
42
|
+
|
|
34
43
|
function readJsonSafe(filePath) {
|
|
35
44
|
try {
|
|
36
45
|
return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
|
|
@@ -157,7 +166,7 @@ function loadMarketplaces() {
|
|
|
157
166
|
path: sourceData.path || null,
|
|
158
167
|
url: sourceData.url || null,
|
|
159
168
|
},
|
|
160
|
-
installLocation,
|
|
169
|
+
installLocation: toUnixPath(installLocation),
|
|
161
170
|
lastUpdated: entryData.lastUpdated || null,
|
|
162
171
|
version: null,
|
|
163
172
|
plugins: [],
|
|
@@ -285,8 +294,8 @@ function loadMarketplaces() {
|
|
|
285
294
|
scopeDetails,
|
|
286
295
|
installedScopes,
|
|
287
296
|
components,
|
|
288
|
-
_pluginDir: pluginDir,
|
|
289
|
-
_originDir: originDir,
|
|
297
|
+
_pluginDir: toUnixPath(pluginDir),
|
|
298
|
+
_originDir: toUnixPath(originDir),
|
|
290
299
|
_fsComps: fsComps,
|
|
291
300
|
metadata: Object.fromEntries(
|
|
292
301
|
Object.entries(pd).filter(([k]) => !['name', 'description', 'source', 'version', ...compKeys].includes(k))
|
|
@@ -473,7 +482,7 @@ function scanCustomizations(basePath, scope) {
|
|
|
473
482
|
scopeDetails,
|
|
474
483
|
installedScopes: [scope],
|
|
475
484
|
components,
|
|
476
|
-
_pluginDir: basePath,
|
|
485
|
+
_pluginDir: toUnixPath(basePath),
|
|
477
486
|
_fsComps: components,
|
|
478
487
|
metadata: {},
|
|
479
488
|
}],
|