sc-research 1.0.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/CLAUDE.md +67 -0
- package/README.md +111 -0
- package/dist/cli.js +671 -0
- package/dist/index.js +6530 -0
- package/dist/test/manual-fixed-links.js +186 -0
- package/dist/visualize.js +371 -0
- package/dist/web/assets/index-FB2oq23H.css +1 -0
- package/dist/web/assets/index-sZb3bzqd.js +44 -0
- package/dist/web/data.json +577 -0
- package/dist/web/index.html +14 -0
- package/dist/web/vite.svg +11 -0
- package/package.json +52 -0
- package/templates/base/commands/controversy.md +28 -0
- package/templates/base/commands/deep-research.md +25 -0
- package/templates/base/commands/discovery.md +27 -0
- package/templates/base/commands/quick.md +14 -0
- package/templates/base/commands/rank.md +27 -0
- package/templates/base/commands/research.md +10 -0
- package/templates/base/commands/sentiment.md +28 -0
- package/templates/base/commands/test-research.md +9 -0
- package/templates/base/commands/trend.md +27 -0
- package/templates/base/commands/visualize.md +14 -0
- package/templates/base/manifest.json +119 -0
- package/templates/base/skills/communities_controversy.md +65 -0
- package/templates/base/skills/communities_discovery.md +55 -0
- package/templates/base/skills/communities_fetch.md +56 -0
- package/templates/base/skills/communities_rank.md +57 -0
- package/templates/base/skills/communities_research_test.md +64 -0
- package/templates/base/skills/communities_sentiment.md +61 -0
- package/templates/base/skills/communities_trend.md +71 -0
- package/templates/base/skills/communities_visualize.md +46 -0
- package/templates/base/skills/using_communities_research.md +146 -0
- package/templates/platforms/agent.json +21 -0
- package/templates/platforms/claude.json +21 -0
- package/templates/platforms/codebuddy.json +21 -0
- package/templates/platforms/codex.json +21 -0
- package/templates/platforms/continue.json +21 -0
- package/templates/platforms/copilot.json +18 -0
- package/templates/platforms/cursor.json +18 -0
- package/templates/platforms/droid.json +21 -0
- package/templates/platforms/gemini.json +21 -0
- package/templates/platforms/kiro.json +18 -0
- package/templates/platforms/opencode.json +21 -0
- package/templates/platforms/qoder.json +21 -0
- package/templates/platforms/roocode.json +18 -0
- package/templates/platforms/trae.json +21 -0
- package/templates/platforms/windsurf.json +18 -0
package/CLAUDE.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Communities Research Skill
|
|
2
|
+
|
|
3
|
+
> **"The Skill provides the catch; the Agent cooks the meal."**
|
|
4
|
+
|
|
5
|
+
This project is a headless social media research tool designed for **Claude Code first**. It fetches raw discussion data from Reddit and X (Twitter), classifies it into multiple analysis templates, and visualizes results in a local dashboard.
|
|
6
|
+
|
|
7
|
+
## Canonical Source
|
|
8
|
+
|
|
9
|
+
- **Main source of truth:** `templates/base/` (skills + commands body templates)
|
|
10
|
+
- **Platform rules source:** `templates/platforms/*.json` (paths/format behavior)
|
|
11
|
+
- `.claude/`, `.cursor/`, `.agent/`, and other platform folders are rendered outputs from `sc-research init`.
|
|
12
|
+
|
|
13
|
+
## โก๏ธ Quick Start
|
|
14
|
+
|
|
15
|
+
This project uses `bun`.
|
|
16
|
+
|
|
17
|
+
### Environment Variables
|
|
18
|
+
Required in `.env`:
|
|
19
|
+
- `OPENAI_API_KEY`: For Reddit URL discovery and general LLM ops
|
|
20
|
+
- `XAI_API_KEY`: (Optional) For X/Twitter data
|
|
21
|
+
|
|
22
|
+
### Available Commands
|
|
23
|
+
- `/research <topic>` - Research + quick answer flow
|
|
24
|
+
- `/quick <topic>` - Fast Reddit-only quick answer
|
|
25
|
+
- `/deep-research <topic>` - Deep research + route to best template
|
|
26
|
+
- `/rank` - Generate ranking report (`classified_rank.json`)
|
|
27
|
+
- `/sentiment` - Generate sentiment report (`classified_sentiment.json`)
|
|
28
|
+
- `/trend` - Generate timeline report (`classified_trend.json`)
|
|
29
|
+
- `/controversy` - Generate controversy map (`classified_controversy.json`)
|
|
30
|
+
- `/discovery` - Generate discovery clusters (`classified_discovery.json`)
|
|
31
|
+
- `/visualize` - Launch dashboard (auto-detects available `classified_*.json`)
|
|
32
|
+
- `/test-research` - Run fixed-link pipeline test
|
|
33
|
+
|
|
34
|
+
### CLI Init Targets
|
|
35
|
+
- `sc-research init --ai claude` - Install Claude templates
|
|
36
|
+
- `sc-research init --ai claude,cursor` - Install multiple targets in one run
|
|
37
|
+
- `sc-research init --ai all` - Install all supported targets (`claude`, `cursor`, `windsurf`, `antigravity`)
|
|
38
|
+
|
|
39
|
+
## ๐๏ธ Architecture
|
|
40
|
+
|
|
41
|
+
- **Orchestrator**: `using_communities_research` (The routing brain)
|
|
42
|
+
- **Workers**:
|
|
43
|
+
- `communities_fetch` (Data provider)
|
|
44
|
+
- `communities_rank` (Ranking analysis)
|
|
45
|
+
- `communities_sentiment` (Sentiment analysis)
|
|
46
|
+
- `communities_trend` (Timeline analysis)
|
|
47
|
+
- `communities_controversy` (Debate analysis)
|
|
48
|
+
- `communities_discovery` (Viral topic clustering)
|
|
49
|
+
- `communities_visualize` (Dashboard launcher)
|
|
50
|
+
- `communities_research_test` (Legacy/fixed-link test helper)
|
|
51
|
+
|
|
52
|
+
## ๐งช Testing Rules
|
|
53
|
+
|
|
54
|
+
> **IMPORTANT**: Automated tests MUST NOT invoke paid AI APIs.
|
|
55
|
+
> Use `bun run test:fixed` for manual verification or the `/test-research` command.
|
|
56
|
+
|
|
57
|
+
## ๐ Project Rules
|
|
58
|
+
|
|
59
|
+
- Always use `bun` for runtime and scripts.
|
|
60
|
+
- Do not run paid AI API calls in automated tests.
|
|
61
|
+
|
|
62
|
+
## ๐ Project Structure
|
|
63
|
+
|
|
64
|
+
- `src/`: Core TypeScript logic
|
|
65
|
+
- `.claude/skills/`: AI Skill definitions
|
|
66
|
+
- `.claude/commands/`: User slash commands
|
|
67
|
+
- `web/`: React/Vite visualization app
|
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Social Media Research Skill
|
|
2
|
+
|
|
3
|
+
> **"The Skill provides the catch; the Agent cooks the meal."**
|
|
4
|
+
|
|
5
|
+
A **Headless Data Provider** for AI Agents. It researches topics across **Reddit** and **X (Twitter)**, returning raw, normalized, high-engagement discussion data for your Agent to analyze.
|
|
6
|
+
|
|
7
|
+
Now includes a **CLI installer** so you can drop the full research workflow into a Claude Code project with a single command.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Dynamic Source Detection**: Automatically switches between Reddit and X based on available API keys (`OPENAI_API_KEY`, `XAI_API_KEY`).
|
|
12
|
+
- **Unified Data Model**: Normalizes data from different platforms into a single `ResearchItem` schema.
|
|
13
|
+
- **AI-Native Output**: optimized for LLM consumption (JSON).
|
|
14
|
+
- **Engagement-Based Sorting**: Prioritizes content with high community interaction.
|
|
15
|
+
- **Multi-Platform Bootstrap**: Install AI assistant templates into any repo via CLI (`claude`, `cursor`, `windsurf`, `antigravity`).
|
|
16
|
+
|
|
17
|
+
## Installation (NPM + CLI)
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g sc-research
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then, in any project you want to bootstrap:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd /path/to/your/project
|
|
27
|
+
|
|
28
|
+
# Preview what init would do
|
|
29
|
+
sc-research init --ai claude,cursor --dry-run
|
|
30
|
+
|
|
31
|
+
# Apply one platform
|
|
32
|
+
sc-research init --ai claude
|
|
33
|
+
|
|
34
|
+
# Apply multiple platforms in one run
|
|
35
|
+
sc-research init --ai claude,cursor
|
|
36
|
+
|
|
37
|
+
# Apply all supported platforms
|
|
38
|
+
sc-research init --ai all
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
This now does **both**:
|
|
42
|
+
- Installs SC-Research templates for selected platform(s)
|
|
43
|
+
- Reads/updates your project `package.json` scripts so commands work immediately
|
|
44
|
+
|
|
45
|
+
Template architecture:
|
|
46
|
+
- `templates/base/` is the canonical source for command/skill content
|
|
47
|
+
- `templates/platforms/*.json` defines per-platform output rules used during `init`
|
|
48
|
+
|
|
49
|
+
## Usage with Claude Code
|
|
50
|
+
|
|
51
|
+
1. **Run init once per project**
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
sc-research init --ai claude
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This will add/update these scripts in your project `package.json`:
|
|
58
|
+
- `research`: `sc-research research`
|
|
59
|
+
- `research:deep`: `sc-research research --depth=deep`
|
|
60
|
+
- `visualize`: `sc-research visualize`
|
|
61
|
+
- `test:fixed`: `sc-research test:fixed`
|
|
62
|
+
|
|
63
|
+
2. **Open the project in Claude Code**
|
|
64
|
+
|
|
65
|
+
3. **Use the commands:**
|
|
66
|
+
|
|
67
|
+
- `/research <topic>` โ Quick research + answer
|
|
68
|
+
- `/deep-research <topic>` โ Deep fetch + best template routing
|
|
69
|
+
- `/rank` โ Rank existing data into `classified_rank.json`
|
|
70
|
+
- `/sentiment` โ Build sentiment report
|
|
71
|
+
- `/trend` โ Build timeline report
|
|
72
|
+
- `/controversy` โ Build controversy map
|
|
73
|
+
- `/discovery` โ Discover viral topics
|
|
74
|
+
- `/visualize` โ Launch dashboard
|
|
75
|
+
- `/test-research` โ Run fixed-link debug test
|
|
76
|
+
|
|
77
|
+
## Direct Bun CLI (Optional, existing behavior)
|
|
78
|
+
|
|
79
|
+
### CLI
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
# Research a topic
|
|
83
|
+
bun run research "Best budget IEM 2024"
|
|
84
|
+
|
|
85
|
+
# Specify output file
|
|
86
|
+
bun run research "Best budget IEM 2024" --out=./my_results.json
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Programmatic
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { SocialMediaResearch } from 'social-media-research-skill';
|
|
93
|
+
|
|
94
|
+
const researcher = new SocialMediaResearch();
|
|
95
|
+
const results = await researcher.search("Best budget IEM 2024");
|
|
96
|
+
|
|
97
|
+
console.log(results);
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## Configuration
|
|
101
|
+
|
|
102
|
+
Set the following environment variables in your `.env` file:
|
|
103
|
+
|
|
104
|
+
```env
|
|
105
|
+
OPENAI_API_KEY=sk-... # Required for Reddit (URL Discovery)
|
|
106
|
+
XAI_API_KEY=... # Required for X (Twitter)
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
MIT
|