openalmanac 0.2.36 → 0.2.37
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
CHANGED
|
@@ -580,8 +580,7 @@ function installSkill(skillName) {
|
|
|
580
580
|
}
|
|
581
581
|
/* ── Reddit-specific tool groups ───────────────────────────────── */
|
|
582
582
|
const REDDIT_EXTRA_TOOLS = [
|
|
583
|
-
"Bash(node *)",
|
|
584
|
-
"Bash(curl *)",
|
|
583
|
+
"Bash(node ~/.claude/skills/reddit-wiki/scripts/ingest.js *)",
|
|
585
584
|
];
|
|
586
585
|
/* ── Reddit setup banner ───────────────────────────────────────── */
|
|
587
586
|
function printRedditBanner() {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: reddit-wiki
|
|
3
3
|
description: Turn any subreddit into a published wiki on Almanac
|
|
4
|
-
allowed-tools: Bash(node
|
|
4
|
+
allowed-tools: Bash(node ${CLAUDE_SKILL_DIR}/scripts/ingest.js *), mcp__almanac__search_articles, mcp__almanac__search_communities, mcp__almanac__list_articles, mcp__almanac__read, mcp__almanac__download, mcp__almanac__new, mcp__almanac__publish, mcp__almanac__search_web, mcp__almanac__read_webpage, mcp__almanac__search_images, mcp__almanac__view_images, mcp__almanac__register_sources, mcp__almanac__login, mcp__almanac__create_community, Read(~/.openalmanac/**), Write(~/.openalmanac/**), Edit(~/.openalmanac/**)
|
|
5
5
|
argument-hint: r/<subreddit>
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -54,6 +54,10 @@ function parseArgs() {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
const subreddit = args[0].replace(/^r\//, "");
|
|
57
|
+
if (!/^[a-zA-Z0-9_]+$/.test(subreddit)) {
|
|
58
|
+
console.error(`Invalid subreddit name: ${subreddit}`);
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
57
61
|
const command = args[1]; // download, filter, or count
|
|
58
62
|
|
|
59
63
|
const opts = {
|
|
@@ -142,7 +146,9 @@ async function* paginateSearch(subreddit, type, since, limit = 100) {
|
|
|
142
146
|
|
|
143
147
|
const lastCreated = items[items.length - 1].created_utc;
|
|
144
148
|
if (!lastCreated) break;
|
|
145
|
-
|
|
149
|
+
const newAfter = new Date(lastCreated * 1000).toISOString();
|
|
150
|
+
if (newAfter === after) break; // no progress — would loop forever on duplicate timestamps
|
|
151
|
+
after = newAfter;
|
|
146
152
|
}
|
|
147
153
|
}
|
|
148
154
|
|
|
@@ -436,7 +442,7 @@ async function runDownload(opts) {
|
|
|
436
442
|
postCount += batch.length;
|
|
437
443
|
printProgress("Posts", postCount, estPosts);
|
|
438
444
|
}
|
|
439
|
-
postsStream.end();
|
|
445
|
+
await new Promise(resolve => postsStream.end(resolve));
|
|
440
446
|
console.error("");
|
|
441
447
|
|
|
442
448
|
// Download comments → raw/comments.jsonl
|
|
@@ -453,7 +459,7 @@ async function runDownload(opts) {
|
|
|
453
459
|
commentCount += batch.length;
|
|
454
460
|
printProgress("Comments", commentCount, estComments);
|
|
455
461
|
}
|
|
456
|
-
commentsStream.end();
|
|
462
|
+
await new Promise(resolve => commentsStream.end(resolve));
|
|
457
463
|
console.error("");
|
|
458
464
|
}
|
|
459
465
|
|