repowise 0.1.4 → 0.1.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/bin/repowise.js +93 -8
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -102,20 +102,38 @@ function startCallbackServer() {
|
|
|
102
102
|
const error = url.searchParams.get("error");
|
|
103
103
|
if (error) {
|
|
104
104
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
105
|
-
res.end(
|
|
105
|
+
res.end(
|
|
106
|
+
callbackPage(
|
|
107
|
+
"Authentication Failed",
|
|
108
|
+
"Something went wrong. Please close this tab and try again.",
|
|
109
|
+
true
|
|
110
|
+
)
|
|
111
|
+
);
|
|
106
112
|
server.close();
|
|
107
113
|
reject(new Error(`Authentication error: ${error}`));
|
|
108
114
|
return;
|
|
109
115
|
}
|
|
110
116
|
if (!code || !state) {
|
|
111
117
|
res.writeHead(400, { "Content-Type": "text/html" });
|
|
112
|
-
res.end(
|
|
118
|
+
res.end(
|
|
119
|
+
callbackPage(
|
|
120
|
+
"Missing Parameters",
|
|
121
|
+
"The callback was missing required data. Please close this tab and try again.",
|
|
122
|
+
true
|
|
123
|
+
)
|
|
124
|
+
);
|
|
113
125
|
server.close();
|
|
114
126
|
reject(new Error("Missing code or state in callback"));
|
|
115
127
|
return;
|
|
116
128
|
}
|
|
117
129
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
118
|
-
res.end(
|
|
130
|
+
res.end(
|
|
131
|
+
callbackPage(
|
|
132
|
+
"Authentication Successful",
|
|
133
|
+
"You can close this tab and return to the terminal.",
|
|
134
|
+
false
|
|
135
|
+
)
|
|
136
|
+
);
|
|
119
137
|
server.close();
|
|
120
138
|
resolve({ code, state });
|
|
121
139
|
});
|
|
@@ -705,9 +723,55 @@ var init_progress_renderer = __esm({
|
|
|
705
723
|
if (result.existingDocs.length > 0) {
|
|
706
724
|
console.log(` ${chalk3.dim("Existing docs:")} ${result.existingDocs.join(", ")}`);
|
|
707
725
|
}
|
|
726
|
+
if (result.fileTree && result.fileTree.length > 0) {
|
|
727
|
+
this.renderTree(result.fileTree);
|
|
728
|
+
}
|
|
708
729
|
console.log("");
|
|
709
730
|
spinner.start();
|
|
710
731
|
}
|
|
732
|
+
renderTree(entries) {
|
|
733
|
+
console.log("");
|
|
734
|
+
console.log(chalk3.cyan.bold(" \u2500\u2500 Project Structure \u2500\u2500"));
|
|
735
|
+
const root = { name: "", type: "tree", children: /* @__PURE__ */ new Map() };
|
|
736
|
+
for (const entry of entries) {
|
|
737
|
+
const parts = entry.path.split("/");
|
|
738
|
+
let current = root;
|
|
739
|
+
for (let i = 0; i < parts.length; i++) {
|
|
740
|
+
const part = parts[i];
|
|
741
|
+
if (!current.children.has(part)) {
|
|
742
|
+
const isLast = i === parts.length - 1;
|
|
743
|
+
current.children.set(part, {
|
|
744
|
+
name: part,
|
|
745
|
+
type: isLast ? entry.type : "tree",
|
|
746
|
+
children: /* @__PURE__ */ new Map()
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
current = current.children.get(part);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
const printNode = (node, prefix, isLast) => {
|
|
753
|
+
const connector = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
754
|
+
const display = node.type === "tree" ? chalk3.bold.dim(`${node.name}/`) : node.name;
|
|
755
|
+
console.log(` ${prefix}${connector}${display}`);
|
|
756
|
+
const sorted = [...node.children.values()].sort((a, b) => {
|
|
757
|
+
if (a.type === "tree" && b.type !== "tree") return -1;
|
|
758
|
+
if (a.type !== "tree" && b.type === "tree") return 1;
|
|
759
|
+
return a.name.localeCompare(b.name);
|
|
760
|
+
});
|
|
761
|
+
const childPrefix = prefix + (isLast ? " " : "\u2502 ");
|
|
762
|
+
sorted.forEach((child, idx) => {
|
|
763
|
+
printNode(child, childPrefix, idx === sorted.length - 1);
|
|
764
|
+
});
|
|
765
|
+
};
|
|
766
|
+
const topLevel = [...root.children.values()].sort((a, b) => {
|
|
767
|
+
if (a.type === "tree" && b.type !== "tree") return -1;
|
|
768
|
+
if (a.type !== "tree" && b.type === "tree") return 1;
|
|
769
|
+
return a.name.localeCompare(b.name);
|
|
770
|
+
});
|
|
771
|
+
topLevel.forEach((child, idx) => {
|
|
772
|
+
printNode(child, "", idx === topLevel.length - 1);
|
|
773
|
+
});
|
|
774
|
+
}
|
|
711
775
|
renderScanSummary(summary, spinner) {
|
|
712
776
|
if (this.scanSummaryShown) return;
|
|
713
777
|
this.scanSummaryShown = true;
|
|
@@ -1230,11 +1294,32 @@ async function create() {
|
|
|
1230
1294
|
);
|
|
1231
1295
|
}
|
|
1232
1296
|
spinner.start("Starting context generation pipeline...");
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1297
|
+
let syncId;
|
|
1298
|
+
try {
|
|
1299
|
+
const triggerResult = await apiRequest(`/v1/repos/${repoId}/sync`, {
|
|
1300
|
+
method: "POST",
|
|
1301
|
+
body: JSON.stringify({ scanType: "full" })
|
|
1302
|
+
});
|
|
1303
|
+
syncId = triggerResult.syncId;
|
|
1304
|
+
} catch (triggerErr) {
|
|
1305
|
+
const msg = triggerErr instanceof Error ? triggerErr.message : "";
|
|
1306
|
+
if (!msg.toLowerCase().includes("already running")) {
|
|
1307
|
+
throw triggerErr;
|
|
1308
|
+
}
|
|
1309
|
+
spinner.text = "Resuming existing pipeline...";
|
|
1310
|
+
const syncs = await apiRequest(
|
|
1311
|
+
`/v1/repos/${repoId}/syncs?limit=1`
|
|
1312
|
+
);
|
|
1313
|
+
const active = syncs.items.find(
|
|
1314
|
+
(s) => s.status === "in_progress" || s.status === "awaiting_input"
|
|
1315
|
+
);
|
|
1316
|
+
if (!active) {
|
|
1317
|
+
throw new Error("Could not find active sync to resume. Please try again.");
|
|
1318
|
+
}
|
|
1319
|
+
syncId = active.syncId;
|
|
1320
|
+
spinner.info(chalk4.cyan("Resuming existing pipeline..."));
|
|
1321
|
+
spinner.start();
|
|
1322
|
+
}
|
|
1238
1323
|
let pollAttempts = 0;
|
|
1239
1324
|
const progressRenderer = new ProgressRenderer();
|
|
1240
1325
|
while (true) {
|