cli-community-intelligence 0.1.15 → 0.1.17
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/openclaw-extension.js +40 -45
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -3
package/openclaw-extension.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
// ABOUTME: OpenClaw plugin extension entry point
|
|
2
2
|
// ABOUTME: Registers community-intelligence CLI commands as OpenClaw tools
|
|
3
3
|
|
|
4
|
+
import { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry'
|
|
5
|
+
import { Type } from '@sinclair/typebox'
|
|
4
6
|
import { exec } from 'child_process'
|
|
5
7
|
import { promisify } from 'util'
|
|
6
8
|
import { dirname, resolve } from 'path'
|
|
@@ -43,20 +45,37 @@ const F = {
|
|
|
43
45
|
try {
|
|
44
46
|
const { stdout, stderr } = await execAsync(cmd)
|
|
45
47
|
const text = [stdout, stderr].filter(Boolean).join('\n')
|
|
46
|
-
return { content: [{ type: 'text', text }]
|
|
48
|
+
return { content: [{ type: 'text', text }] }
|
|
47
49
|
} catch (error) {
|
|
48
|
-
return { content: [{ type: 'text', text: `Error: ${String(error)}` }]
|
|
50
|
+
return { content: [{ type: 'text', text: `Error: ${String(error)}` }] }
|
|
49
51
|
}
|
|
50
52
|
},
|
|
51
53
|
}
|
|
52
54
|
|
|
55
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
56
|
+
//
|
|
57
|
+
// Constants
|
|
58
|
+
//
|
|
59
|
+
// ---------------------------------------------------------------------------------------------------------------------
|
|
60
|
+
|
|
61
|
+
const queryFilterParams = Type.Object({
|
|
62
|
+
source: Type.Optional(Type.String({ description: 'Filter by source (reddit, youtube)' })),
|
|
63
|
+
channel: Type.Optional(Type.String({ description: 'Filter by channel/subreddit' })),
|
|
64
|
+
text: Type.Optional(Type.String({ description: 'Search text in body and title' })),
|
|
65
|
+
author: Type.Optional(Type.String({ description: 'Filter by author' })),
|
|
66
|
+
since: Type.Optional(Type.String({ description: 'Posts after this date (ISO 8601)' })),
|
|
67
|
+
until: Type.Optional(Type.String({ description: 'Posts before this date (ISO 8601)' })),
|
|
68
|
+
minScore: Type.Optional(Type.Number({ description: 'Minimum score' })),
|
|
69
|
+
limit: Type.Optional(Type.Number({ description: 'Maximum number of results' })),
|
|
70
|
+
})
|
|
71
|
+
|
|
53
72
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
54
73
|
//
|
|
55
74
|
// Exports
|
|
56
75
|
//
|
|
57
76
|
// ---------------------------------------------------------------------------------------------------------------------
|
|
58
77
|
|
|
59
|
-
export default {
|
|
78
|
+
export default definePluginEntry({
|
|
60
79
|
id: 'cli-community-intelligence',
|
|
61
80
|
name: 'Community Intelligence',
|
|
62
81
|
description: 'Scrape and query posts from online communities (Reddit, YouTube)',
|
|
@@ -65,20 +84,20 @@ export default {
|
|
|
65
84
|
name: 'community-intelligence-scrape',
|
|
66
85
|
description:
|
|
67
86
|
'Scrape posts and comments from online communities (Reddit, YouTube). ' +
|
|
68
|
-
'Use
|
|
69
|
-
'Supports
|
|
70
|
-
parameters: {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
},
|
|
80
|
-
|
|
81
|
-
},
|
|
87
|
+
'Use subreddits for Reddit, query or channels for YouTube. ' +
|
|
88
|
+
'Supports incremental to only fetch new posts since last scrape.',
|
|
89
|
+
parameters: Type.Object({
|
|
90
|
+
source: Type.String({ description: 'Source platform to scrape', enum: ['reddit', 'youtube'] }),
|
|
91
|
+
subreddits: Type.Optional(
|
|
92
|
+
Type.String({ description: 'Comma-separated subreddit names (reddit only)' }),
|
|
93
|
+
),
|
|
94
|
+
query: Type.Optional(Type.String({ description: 'Search query (youtube only)' })),
|
|
95
|
+
channels: Type.Optional(
|
|
96
|
+
Type.String({ description: 'Comma-separated YouTube channel IDs (youtube only)' }),
|
|
97
|
+
),
|
|
98
|
+
incremental: Type.Optional(Type.Boolean({ description: 'Only fetch posts newer than last scrape' })),
|
|
99
|
+
backfill: Type.Optional(Type.Number({ description: 'Number of days to backfill' })),
|
|
100
|
+
}),
|
|
82
101
|
execute: F.buildExecutor('scrape'),
|
|
83
102
|
})
|
|
84
103
|
|
|
@@ -86,46 +105,22 @@ export default {
|
|
|
86
105
|
name: 'community-intelligence-query',
|
|
87
106
|
description:
|
|
88
107
|
'Search the scraped community posts corpus. Filter by source, channel, text, author, date range, or score.',
|
|
89
|
-
parameters:
|
|
90
|
-
type: 'object',
|
|
91
|
-
properties: {
|
|
92
|
-
source: { type: 'string', description: 'Filter by source (reddit, youtube)' },
|
|
93
|
-
channel: { type: 'string', description: 'Filter by channel/subreddit' },
|
|
94
|
-
text: { type: 'string', description: 'Search text in body and title' },
|
|
95
|
-
author: { type: 'string', description: 'Filter by author' },
|
|
96
|
-
since: { type: 'string', description: 'Posts after this date (ISO 8601)' },
|
|
97
|
-
until: { type: 'string', description: 'Posts before this date (ISO 8601)' },
|
|
98
|
-
minScore: { type: 'number', description: 'Minimum score' },
|
|
99
|
-
limit: { type: 'number', description: 'Maximum number of results' },
|
|
100
|
-
},
|
|
101
|
-
},
|
|
108
|
+
parameters: queryFilterParams,
|
|
102
109
|
execute: F.buildExecutor('query'),
|
|
103
110
|
})
|
|
104
111
|
|
|
105
112
|
api.registerTool({
|
|
106
113
|
name: 'community-intelligence-status',
|
|
107
114
|
description: 'Show summary statistics for the scraped community intelligence corpus.',
|
|
108
|
-
parameters: {
|
|
115
|
+
parameters: Type.Object({}),
|
|
109
116
|
execute: F.buildExecutor('status'),
|
|
110
117
|
})
|
|
111
118
|
|
|
112
119
|
api.registerTool({
|
|
113
120
|
name: 'community-intelligence-export',
|
|
114
121
|
description: 'Export matching posts as JSON. Same filters as query.',
|
|
115
|
-
parameters:
|
|
116
|
-
type: 'object',
|
|
117
|
-
properties: {
|
|
118
|
-
source: { type: 'string', description: 'Filter by source (reddit, youtube)' },
|
|
119
|
-
channel: { type: 'string', description: 'Filter by channel/subreddit' },
|
|
120
|
-
text: { type: 'string', description: 'Search text in body and title' },
|
|
121
|
-
author: { type: 'string', description: 'Filter by author' },
|
|
122
|
-
since: { type: 'string', description: 'Posts after this date (ISO 8601)' },
|
|
123
|
-
until: { type: 'string', description: 'Posts before this date (ISO 8601)' },
|
|
124
|
-
minScore: { type: 'number', description: 'Minimum score' },
|
|
125
|
-
limit: { type: 'number', description: 'Maximum number of results' },
|
|
126
|
-
},
|
|
127
|
-
},
|
|
122
|
+
parameters: queryFilterParams,
|
|
128
123
|
execute: F.buildExecutor('export'),
|
|
129
124
|
})
|
|
130
125
|
},
|
|
131
|
-
}
|
|
126
|
+
})
|
package/openclaw.plugin.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "cli-community-intelligence",
|
|
3
3
|
"name": "Community Intelligence",
|
|
4
4
|
"description": "Scrape and query posts from online communities (Reddit, YouTube)",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.17",
|
|
6
6
|
"contracts": {
|
|
7
7
|
"tools": [
|
|
8
8
|
"community-intelligence-scrape",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cli-community-intelligence",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "Community intelligence scraper for construction industry market research",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -14,9 +14,14 @@
|
|
|
14
14
|
"openclaw": {
|
|
15
15
|
"extensions": [
|
|
16
16
|
"./openclaw-extension.js"
|
|
17
|
-
]
|
|
17
|
+
],
|
|
18
|
+
"compat": {
|
|
19
|
+
"pluginApi": ">=2026.3.28",
|
|
20
|
+
"minGatewayVersion": "2026.3.28"
|
|
21
|
+
}
|
|
18
22
|
},
|
|
19
23
|
"dependencies": {
|
|
20
|
-
"better-sqlite3": "^8.7.0"
|
|
24
|
+
"better-sqlite3": "^8.7.0",
|
|
25
|
+
"@sinclair/typebox": "0.34.49"
|
|
21
26
|
}
|
|
22
27
|
}
|