vibespot 0.5.1 → 0.6.0
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/dist/index.js +95 -57
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/ui/favicon.ico +0 -0
- package/ui/favicon.svg +1 -1
- package/ui/index.html +14 -0
- package/ui/setup.js +15 -0
- package/ui/styles.css +97 -51
package/dist/index.js
CHANGED
|
@@ -1096,60 +1096,49 @@ import { join as join6, basename as basename2 } from "path";
|
|
|
1096
1096
|
import { readdirSync as readdirSync4, statSync as statSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
1097
1097
|
|
|
1098
1098
|
// src/ai/prompts.ts
|
|
1099
|
-
|
|
1099
|
+
var guideCache = /* @__PURE__ */ new Map();
|
|
1100
|
+
function cachedAsset(name) {
|
|
1101
|
+
let val = guideCache.get(name);
|
|
1102
|
+
if (val !== void 0) return val;
|
|
1100
1103
|
try {
|
|
1101
|
-
|
|
1104
|
+
val = readFile(resolveAsset(name));
|
|
1102
1105
|
} catch {
|
|
1103
|
-
|
|
1106
|
+
val = "";
|
|
1104
1107
|
}
|
|
1108
|
+
guideCache.set(name, val);
|
|
1109
|
+
return val;
|
|
1110
|
+
}
|
|
1111
|
+
function getConversionGuide() {
|
|
1112
|
+
return cachedAsset("conversion-guide.md") || "Conversion guide not found. Using built-in rules.";
|
|
1105
1113
|
}
|
|
1106
1114
|
function getDesignGuide() {
|
|
1107
|
-
|
|
1108
|
-
return readFile(resolveAsset("design-guide.md"));
|
|
1109
|
-
} catch {
|
|
1110
|
-
return "";
|
|
1111
|
-
}
|
|
1115
|
+
return cachedAsset("design-guide.md");
|
|
1112
1116
|
}
|
|
1113
1117
|
function getContentGuide() {
|
|
1114
|
-
|
|
1115
|
-
return readFile(resolveAsset("content-guide.md"));
|
|
1116
|
-
} catch {
|
|
1117
|
-
return "";
|
|
1118
|
-
}
|
|
1118
|
+
return cachedAsset("content-guide.md");
|
|
1119
1119
|
}
|
|
1120
1120
|
function getHubspotRules() {
|
|
1121
|
-
|
|
1122
|
-
return readFile(resolveAsset("hubspot-rules.md"));
|
|
1123
|
-
} catch {
|
|
1124
|
-
return "";
|
|
1125
|
-
}
|
|
1121
|
+
return cachedAsset("hubspot-rules.md");
|
|
1126
1122
|
}
|
|
1127
1123
|
function getHumanifyGuide() {
|
|
1128
|
-
|
|
1129
|
-
return readFile(resolveAsset("humanify-guide.md"));
|
|
1130
|
-
} catch {
|
|
1131
|
-
return "";
|
|
1132
|
-
}
|
|
1124
|
+
return cachedAsset("humanify-guide.md");
|
|
1133
1125
|
}
|
|
1134
1126
|
function getPageTypeGuide(pageType) {
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
} catch {
|
|
1151
|
-
return "";
|
|
1152
|
-
}
|
|
1127
|
+
const fullGuide = cachedAsset("page-types.md");
|
|
1128
|
+
if (!fullGuide) return "";
|
|
1129
|
+
const sectionHeaders = {
|
|
1130
|
+
landing_page: "## Landing Page",
|
|
1131
|
+
blog_post: "## Blog Post",
|
|
1132
|
+
website_page: "## Website Page",
|
|
1133
|
+
module_only: "## Module Only"
|
|
1134
|
+
};
|
|
1135
|
+
const header = sectionHeaders[pageType];
|
|
1136
|
+
if (!header) return "";
|
|
1137
|
+
const startIdx = fullGuide.indexOf(header);
|
|
1138
|
+
if (startIdx < 0) return "";
|
|
1139
|
+
const afterHeader = fullGuide.indexOf("\n## ", startIdx + header.length);
|
|
1140
|
+
const section = afterHeader >= 0 ? fullGuide.slice(startIdx, afterHeader).trim() : fullGuide.slice(startIdx).trim();
|
|
1141
|
+
return section;
|
|
1153
1142
|
}
|
|
1154
1143
|
function buildSystemPrompt(conversionGuide) {
|
|
1155
1144
|
return `You are a HubSpot CMS expert converting React/Tailwind pages to native HubSpot modules.
|
|
@@ -3201,6 +3190,65 @@ function rollbackToCommit(themePath, commitHash) {
|
|
|
3201
3190
|
|
|
3202
3191
|
// src/server/session.ts
|
|
3203
3192
|
var SESSIONS_DIR = join14(homedir3(), ".vibespot", "sessions");
|
|
3193
|
+
var INDEX_PATH = join14(SESSIONS_DIR, "_index.json");
|
|
3194
|
+
function readIndex() {
|
|
3195
|
+
try {
|
|
3196
|
+
if (!existsSync4(INDEX_PATH)) return rebuildIndex();
|
|
3197
|
+
return JSON.parse(readFileSync4(INDEX_PATH, "utf-8"));
|
|
3198
|
+
} catch {
|
|
3199
|
+
return rebuildIndex();
|
|
3200
|
+
}
|
|
3201
|
+
}
|
|
3202
|
+
function writeIndex(entries) {
|
|
3203
|
+
try {
|
|
3204
|
+
mkdirSync3(SESSIONS_DIR, { recursive: true });
|
|
3205
|
+
writeFileSync4(INDEX_PATH, JSON.stringify(entries), "utf-8");
|
|
3206
|
+
} catch {
|
|
3207
|
+
}
|
|
3208
|
+
}
|
|
3209
|
+
function rebuildIndex() {
|
|
3210
|
+
if (!existsSync4(SESSIONS_DIR)) return [];
|
|
3211
|
+
const entries = [];
|
|
3212
|
+
for (const f of readdirSync10(SESSIONS_DIR).filter((f2) => f2.endsWith(".json") && f2 !== "_index.json")) {
|
|
3213
|
+
try {
|
|
3214
|
+
const data = JSON.parse(readFileSync4(join14(SESSIONS_DIR, f), "utf-8"));
|
|
3215
|
+
const templates = data.templates || [];
|
|
3216
|
+
entries.push({
|
|
3217
|
+
id: data.id,
|
|
3218
|
+
themeName: data.themeName,
|
|
3219
|
+
updatedAt: data.updatedAt,
|
|
3220
|
+
moduleCount: templates.reduce((n, t) => n + (t.modules?.length || 0), 0),
|
|
3221
|
+
templateCount: templates.length
|
|
3222
|
+
});
|
|
3223
|
+
} catch {
|
|
3224
|
+
}
|
|
3225
|
+
}
|
|
3226
|
+
writeIndex(entries);
|
|
3227
|
+
return entries;
|
|
3228
|
+
}
|
|
3229
|
+
function upsertIndex(session) {
|
|
3230
|
+
const entries = readIndex();
|
|
3231
|
+
const templates = session.templates || [];
|
|
3232
|
+
const entry = {
|
|
3233
|
+
id: session.id,
|
|
3234
|
+
themeName: session.themeName,
|
|
3235
|
+
updatedAt: session.updatedAt,
|
|
3236
|
+
moduleCount: templates.reduce((n, t) => n + (t.modules?.length || 0), 0),
|
|
3237
|
+
templateCount: templates.length
|
|
3238
|
+
};
|
|
3239
|
+
const idx = entries.findIndex((e) => e.id === session.id);
|
|
3240
|
+
if (idx >= 0) entries[idx] = entry;
|
|
3241
|
+
else entries.push(entry);
|
|
3242
|
+
writeIndex(entries);
|
|
3243
|
+
}
|
|
3244
|
+
function removeFromIndex(sessionId) {
|
|
3245
|
+
const entries = readIndex().filter((e) => e.id !== sessionId);
|
|
3246
|
+
writeIndex(entries);
|
|
3247
|
+
}
|
|
3248
|
+
function removeFromIndexByTheme(themeName) {
|
|
3249
|
+
const entries = readIndex().filter((e) => e.themeName !== themeName);
|
|
3250
|
+
writeIndex(entries);
|
|
3251
|
+
}
|
|
3204
3252
|
var activeSession = null;
|
|
3205
3253
|
function createSession(themePath, themeName) {
|
|
3206
3254
|
const session = {
|
|
@@ -3482,6 +3530,7 @@ function saveSession() {
|
|
|
3482
3530
|
mkdirSync3(SESSIONS_DIR, { recursive: true });
|
|
3483
3531
|
const filePath = join14(SESSIONS_DIR, `${activeSession.id}.json`);
|
|
3484
3532
|
writeFileSync4(filePath, JSON.stringify(activeSession, null, 2), "utf-8");
|
|
3533
|
+
upsertIndex(activeSession);
|
|
3485
3534
|
}
|
|
3486
3535
|
function loadSession(sessionId) {
|
|
3487
3536
|
const filePath = join14(SESSIONS_DIR, sessionId + ".json");
|
|
@@ -3499,21 +3548,7 @@ function loadSession(sessionId) {
|
|
|
3499
3548
|
}
|
|
3500
3549
|
function listSessions() {
|
|
3501
3550
|
if (!existsSync4(SESSIONS_DIR)) return [];
|
|
3502
|
-
return
|
|
3503
|
-
try {
|
|
3504
|
-
const data = JSON.parse(readFileSync4(join14(SESSIONS_DIR, f), "utf-8"));
|
|
3505
|
-
const templates = data.templates || [];
|
|
3506
|
-
return {
|
|
3507
|
-
id: data.id,
|
|
3508
|
-
themeName: data.themeName,
|
|
3509
|
-
updatedAt: data.updatedAt,
|
|
3510
|
-
moduleCount: templates.reduce((n, t) => n + (t.modules?.length || 0), 0),
|
|
3511
|
-
templateCount: templates.length
|
|
3512
|
-
};
|
|
3513
|
-
} catch {
|
|
3514
|
-
return null;
|
|
3515
|
-
}
|
|
3516
|
-
}).filter(Boolean);
|
|
3551
|
+
return readIndex();
|
|
3517
3552
|
}
|
|
3518
3553
|
function deleteSession(sessionId, deleteFiles = false) {
|
|
3519
3554
|
const filePath = join14(SESSIONS_DIR, sessionId + ".json");
|
|
@@ -3539,7 +3574,7 @@ function deleteSession(sessionId, deleteFiles = false) {
|
|
|
3539
3574
|
} catch {
|
|
3540
3575
|
}
|
|
3541
3576
|
if (themeName && existsSync4(SESSIONS_DIR)) {
|
|
3542
|
-
for (const f of readdirSync10(SESSIONS_DIR).filter((f2) => f2.endsWith(".json"))) {
|
|
3577
|
+
for (const f of readdirSync10(SESSIONS_DIR).filter((f2) => f2.endsWith(".json") && f2 !== "_index.json")) {
|
|
3543
3578
|
try {
|
|
3544
3579
|
const data = JSON.parse(readFileSync4(join14(SESSIONS_DIR, f), "utf-8"));
|
|
3545
3580
|
if (data.themeName === themeName) {
|
|
@@ -3548,6 +3583,9 @@ function deleteSession(sessionId, deleteFiles = false) {
|
|
|
3548
3583
|
} catch {
|
|
3549
3584
|
}
|
|
3550
3585
|
}
|
|
3586
|
+
removeFromIndexByTheme(themeName);
|
|
3587
|
+
} else {
|
|
3588
|
+
removeFromIndex(sessionId);
|
|
3551
3589
|
}
|
|
3552
3590
|
if (activeSession?.id === sessionId) {
|
|
3553
3591
|
activeSession = null;
|