aiblueprint-cli 1.3.4 → 1.3.5
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/cli.js +103 -13
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -35324,6 +35324,8 @@ async function listRemoteFilesRecursive(dirPath, githubToken, basePath = "") {
|
|
|
35324
35324
|
const results = [];
|
|
35325
35325
|
const files = await listRemoteDirectory(dirPath, githubToken);
|
|
35326
35326
|
for (const file of files) {
|
|
35327
|
+
if (file.name === "node_modules")
|
|
35328
|
+
continue;
|
|
35327
35329
|
const relativePath = basePath ? `${basePath}/${file.name}` : file.name;
|
|
35328
35330
|
if (file.type === "file") {
|
|
35329
35331
|
results.push({ path: relativePath, sha: file.sha, isFolder: false });
|
|
@@ -35350,6 +35352,8 @@ async function listLocalFiles(dir) {
|
|
|
35350
35352
|
}
|
|
35351
35353
|
const items = await import_fs_extra15.default.readdir(dir);
|
|
35352
35354
|
for (const item of items) {
|
|
35355
|
+
if (item === "node_modules")
|
|
35356
|
+
continue;
|
|
35353
35357
|
const fullPath = path17.join(dir, item);
|
|
35354
35358
|
const stat = await import_fs_extra15.default.stat(fullPath);
|
|
35355
35359
|
if (stat.isDirectory()) {
|
|
@@ -35366,6 +35370,8 @@ async function listLocalFilesRecursive(dir, basePath) {
|
|
|
35366
35370
|
const files = [];
|
|
35367
35371
|
const items = await import_fs_extra15.default.readdir(dir);
|
|
35368
35372
|
for (const item of items) {
|
|
35373
|
+
if (item === "node_modules")
|
|
35374
|
+
continue;
|
|
35369
35375
|
const fullPath = path17.join(dir, item);
|
|
35370
35376
|
const relativePath = `${basePath}/${item}`;
|
|
35371
35377
|
const stat = await import_fs_extra15.default.stat(fullPath);
|
|
@@ -35528,6 +35534,91 @@ function groupByCategory(items) {
|
|
|
35528
35534
|
}
|
|
35529
35535
|
return grouped;
|
|
35530
35536
|
}
|
|
35537
|
+
function aggregateByTopLevelFolder(items) {
|
|
35538
|
+
const folderMap = new Map;
|
|
35539
|
+
for (const item of items) {
|
|
35540
|
+
const parts = item.name.split("/");
|
|
35541
|
+
const topLevel = parts[0];
|
|
35542
|
+
if (!folderMap.has(topLevel)) {
|
|
35543
|
+
folderMap.set(topLevel, { name: topLevel, newCount: 0, modifiedCount: 0, deletedCount: 0 });
|
|
35544
|
+
}
|
|
35545
|
+
const summary = folderMap.get(topLevel);
|
|
35546
|
+
if (item.status === "new")
|
|
35547
|
+
summary.newCount++;
|
|
35548
|
+
else if (item.status === "modified")
|
|
35549
|
+
summary.modifiedCount++;
|
|
35550
|
+
else if (item.status === "deleted")
|
|
35551
|
+
summary.deletedCount++;
|
|
35552
|
+
}
|
|
35553
|
+
return Array.from(folderMap.values());
|
|
35554
|
+
}
|
|
35555
|
+
function formatFolderSummary(summary) {
|
|
35556
|
+
const parts = [];
|
|
35557
|
+
if (summary.newCount > 0)
|
|
35558
|
+
parts.push(source_default.green(`+${summary.newCount}`));
|
|
35559
|
+
if (summary.modifiedCount > 0)
|
|
35560
|
+
parts.push(source_default.yellow(`~${summary.modifiedCount}`));
|
|
35561
|
+
if (summary.deletedCount > 0)
|
|
35562
|
+
parts.push(source_default.red(`-${summary.deletedCount}`));
|
|
35563
|
+
const countStr = parts.length > 0 ? ` (${parts.join(", ")})` : "";
|
|
35564
|
+
return `\uD83D\uDCC1 ${summary.name}${countStr}`;
|
|
35565
|
+
}
|
|
35566
|
+
function createSelectionChoices(changedItems) {
|
|
35567
|
+
const choices = [];
|
|
35568
|
+
const folderedCategories = ["scripts", "skills"];
|
|
35569
|
+
const grouped = groupByCategory(changedItems);
|
|
35570
|
+
for (const [category, items] of grouped) {
|
|
35571
|
+
if (folderedCategories.includes(category)) {
|
|
35572
|
+
const folderMap = new Map;
|
|
35573
|
+
for (const item of items) {
|
|
35574
|
+
const topLevel = item.name.split("/")[0];
|
|
35575
|
+
if (!folderMap.has(topLevel))
|
|
35576
|
+
folderMap.set(topLevel, []);
|
|
35577
|
+
folderMap.get(topLevel).push(item);
|
|
35578
|
+
}
|
|
35579
|
+
for (const [folder, folderItems] of folderMap) {
|
|
35580
|
+
const summary = aggregateByTopLevelFolder(folderItems)[0];
|
|
35581
|
+
choices.push({
|
|
35582
|
+
value: { type: "folder", folder, category, items: folderItems },
|
|
35583
|
+
label: `\uD83D\uDCC1 ${category}/${folder}`,
|
|
35584
|
+
hint: formatFolderHint(summary)
|
|
35585
|
+
});
|
|
35586
|
+
}
|
|
35587
|
+
} else {
|
|
35588
|
+
for (const item of items) {
|
|
35589
|
+
const icons = { new: "\uD83C\uDD95", modified: "\uD83D\uDCDD", deleted: "\uD83D\uDDD1️", unchanged: "" };
|
|
35590
|
+
const actions = { new: "add", modified: "update", deleted: "remove", unchanged: "" };
|
|
35591
|
+
choices.push({
|
|
35592
|
+
value: { type: "file", item },
|
|
35593
|
+
label: `${icons[item.status]} ${item.relativePath}`,
|
|
35594
|
+
hint: actions[item.status]
|
|
35595
|
+
});
|
|
35596
|
+
}
|
|
35597
|
+
}
|
|
35598
|
+
}
|
|
35599
|
+
return choices;
|
|
35600
|
+
}
|
|
35601
|
+
function formatFolderHint(summary) {
|
|
35602
|
+
const parts = [];
|
|
35603
|
+
if (summary.newCount > 0)
|
|
35604
|
+
parts.push(`+${summary.newCount}`);
|
|
35605
|
+
if (summary.modifiedCount > 0)
|
|
35606
|
+
parts.push(`~${summary.modifiedCount}`);
|
|
35607
|
+
if (summary.deletedCount > 0)
|
|
35608
|
+
parts.push(`-${summary.deletedCount}`);
|
|
35609
|
+
return parts.join(", ");
|
|
35610
|
+
}
|
|
35611
|
+
function expandSelections(selections) {
|
|
35612
|
+
const items = [];
|
|
35613
|
+
for (const sel of selections) {
|
|
35614
|
+
if (sel.type === "file") {
|
|
35615
|
+
items.push(sel.item);
|
|
35616
|
+
} else {
|
|
35617
|
+
items.push(...sel.items);
|
|
35618
|
+
}
|
|
35619
|
+
}
|
|
35620
|
+
return items;
|
|
35621
|
+
}
|
|
35531
35622
|
async function proSyncCommand(options = {}) {
|
|
35532
35623
|
oe(source_default.blue(`\uD83D\uDD04 Sync Premium Configurations ${source_default.gray(`v${getVersion()}`)}`));
|
|
35533
35624
|
try {
|
|
@@ -35553,24 +35644,23 @@ async function proSyncCommand(options = {}) {
|
|
|
35553
35644
|
f2.message("");
|
|
35554
35645
|
f2.message(source_default.bold("Changes by category:"));
|
|
35555
35646
|
const grouped = groupByCategory(changedItems);
|
|
35647
|
+
const folderedCategories = ["scripts", "skills"];
|
|
35556
35648
|
for (const [category, items] of grouped) {
|
|
35557
35649
|
f2.message("");
|
|
35558
35650
|
f2.message(source_default.cyan.bold(` ${category.toUpperCase()}`));
|
|
35559
|
-
|
|
35560
|
-
|
|
35651
|
+
if (folderedCategories.includes(category)) {
|
|
35652
|
+
const folderSummaries = aggregateByTopLevelFolder(items);
|
|
35653
|
+
for (const summary2 of folderSummaries) {
|
|
35654
|
+
f2.message(` ${formatFolderSummary(summary2)}`);
|
|
35655
|
+
}
|
|
35656
|
+
} else {
|
|
35657
|
+
for (const item of items) {
|
|
35658
|
+
f2.message(` ${formatItem(item)}`);
|
|
35659
|
+
}
|
|
35561
35660
|
}
|
|
35562
35661
|
}
|
|
35563
35662
|
f2.message("");
|
|
35564
|
-
const choices =
|
|
35565
|
-
for (const item of changedItems) {
|
|
35566
|
-
const icons = { new: "\uD83C\uDD95", modified: "\uD83D\uDCDD", deleted: "\uD83D\uDDD1️", unchanged: "" };
|
|
35567
|
-
const actions = { new: "add", modified: "update", deleted: "remove", unchanged: "" };
|
|
35568
|
-
choices.push({
|
|
35569
|
-
value: item,
|
|
35570
|
-
label: `${icons[item.status]} ${item.relativePath}`,
|
|
35571
|
-
hint: actions[item.status]
|
|
35572
|
-
});
|
|
35573
|
-
}
|
|
35663
|
+
const choices = createSelectionChoices(changedItems);
|
|
35574
35664
|
const selected = await ae({
|
|
35575
35665
|
message: "Select items to sync:",
|
|
35576
35666
|
options: choices,
|
|
@@ -35581,7 +35671,7 @@ async function proSyncCommand(options = {}) {
|
|
|
35581
35671
|
ue("Sync cancelled");
|
|
35582
35672
|
process.exit(0);
|
|
35583
35673
|
}
|
|
35584
|
-
const selectedItems = selected;
|
|
35674
|
+
const selectedItems = expandSelections(selected);
|
|
35585
35675
|
if (selectedItems.length === 0) {
|
|
35586
35676
|
f2.warn("No items selected");
|
|
35587
35677
|
$e(source_default.yellow("⚠️ Nothing to sync"));
|