@lucasygu/redbook 0.2.0 → 0.3.1

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/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "@lucasygu/redbook",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
4
4
  "description": "CLI tool for Xiaohongshu (Red Note) - read and post via private API",
5
5
  "type": "module",
6
6
  "main": "./dist/lib/client.js",
7
7
  "exports": {
8
8
  ".": "./dist/lib/client.js",
9
9
  "./cookies": "./dist/lib/cookies.js",
10
- "./signing": "./dist/lib/signing.js"
10
+ "./signing": "./dist/lib/signing.js",
11
+ "./render": "./dist/lib/render.js"
11
12
  },
12
13
  "bin": {
13
14
  "redbook": "dist/cli.js"
@@ -53,8 +54,22 @@
53
54
  "commander": "^13.1.0",
54
55
  "kleur": "^4.1.5"
55
56
  },
57
+ "peerDependencies": {
58
+ "puppeteer-core": ">=21.0.0",
59
+ "marked": ">=9.0.0"
60
+ },
61
+ "peerDependenciesMeta": {
62
+ "puppeteer-core": {
63
+ "optional": true
64
+ },
65
+ "marked": {
66
+ "optional": true
67
+ }
68
+ },
56
69
  "devDependencies": {
57
70
  "@types/node": "^22.0.0",
71
+ "puppeteer-core": "^24.0.0",
72
+ "marked": "^15.0.0",
58
73
  "typescript": "^5.7.0"
59
74
  }
60
75
  }
@@ -8,7 +8,7 @@
8
8
  * This gives Claude Code a /redbook slash command automatically.
9
9
  */
10
10
 
11
- import { existsSync, mkdirSync, unlinkSync, symlinkSync, lstatSync, readlinkSync, rmSync } from 'fs';
11
+ import { existsSync, mkdirSync, unlinkSync, symlinkSync, lstatSync, readlinkSync, rmSync, readFileSync, writeFileSync } from 'fs';
12
12
  import { join, dirname } from 'path';
13
13
  import { fileURLToPath } from 'url';
14
14
  import { homedir } from 'os';
@@ -56,9 +56,46 @@ function setupClaudeSkill() {
56
56
  }
57
57
  }
58
58
 
59
+ /**
60
+ * Patch @steipete/sweet-cookie keychain timeout bug.
61
+ *
62
+ * Published v0.1.0 hardcodes `timeoutMs: 3_000` in chromeSqliteMac.js,
63
+ * ignoring the caller's value. The macOS `security` CLI often needs >3s
64
+ * (especially on first keychain prompt). This patch makes it respect
65
+ * the caller's timeout with a 30s default.
66
+ */
67
+ function patchSweetCookieTimeout() {
68
+ const target = join(
69
+ PACKAGE_ROOT,
70
+ 'node_modules',
71
+ '@steipete',
72
+ 'sweet-cookie',
73
+ 'dist',
74
+ 'providers',
75
+ 'chromeSqliteMac.js'
76
+ );
77
+
78
+ if (!existsSync(target)) return;
79
+
80
+ try {
81
+ const content = readFileSync(target, 'utf-8');
82
+ const needle = 'timeoutMs: 3_000,';
83
+ if (!content.includes(needle)) {
84
+ // Already patched or upstream fixed
85
+ return;
86
+ }
87
+ const patched = content.replace(needle, 'timeoutMs: options.timeoutMs ?? 30_000,');
88
+ writeFileSync(target, patched, 'utf-8');
89
+ console.log('[redbook] Patched sweet-cookie keychain timeout (3s -> 30s).');
90
+ } catch (err) {
91
+ console.log(`[redbook] Warning: could not patch sweet-cookie: ${err.message}`);
92
+ }
93
+ }
94
+
59
95
  function main() {
60
96
  console.log('[redbook] Running post-install...');
61
97
  const success = setupClaudeSkill();
98
+ patchSweetCookieTimeout();
62
99
  console.log('');
63
100
  console.log('[redbook] Installation complete!');
64
101
  if (success) {