openalmanac 0.2.47 → 0.2.49
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/setup.js +28 -24
- package/package.json +1 -1
package/dist/setup.js
CHANGED
|
@@ -102,17 +102,13 @@ const LOGO_LINES = [
|
|
|
102
102
|
"\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2551 \u255a\u2550\u255d \u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u2588\u2588\u2551 \u255a\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255a\u2588\u2588\u2588\u2588\u2588\u2588\u2557",
|
|
103
103
|
"\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u2550\u2550\u255d\u255a\u2550\u255d \u255a\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u255d",
|
|
104
104
|
];
|
|
105
|
-
|
|
105
|
+
let bannerSubtitle = "Write and publish articles with your AI agent";
|
|
106
|
+
function printBanner() {
|
|
106
107
|
process.stdout.write("\n");
|
|
107
108
|
for (let i = 0; i < LOGO_LINES.length; i++) {
|
|
108
109
|
process.stdout.write(`${GRADIENT[i]}${LOGO_LINES[i]}${RST}\n`);
|
|
109
110
|
}
|
|
110
|
-
process.stdout.write(`\n${
|
|
111
|
-
}
|
|
112
|
-
function renderHeader(mode = "default") {
|
|
113
|
-
printBanner(mode === "reddit"
|
|
114
|
-
? "Turn any subreddit into a published wiki"
|
|
115
|
-
: "Write and publish articles with your AI agent");
|
|
111
|
+
process.stdout.write(`\n${DIM} ${bannerSubtitle}${RST}\n`);
|
|
116
112
|
}
|
|
117
113
|
function printBadge() {
|
|
118
114
|
process.stdout.write(`\n ${ACCENT_BG} almanac ${RST}\n`);
|
|
@@ -202,9 +198,9 @@ function configurePermissions(tools) {
|
|
|
202
198
|
return tools.length;
|
|
203
199
|
}
|
|
204
200
|
/* ── Agent selection screen ─────────────────────────────────────── */
|
|
205
|
-
function renderAgentSelect(_cursor
|
|
201
|
+
function renderAgentSelect(_cursor) {
|
|
206
202
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
207
|
-
|
|
203
|
+
printBanner();
|
|
208
204
|
printBadge();
|
|
209
205
|
w("");
|
|
210
206
|
stepActive(`Select your agent`);
|
|
@@ -221,9 +217,9 @@ function renderAgentSelect(_cursor, mode = "default") {
|
|
|
221
217
|
w(` ${DIM}\u2502${RST} ${BLUE}${BOLD}[enter]${RST} confirm ${DIM}[q] quit${RST}`);
|
|
222
218
|
w("");
|
|
223
219
|
}
|
|
224
|
-
function runAgentSelect(
|
|
220
|
+
function runAgentSelect() {
|
|
225
221
|
return new Promise((resolve) => {
|
|
226
|
-
renderAgentSelect(0
|
|
222
|
+
renderAgentSelect(0);
|
|
227
223
|
process.stdin.setRawMode(true);
|
|
228
224
|
process.stdin.resume();
|
|
229
225
|
process.stdin.setEncoding("utf-8");
|
|
@@ -277,7 +273,7 @@ function waitForKey(prompt) {
|
|
|
277
273
|
process.stdin.on("data", onData);
|
|
278
274
|
});
|
|
279
275
|
}
|
|
280
|
-
async function runLoginStep(agent, mcpChanged, toolCount
|
|
276
|
+
async function runLoginStep(agent, mcpChanged, toolCount) {
|
|
281
277
|
const priorSteps = () => {
|
|
282
278
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
283
279
|
w(BAR);
|
|
@@ -288,7 +284,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
288
284
|
};
|
|
289
285
|
function renderLoginChoice(name, cursor) {
|
|
290
286
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
291
|
-
|
|
287
|
+
printBanner();
|
|
292
288
|
printBadge();
|
|
293
289
|
w("");
|
|
294
290
|
priorSteps();
|
|
@@ -352,7 +348,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
352
348
|
}
|
|
353
349
|
// Show prompt before opening browser
|
|
354
350
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
355
|
-
|
|
351
|
+
printBanner();
|
|
356
352
|
printBadge();
|
|
357
353
|
w("");
|
|
358
354
|
priorSteps();
|
|
@@ -365,7 +361,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
365
361
|
// Show waiting state with cancel/retry hint
|
|
366
362
|
const renderWaiting = () => {
|
|
367
363
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
368
|
-
|
|
364
|
+
printBanner();
|
|
369
365
|
printBadge();
|
|
370
366
|
w("");
|
|
371
367
|
priorSteps();
|
|
@@ -428,9 +424,9 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
428
424
|
}
|
|
429
425
|
/* ── Tool permissions TUI ───────────────────────────────────────── */
|
|
430
426
|
const MAX_NAME = Math.max(...TOOL_GROUPS.map((g) => g.name.length));
|
|
431
|
-
function renderToolSelect(selected, cursor, agent, mcpChanged
|
|
427
|
+
function renderToolSelect(selected, cursor, agent, mcpChanged) {
|
|
432
428
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
433
|
-
|
|
429
|
+
printBanner();
|
|
434
430
|
printBadge();
|
|
435
431
|
w("");
|
|
436
432
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
@@ -451,11 +447,11 @@ function renderToolSelect(selected, cursor, agent, mcpChanged, mode = "default")
|
|
|
451
447
|
w(` ${DIM}\u2502${RST} ${BLUE}${BOLD}[space]${RST} toggle ${BLUE}${BOLD}[\u2191\u2193]${RST} move ${BLUE}${BOLD}[a]${RST} all ${BLUE}${BOLD}[enter]${RST} confirm ${DIM}[q] quit${RST}`);
|
|
452
448
|
w("");
|
|
453
449
|
}
|
|
454
|
-
function runToolSelect(agent, mcpChanged
|
|
450
|
+
function runToolSelect(agent, mcpChanged) {
|
|
455
451
|
return new Promise((resolve) => {
|
|
456
452
|
const selected = TOOL_GROUPS.map(() => true);
|
|
457
453
|
let cursor = 0;
|
|
458
|
-
renderToolSelect(selected, cursor, agent, mcpChanged
|
|
454
|
+
renderToolSelect(selected, cursor, agent, mcpChanged);
|
|
459
455
|
process.stdin.setRawMode(true);
|
|
460
456
|
process.stdin.resume();
|
|
461
457
|
process.stdin.setEncoding("utf-8");
|
|
@@ -491,7 +487,7 @@ function runToolSelect(agent, mcpChanged, mode = "default") {
|
|
|
491
487
|
resolve(tools);
|
|
492
488
|
return;
|
|
493
489
|
}
|
|
494
|
-
renderToolSelect(selected, cursor, agent, mcpChanged
|
|
490
|
+
renderToolSelect(selected, cursor, agent, mcpChanged);
|
|
495
491
|
};
|
|
496
492
|
process.stdin.on("data", onData);
|
|
497
493
|
});
|
|
@@ -587,10 +583,14 @@ function installSkill(skillName) {
|
|
|
587
583
|
const REDDIT_EXTRA_TOOLS = [
|
|
588
584
|
"Bash(node */ingest.js *)",
|
|
589
585
|
];
|
|
586
|
+
/* ── Reddit setup banner ───────────────────────────────────────── */
|
|
587
|
+
function printRedditBanner() {
|
|
588
|
+
printBanner();
|
|
589
|
+
}
|
|
590
590
|
/* ── Reddit result screen ──────────────────────────────────────── */
|
|
591
591
|
function printRedditResult(agent, loginResult, mcpChanged, toolCount) {
|
|
592
592
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
593
|
-
|
|
593
|
+
printRedditBanner();
|
|
594
594
|
printBadge();
|
|
595
595
|
w("");
|
|
596
596
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
@@ -617,22 +617,26 @@ function printRedditResult(agent, loginResult, mcpChanged, toolCount) {
|
|
|
617
617
|
w(row(` ${WHITE_BOLD}Next steps${RST}`));
|
|
618
618
|
w(empty);
|
|
619
619
|
w(row(` ${BLUE}1.${RST} Type ${WHITE_BOLD}claude${RST} to start Claude Code`));
|
|
620
|
+
w(row(` ${BLUE}2.${RST} Run ${BLUE}/reddit-wiki r/<subreddit>${RST}`));
|
|
621
|
+
w(empty);
|
|
622
|
+
w(row(` ${DIM}Ask "how does reddit wiki work?" to learn more${RST}`));
|
|
620
623
|
w(empty);
|
|
621
624
|
w(` ${BLUE_DIM}\u2570${"─".repeat(innerW)}\u256f${RST}`);
|
|
622
625
|
w("");
|
|
623
626
|
}
|
|
624
627
|
/* ── Reddit entry point ────────────────────────────────────────── */
|
|
625
628
|
export async function runRedditSetup() {
|
|
629
|
+
bannerSubtitle = "Turn any subreddit into a published wiki";
|
|
626
630
|
const skipTui = process.argv.includes("--yes") || process.argv.includes("-y");
|
|
627
631
|
const interactive = process.stdin.isTTY && !skipTui;
|
|
628
632
|
let agent = "Claude Code";
|
|
629
633
|
if (interactive) {
|
|
630
|
-
agent = await runAgentSelect(
|
|
634
|
+
agent = await runAgentSelect();
|
|
631
635
|
}
|
|
632
636
|
const mcpChanged = configureMcp();
|
|
633
637
|
let tools;
|
|
634
638
|
if (interactive) {
|
|
635
|
-
tools = await runToolSelect(agent, mcpChanged
|
|
639
|
+
tools = await runToolSelect(agent, mcpChanged);
|
|
636
640
|
}
|
|
637
641
|
else {
|
|
638
642
|
tools = TOOL_GROUPS.flatMap((g) => g.tools);
|
|
@@ -643,7 +647,7 @@ export async function runRedditSetup() {
|
|
|
643
647
|
// Login step
|
|
644
648
|
let loginResult;
|
|
645
649
|
if (interactive) {
|
|
646
|
-
loginResult = await runLoginStep(agent, mcpChanged, count
|
|
650
|
+
loginResult = await runLoginStep(agent, mcpChanged, count);
|
|
647
651
|
}
|
|
648
652
|
else {
|
|
649
653
|
try {
|