openalmanac 0.2.46 → 0.2.48
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 +38 -26
- package/package.json +1 -2
package/dist/setup.js
CHANGED
|
@@ -2,7 +2,6 @@ import { readFileSync, writeFileSync, mkdirSync, existsSync, cpSync } from "fs";
|
|
|
2
2
|
import { homedir } from "os";
|
|
3
3
|
import { join, dirname } from "path";
|
|
4
4
|
import { fileURLToPath } from "url";
|
|
5
|
-
import figlet from "figlet";
|
|
6
5
|
import { performLogin } from "./login-core.js";
|
|
7
6
|
import { getAuthStatus } from "./auth.js";
|
|
8
7
|
const TOOL_GROUPS = [
|
|
@@ -95,18 +94,20 @@ const GRADIENT = [
|
|
|
95
94
|
"\x1b[38;5;243m",
|
|
96
95
|
];
|
|
97
96
|
/* ── ASCII banner ───────────────────────────────────────────────── */
|
|
98
|
-
const LOGO_LINES =
|
|
99
|
-
|
|
97
|
+
const LOGO_LINES = [
|
|
98
|
+
" \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2557 \u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2588\u2588\u2557",
|
|
99
|
+
"\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2551 \u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2550\u2550\u255d",
|
|
100
|
+
"\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2554\u2588\u2588\u2588\u2588\u2554\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2554\u2588\u2588\u2557 \u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2551 ",
|
|
101
|
+
"\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 \u2588\u2588\u2551\u255a\u2588\u2588\u2554\u255d\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551\u255a\u2588\u2588\u2557\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2551 ",
|
|
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
|
+
"\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
|
+
];
|
|
105
|
+
function printBanner() {
|
|
100
106
|
process.stdout.write("\n");
|
|
101
107
|
for (let i = 0; i < LOGO_LINES.length; i++) {
|
|
102
108
|
process.stdout.write(`${GRADIENT[i]}${LOGO_LINES[i]}${RST}\n`);
|
|
103
109
|
}
|
|
104
|
-
process.stdout.write(`\n${
|
|
105
|
-
}
|
|
106
|
-
function renderHeader(mode = "default") {
|
|
107
|
-
printBanner(mode === "reddit"
|
|
108
|
-
? "Turn any subreddit into a published wiki"
|
|
109
|
-
: "Write and publish articles with your AI agent");
|
|
110
|
+
process.stdout.write(`\n${DIM} Write and publish articles with your AI agent${RST}\n`);
|
|
110
111
|
}
|
|
111
112
|
function printBadge() {
|
|
112
113
|
process.stdout.write(`\n ${ACCENT_BG} almanac ${RST}\n`);
|
|
@@ -196,9 +197,9 @@ function configurePermissions(tools) {
|
|
|
196
197
|
return tools.length;
|
|
197
198
|
}
|
|
198
199
|
/* ── Agent selection screen ─────────────────────────────────────── */
|
|
199
|
-
function renderAgentSelect(_cursor
|
|
200
|
+
function renderAgentSelect(_cursor) {
|
|
200
201
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
201
|
-
|
|
202
|
+
printBanner();
|
|
202
203
|
printBadge();
|
|
203
204
|
w("");
|
|
204
205
|
stepActive(`Select your agent`);
|
|
@@ -215,9 +216,9 @@ function renderAgentSelect(_cursor, mode = "default") {
|
|
|
215
216
|
w(` ${DIM}\u2502${RST} ${BLUE}${BOLD}[enter]${RST} confirm ${DIM}[q] quit${RST}`);
|
|
216
217
|
w("");
|
|
217
218
|
}
|
|
218
|
-
function runAgentSelect(
|
|
219
|
+
function runAgentSelect() {
|
|
219
220
|
return new Promise((resolve) => {
|
|
220
|
-
renderAgentSelect(0
|
|
221
|
+
renderAgentSelect(0);
|
|
221
222
|
process.stdin.setRawMode(true);
|
|
222
223
|
process.stdin.resume();
|
|
223
224
|
process.stdin.setEncoding("utf-8");
|
|
@@ -271,7 +272,7 @@ function waitForKey(prompt) {
|
|
|
271
272
|
process.stdin.on("data", onData);
|
|
272
273
|
});
|
|
273
274
|
}
|
|
274
|
-
async function runLoginStep(agent, mcpChanged, toolCount
|
|
275
|
+
async function runLoginStep(agent, mcpChanged, toolCount) {
|
|
275
276
|
const priorSteps = () => {
|
|
276
277
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
277
278
|
w(BAR);
|
|
@@ -282,7 +283,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
282
283
|
};
|
|
283
284
|
function renderLoginChoice(name, cursor) {
|
|
284
285
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
285
|
-
|
|
286
|
+
printBanner();
|
|
286
287
|
printBadge();
|
|
287
288
|
w("");
|
|
288
289
|
priorSteps();
|
|
@@ -346,7 +347,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
346
347
|
}
|
|
347
348
|
// Show prompt before opening browser
|
|
348
349
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
349
|
-
|
|
350
|
+
printBanner();
|
|
350
351
|
printBadge();
|
|
351
352
|
w("");
|
|
352
353
|
priorSteps();
|
|
@@ -359,7 +360,7 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
359
360
|
// Show waiting state with cancel/retry hint
|
|
360
361
|
const renderWaiting = () => {
|
|
361
362
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
362
|
-
|
|
363
|
+
printBanner();
|
|
363
364
|
printBadge();
|
|
364
365
|
w("");
|
|
365
366
|
priorSteps();
|
|
@@ -422,9 +423,9 @@ async function runLoginStep(agent, mcpChanged, toolCount, mode = "default") {
|
|
|
422
423
|
}
|
|
423
424
|
/* ── Tool permissions TUI ───────────────────────────────────────── */
|
|
424
425
|
const MAX_NAME = Math.max(...TOOL_GROUPS.map((g) => g.name.length));
|
|
425
|
-
function renderToolSelect(selected, cursor, agent, mcpChanged
|
|
426
|
+
function renderToolSelect(selected, cursor, agent, mcpChanged) {
|
|
426
427
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
427
|
-
|
|
428
|
+
printBanner();
|
|
428
429
|
printBadge();
|
|
429
430
|
w("");
|
|
430
431
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
@@ -445,11 +446,11 @@ function renderToolSelect(selected, cursor, agent, mcpChanged, mode = "default")
|
|
|
445
446
|
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}`);
|
|
446
447
|
w("");
|
|
447
448
|
}
|
|
448
|
-
function runToolSelect(agent, mcpChanged
|
|
449
|
+
function runToolSelect(agent, mcpChanged) {
|
|
449
450
|
return new Promise((resolve) => {
|
|
450
451
|
const selected = TOOL_GROUPS.map(() => true);
|
|
451
452
|
let cursor = 0;
|
|
452
|
-
renderToolSelect(selected, cursor, agent, mcpChanged
|
|
453
|
+
renderToolSelect(selected, cursor, agent, mcpChanged);
|
|
453
454
|
process.stdin.setRawMode(true);
|
|
454
455
|
process.stdin.resume();
|
|
455
456
|
process.stdin.setEncoding("utf-8");
|
|
@@ -485,7 +486,7 @@ function runToolSelect(agent, mcpChanged, mode = "default") {
|
|
|
485
486
|
resolve(tools);
|
|
486
487
|
return;
|
|
487
488
|
}
|
|
488
|
-
renderToolSelect(selected, cursor, agent, mcpChanged
|
|
489
|
+
renderToolSelect(selected, cursor, agent, mcpChanged);
|
|
489
490
|
};
|
|
490
491
|
process.stdin.on("data", onData);
|
|
491
492
|
});
|
|
@@ -581,10 +582,18 @@ function installSkill(skillName) {
|
|
|
581
582
|
const REDDIT_EXTRA_TOOLS = [
|
|
582
583
|
"Bash(node */ingest.js *)",
|
|
583
584
|
];
|
|
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
|
+
}
|
|
584
593
|
/* ── Reddit result screen ──────────────────────────────────────── */
|
|
585
594
|
function printRedditResult(agent, loginResult, mcpChanged, toolCount) {
|
|
586
595
|
process.stdout.write("\x1b[2J\x1b[H");
|
|
587
|
-
|
|
596
|
+
printRedditBanner();
|
|
588
597
|
printBadge();
|
|
589
598
|
w("");
|
|
590
599
|
stepDone(`Agent \u2192 ${WHITE_BOLD}${agent}${RST}`);
|
|
@@ -611,6 +620,9 @@ function printRedditResult(agent, loginResult, mcpChanged, toolCount) {
|
|
|
611
620
|
w(row(` ${WHITE_BOLD}Next steps${RST}`));
|
|
612
621
|
w(empty);
|
|
613
622
|
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}`));
|
|
614
626
|
w(empty);
|
|
615
627
|
w(` ${BLUE_DIM}\u2570${"─".repeat(innerW)}\u256f${RST}`);
|
|
616
628
|
w("");
|
|
@@ -621,12 +633,12 @@ export async function runRedditSetup() {
|
|
|
621
633
|
const interactive = process.stdin.isTTY && !skipTui;
|
|
622
634
|
let agent = "Claude Code";
|
|
623
635
|
if (interactive) {
|
|
624
|
-
agent = await runAgentSelect(
|
|
636
|
+
agent = await runAgentSelect();
|
|
625
637
|
}
|
|
626
638
|
const mcpChanged = configureMcp();
|
|
627
639
|
let tools;
|
|
628
640
|
if (interactive) {
|
|
629
|
-
tools = await runToolSelect(agent, mcpChanged
|
|
641
|
+
tools = await runToolSelect(agent, mcpChanged);
|
|
630
642
|
}
|
|
631
643
|
else {
|
|
632
644
|
tools = TOOL_GROUPS.flatMap((g) => g.tools);
|
|
@@ -637,7 +649,7 @@ export async function runRedditSetup() {
|
|
|
637
649
|
// Login step
|
|
638
650
|
let loginResult;
|
|
639
651
|
if (interactive) {
|
|
640
|
-
loginResult = await runLoginStep(agent, mcpChanged, count
|
|
652
|
+
loginResult = await runLoginStep(agent, mcpChanged, count);
|
|
641
653
|
}
|
|
642
654
|
else {
|
|
643
655
|
try {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "openalmanac",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.48",
|
|
4
4
|
"description": "OpenAlmanac — pull, edit, and push articles to the open knowledge base",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -21,7 +21,6 @@
|
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"fastmcp": "^3.34.0",
|
|
24
|
-
"figlet": "^1.11.0",
|
|
25
24
|
"yaml": "^2.8.2",
|
|
26
25
|
"zod": "^3.24.0"
|
|
27
26
|
},
|