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