Skip to content

ZJU-REAL/Easel / skills/builtin/skill-xhs-analyzer

redbook

Flagged

小红书内容分析:搜索笔记、拉取互动数据、分析爆款规律、创作者画像、限流检测,支持 CLI 自动化操作。 当用户说"小红书数据分析""小红书爆款分析""笔记数据""小红书限流检测""小红书创作者画像""分析小红书账号"时使用。 发布与日常互动运营请用 skill-xhs-publisher。

FileKindSize
.github/workflows/npm-publish.ymlconfig3.8 KB
EASEL-META.mdmarkdown2.1 KB
SKILL.mdskill md5.2 KB
package-lock.jsonmanifest36.6 KB
package.jsonmanifest1.6 KB
references/commands.mdmarkdown4.4 KB
references/modules.mdmarkdown6.2 KB
references/platform-signals.mdmarkdown1.7 KB
references/research-loop.mdmarkdown8.2 KB
references/technical-reference.mdmarkdown3.8 KB
scripts/postinstall.jsscript4.5 KB
scripts/preuninstall.jsscript1.4 KB
social-preview.htmlother5.1 KB
social-preview.pngbinary261.4 KB
src/cli.tsscript76.8 KB
src/lib/analyze.tsscript20.0 KB
src/lib/cdp-cookies.tsscript13.1 KB
src/lib/client.tsscript22.2 KB
src/lib/cookies.tsscript13.3 KB
src/lib/creator-signing.tsscript1.8 KB
src/lib/detect.tsscript6.6 KB
src/lib/fingerprint-data.tsscript2.3 KB
src/lib/health.tsscript5.5 KB
src/lib/platform.tsscript2.7 KB
src/lib/render.tsscript19.5 KB
src/lib/reply-strategy.tsscript6.0 KB
src/lib/signing.tsscript21.1 KB
src/lib/template.tsscript8.0 KB
src/lib/url.tsscript1.8 KB
tsconfig.jsonconfig458 B

scripts/postinstall.js

View on GitHub
#!/usr/bin/env node
/**
 * Post-install script for redbook CLI.
 *
 * Sets up Claude Code skill by creating a symlink:
 *   ~/.claude/skills/redbook -> <npm-package-location>
 *
 * This gives Claude Code a /redbook slash command automatically.
 */

import { existsSync, mkdirSync, unlinkSync, symlinkSync, lstatSync, readlinkSync, rmSync, readFileSync, writeFileSync } from 'fs';
import { join, dirname } from 'path';
import { fileURLToPath } from 'url';
import { homedir } from 'os';

const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);

const PACKAGE_ROOT = join(__dirname, '..');
const SKILL_DIR = join(homedir(), '.claude', 'skills');
const SKILL_LINK = join(SKILL_DIR, 'redbook');

function setupClaudeSkill() {
  try {
    if (!existsSync(SKILL_DIR)) {
      mkdirSync(SKILL_DIR, { recursive: true });
    }

    if (existsSync(SKILL_LINK)) {
      try {
        const stats = lstatSync(SKILL_LINK);
        if (stats.isSymbolicLink()) {
          const currentTarget = readlinkSync(SKILL_LINK);
          if (currentTarget === PACKAGE_ROOT) {
            console.log('[redbook] Claude Code skill already configured.');
            return true;
          }
          unlinkSync(SKILL_LINK);
        } else {
          rmSync(SKILL_LINK, { recursive: true });
        }
      } catch (err) {
        console.log(`[redbook] Warning: ${err.message}`);
      }
    }

    symlinkSync(PACKAGE_ROOT, SKILL_LINK);
    console.log('[redbook] Claude Code skill installed:');
    console.log(`[redbook]   ~/.claude/skills/redbook -> ${PACKAGE_ROOT}`);
    return true;
  } catch (error) {
    console.error(`[redbook] Failed to set up skill: ${error.message}`);
    console.log('[redbook] You can manually create the symlink:');
    console.log(`[redbook]   ln -s "${PACKAGE_ROOT}" "${SKILL_LINK}"`);
    return false;
  }
}

/**
 * Patch @steipete/sweet-cookie keychain timeout bug.
 *
 * Published v0.1.0 hardcodes `timeoutMs: 3_000` in chromeSqliteMac.js,
 * ignoring the caller's value. The macOS `security` CLI often needs >3s
 * (especially on first keychain prompt). This patch makes it respect
 * the caller's timeout with a 30s default.
 */
function patchSweetCookieTimeout() {
  const target = join(
    PACKAGE_ROOT,
    'node_modules',
    '@steipete',
    'sweet-cookie',
    'dist',
    'providers',
    'chromeSqliteMac.js'
  );

  if (!existsSync(target)) return;

  try {
    const content = readFileSync(target, 'utf-8');
    const needle = 'timeoutMs: 3_000,';
    if (!content.includes(needle)) {
      // Already patched or upstream fixed
      return;
    }
    const patched = content.replace(needle, 'timeoutMs: options.timeoutMs ?? 30_000,');
    writeFileSync(target, patched, 'utf-8');
    console.log('[redbook] Patched sweet-cookie keychain timeout (3s -> 30s).');
  } catch (err) {
    console.log(`[redbook] Warning: could not patch sweet-cookie: ${err.message}`);
  }
}

/**
 * Patch node:sqlite BigInt overflow on Node < 24.4.
 *
 * Chrome stores expires_utc as microseconds since 1601 — values like
 * 13448382439000000 exceed Number.MAX_SAFE_INTEGER. Node < 24.4 lacks
 * the `readBigInts` option, so node:sqlite throws instead of returning
 * a BigInt. Casting to TEXT in the SQL avoids the overflow; the existing
 * JS code already handles string values via tryParseInt/normalizeExpiration.
 */
function patchSweetCookieBigInt() {
  const target = join(
    PACKAGE_ROOT,
    'node_modules',
    '@steipete',
    'sweet-cookie',
    'dist',
    'providers',
    'chromeSqlite',
    'shared.js'
  );

  if (!existsSync(target)) return;

  try {
    const content = readFileSync(target, 'utf-8');
    const needle = 'SELECT name, value, host_key, path, expires_utc, samesite, encrypted_value,';
    if (!content.includes(needle)) {
      // Already patched or upstream fixed
      return;
    }
    const patched = content.replace(
      needle,
      'SELECT name, value, host_key, path, CAST(expires_utc AS TEXT) AS expires_utc, samesite, encrypted_value,'
    );
    writeFileSync(target, patched, 'utf-8');
    console.log('[redbook] Patched sweet-cookie BigInt overflow (CAST expires_utc).');
  } catch (err) {
    console.log(`[redbook] Warning: could not patch sweet-cookie BigInt: ${err.message}`);
  }
}

function main() {
  console.log('[redbook] Running post-install...');
  const success = setupClaudeSkill();
  patchSweetCookieTimeout();
  patchSweetCookieBigInt();
  console.log('');
  console.log('[redbook] Installation complete!');
  if (success) {
    console.log('[redbook] Use /redbook in Claude Code, or run: redbook --help');
  }
}

main();
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall