@anysiteio/agent-skills 1.0.1 → 1.2.0

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.
@@ -0,0 +1,292 @@
1
+ ---
2
+ name: anysite-cli
3
+ description: Operate the anysite command-line tool for web data extraction, batch API processing, multi-source dataset pipelines with scheduling/transforms/exports, and database operations. Use when users ask to collect data from LinkedIn, Instagram, Twitter, or any web source via CLI; create or run dataset pipelines; schedule automated collection; batch-process API calls; query collected data with SQL; load data into PostgreSQL or SQLite; or work with anysite commands. Triggers on anysite CLI usage, data collection, dataset creation, scraping, API batch calls, scheduling, or database loading tasks.
4
+ ---
5
+
6
+ # Anysite CLI
7
+
8
+ Command-line tool for web data extraction, dataset pipelines, and database operations. All commands use `anysite` prefix and execute via Bash.
9
+
10
+ ## Prerequisites
11
+
12
+ ```bash
13
+ # Ensure CLI is installed
14
+ anysite --version
15
+
16
+ # Configure API key (one-time)
17
+ anysite config set api_key sk-xxxxx
18
+
19
+ # Update schema cache (required for endpoint discovery and type inference)
20
+ anysite schema update
21
+ ```
22
+
23
+ ## Workflow 1: Single API Call
24
+
25
+ ```bash
26
+ # Basic call — parameters as key=value pairs
27
+ anysite api /api/linkedin/user user=satyanadella
28
+
29
+ # With output options
30
+ anysite api /api/linkedin/company company=anthropic --format table
31
+ anysite api /api/linkedin/search/users title=CTO count=50 --format csv --output ctos.csv
32
+
33
+ # Field selection
34
+ anysite api /api/linkedin/user user=satyanadella --fields "name,headline,follower_count"
35
+ anysite api /api/linkedin/user user=satyanadella --exclude "certifications,patents"
36
+
37
+ # Quiet mode for piping
38
+ anysite api /api/linkedin/user user=satyanadella -q | jq '.follower_count'
39
+ ```
40
+
41
+ **Discover endpoints first:**
42
+ ```bash
43
+ anysite describe # List all endpoints
44
+ anysite describe /api/linkedin/company # Show input params + output fields
45
+ anysite describe --search "company" # Search by keyword
46
+ ```
47
+
48
+ See [api-reference.md](references/api-reference.md) for complete option reference.
49
+
50
+ ## Workflow 2: Batch Processing
51
+
52
+ Process multiple inputs from file or stdin with parallel execution and rate limiting.
53
+
54
+ ```bash
55
+ # From text file (one value per line)
56
+ anysite api /api/linkedin/user --from-file users.txt --input-key user --parallel 5
57
+
58
+ # From JSONL
59
+ anysite api /api/linkedin/user --from-file users.jsonl --parallel 3 --on-error skip
60
+
61
+ # With rate limiting and progress
62
+ anysite api /api/linkedin/user --from-file users.txt --input-key user \
63
+ --rate-limit "10/s" --on-error skip --progress --stats
64
+
65
+ # Pipe from stdin
66
+ cat companies.txt | anysite api /api/linkedin/company --stdin --input-key company \
67
+ --format csv --output results.csv
68
+ ```
69
+
70
+ **Key options:** `--parallel N`, `--rate-limit "10/s"`, `--on-error stop|skip|retry`, `--progress`, `--stats`
71
+
72
+ ## Workflow 3: Dataset Pipeline (Multi-Source Collection)
73
+
74
+ For complex data collection with dependencies between sources. Full guide: [dataset-guide.md](references/dataset-guide.md).
75
+
76
+ ### Step 1: Initialize
77
+ ```bash
78
+ anysite dataset init my-dataset
79
+ # Creates my-dataset/dataset.yaml with template config
80
+ ```
81
+
82
+ ### Step 2: Configure dataset.yaml
83
+
84
+ Three source types:
85
+ - **Independent** — single API call with static `params`
86
+ - **from_file** — batch calls iterating over input file values
87
+ - **Dependent** — batch calls using values extracted from a parent source
88
+
89
+ Per-source optional blocks: `transform` (filter/fields/add_columns for exports), `export` (file/webhook), `db_load` (fields for DB loading).
90
+
91
+ Top-level optional blocks: `schedule` (cron), `notifications` (webhooks on complete/failure).
92
+
93
+ ```yaml
94
+ name: my-dataset
95
+ sources:
96
+ - id: companies
97
+ endpoint: /api/linkedin/company
98
+ from_file: companies.txt
99
+ input_key: company
100
+ parallel: 3
101
+ transform: # Applied to exports only (Parquet keeps all fields)
102
+ filter: '.employee_count > 10'
103
+ fields: [name, url, employee_count]
104
+ add_columns:
105
+ batch: "q1-2026"
106
+ export: # Export after Parquet write
107
+ - type: file
108
+ path: ./output/companies-{{date}}.csv
109
+ format: csv
110
+ db_load:
111
+ fields: [name, url, employee_count]
112
+
113
+ - id: employees
114
+ endpoint: /api/linkedin/company/employees
115
+ dependency:
116
+ from_source: companies
117
+ field: urn.value # Dot-notation for nested JSON fields
118
+ dedupe: true
119
+ input_key: companies
120
+ input_template: # Transform extracted values
121
+ companies:
122
+ - type: company
123
+ value: "{value}"
124
+ count: 5
125
+ parallel: 3
126
+ on_error: skip
127
+
128
+ storage:
129
+ format: parquet
130
+ path: ./data/
131
+
132
+ schedule:
133
+ cron: "0 9 * * *" # Daily at 9 AM
134
+
135
+ notifications:
136
+ on_complete:
137
+ - url: "https://hooks.slack.com/xxx"
138
+ on_failure:
139
+ - url: "https://alerts.example.com/fail"
140
+ ```
141
+
142
+ ### Step 3: Collect
143
+ ```bash
144
+ # Preview plan
145
+ anysite dataset collect dataset.yaml --dry-run
146
+
147
+ # Run collection
148
+ anysite dataset collect dataset.yaml
149
+
150
+ # Collect and auto-load into database
151
+ anysite dataset collect dataset.yaml --load-db pg
152
+
153
+ # Incremental (skip already-collected inputs)
154
+ anysite dataset collect dataset.yaml --incremental --load-db pg
155
+
156
+ # Single source and its dependencies
157
+ anysite dataset collect dataset.yaml --source employees
158
+ ```
159
+
160
+ ### Step 4: Query with DuckDB
161
+ ```bash
162
+ # SQL query
163
+ anysite dataset query dataset.yaml --sql "SELECT * FROM companies LIMIT 10"
164
+
165
+ # Shorthand with dot-notation field extraction
166
+ anysite dataset query dataset.yaml --source profiles \
167
+ --fields "name, urn.value AS urn_id, headline"
168
+
169
+ # Interactive SQL shell
170
+ anysite dataset query dataset.yaml --interactive
171
+
172
+ # Stats and profiling
173
+ anysite dataset stats dataset.yaml --source companies
174
+ anysite dataset profile dataset.yaml
175
+ ```
176
+
177
+ ### Step 5: Load into Database
178
+ ```bash
179
+ # Load all sources with FK linking
180
+ anysite dataset load-db dataset.yaml -c pg --drop-existing
181
+
182
+ # Dry run
183
+ anysite dataset load-db dataset.yaml -c pg --dry-run
184
+ ```
185
+
186
+ `load-db` auto-creates tables with inferred schema, adds `id` primary key, and links child tables to parents via `{parent}_id` FK columns using provenance data.
187
+
188
+ Optional `db_load` config per source controls which fields go to DB:
189
+ ```yaml
190
+ - id: profiles
191
+ endpoint: /api/linkedin/user
192
+ db_load:
193
+ table: people # Custom table name
194
+ fields: # Select specific fields
195
+ - name
196
+ - urn.value AS urn_id # Dot-notation extraction
197
+ - headline
198
+ - experience
199
+ exclude: [_input_value] # Fields to skip
200
+ ```
201
+
202
+ ## Workflow 4: Database Operations
203
+
204
+ ```bash
205
+ # Add connection
206
+ anysite db add pg # Interactive prompts for type, host, port, etc.
207
+
208
+ # Test and inspect
209
+ anysite db test pg
210
+ anysite db list
211
+ anysite db schema pg --table users
212
+
213
+ # Insert data (auto-create table from schema inference)
214
+ cat data.jsonl | anysite db insert pg --table users --stdin --auto-create
215
+
216
+ # Upsert
217
+ cat updates.jsonl | anysite db upsert pg --table users --conflict-columns id --stdin
218
+
219
+ # Query
220
+ anysite db query pg --sql "SELECT * FROM users" --format table
221
+
222
+ # Pipe API output directly to database
223
+ anysite api /api/linkedin/user user=satyanadella -q --format jsonl \
224
+ | anysite db insert pg --table profiles --stdin --auto-create
225
+ ```
226
+
227
+ ### Step 6: History, Scheduling, and Notifications
228
+ ```bash
229
+ # View run history
230
+ anysite dataset history my-dataset
231
+
232
+ # View logs for a specific run
233
+ anysite dataset logs my-dataset --run 42
234
+
235
+ # Generate cron entry (with auto-load to DB)
236
+ anysite dataset schedule dataset.yaml --incremental --load-db pg
237
+
238
+ # Generate systemd timer units
239
+ anysite dataset schedule dataset.yaml --systemd --incremental --load-db pg
240
+
241
+ # Reset incremental state (re-collect everything)
242
+ anysite dataset reset-cursor dataset.yaml
243
+ anysite dataset reset-cursor dataset.yaml --source profiles
244
+ ```
245
+
246
+ ## Key Patterns
247
+
248
+ ### Output Formats
249
+ `--format json` (default) | `jsonl` | `csv` | `table`
250
+
251
+ ### Field Selection
252
+ - Include: `--fields "name,headline,urn.value"`
253
+ - Exclude: `--exclude "certifications,patents"`
254
+ - Presets: `--fields-preset minimal|contact|recruiting`
255
+ - Dot-notation for nested: `experience.company`, `urn.value`
256
+
257
+ ### Error Handling
258
+ - `--on-error stop` — halt on first error (default)
259
+ - `--on-error skip` — continue processing, skip failures
260
+ - `--on-error retry` — auto-retry with backoff
261
+
262
+ ### Config Priority
263
+ CLI args > Environment vars (`ANYSITE_API_KEY`) > `~/.anysite/config.yaml` > defaults
264
+
265
+ ## Common Recipes
266
+
267
+ ### Collect company intel and store in Postgres
268
+ ```bash
269
+ anysite dataset init company-intel
270
+ # Edit dataset.yaml with sources, transform, schedule, notifications...
271
+ anysite dataset collect company-intel/dataset.yaml --load-db pg
272
+ anysite db query pg --sql "SELECT c.name, COUNT(e.id) FROM companies c JOIN employees e ON e.companies_id = c.id GROUP BY c.name" --format table
273
+
274
+ # Set up daily schedule
275
+ anysite dataset schedule company-intel/dataset.yaml --incremental --load-db pg
276
+ # Add output to crontab
277
+ ```
278
+
279
+ ### Batch lookup and save to CSV
280
+ ```bash
281
+ anysite api /api/linkedin/user --from-file people.txt --input-key user \
282
+ --parallel 5 --rate-limit "10/s" --on-error skip \
283
+ --fields "name,headline,location,follower_count" \
284
+ --format csv --output people.csv --stats
285
+ ```
286
+
287
+ ### Quick endpoint exploration
288
+ ```bash
289
+ anysite describe --search "linkedin"
290
+ anysite describe /api/linkedin/company
291
+ anysite api /api/linkedin/company company=anthropic --format table
292
+ ```
@@ -0,0 +1,160 @@
1
+ # Anysite CLI API Reference
2
+
3
+ ## anysite api
4
+
5
+ Call any API endpoint. Parameters are `key=value` pairs, auto-typed via schema cache.
6
+
7
+ ```
8
+ anysite api <endpoint> [key=value ...] [OPTIONS]
9
+ ```
10
+
11
+ ### Output Options
12
+ ```
13
+ --format, -f TEXT json|jsonl|csv|table (default: json)
14
+ --fields TEXT Comma-separated fields to include (dot-notation supported)
15
+ --exclude TEXT Comma-separated fields to exclude
16
+ --fields-preset TEXT Built-in preset: minimal|contact|recruiting
17
+ --compact Compact JSON (no indentation)
18
+ --output, -o PATH Save to file
19
+ --append Append to existing output file
20
+ --quiet, -q Suppress non-data output (use for piping)
21
+ ```
22
+
23
+ ### Batch Input Options
24
+ ```
25
+ --from-file PATH Input file (txt/JSONL/CSV)
26
+ --stdin Read from stdin
27
+ --input-key TEXT Parameter name for input values
28
+ --parallel, -j INT Parallel requests (default: 1)
29
+ --delay FLOAT Delay between requests (seconds)
30
+ --rate-limit TEXT Rate limit: "10/s", "100/m", "1000/h"
31
+ --on-error TEXT Error handling: stop|skip|retry (default: stop)
32
+ ```
33
+
34
+ ### Progress Options
35
+ ```
36
+ --progress/--no-progress Show/hide progress bar
37
+ --stats Display statistics after completion
38
+ --verbose Detailed debug output
39
+ ```
40
+
41
+ ### Examples
42
+ ```bash
43
+ # Single call
44
+ anysite api /api/linkedin/user user=satyanadella --format table
45
+
46
+ # Batch with rate limiting
47
+ anysite api /api/linkedin/user --from-file users.txt --input-key user \
48
+ --parallel 5 --rate-limit "10/s" --on-error skip --format csv --output results.csv
49
+
50
+ # Pipe to jq
51
+ anysite api /api/linkedin/company company=anthropic -q | jq '.employee_count'
52
+
53
+ # Pipe to database
54
+ anysite api /api/linkedin/user user=satyanadella -q --format jsonl \
55
+ | anysite db insert mydb --table profiles --stdin --auto-create
56
+ ```
57
+
58
+ ---
59
+
60
+ ## anysite describe
61
+
62
+ Discover and inspect API endpoints.
63
+
64
+ ```
65
+ anysite describe [endpoint] [OPTIONS]
66
+ ```
67
+
68
+ ```
69
+ --search, -s TEXT Search endpoints by keyword
70
+ --json Output as JSON
71
+ --quiet, -q Show only paths
72
+ ```
73
+
74
+ ### Examples
75
+ ```bash
76
+ anysite describe # List all endpoints
77
+ anysite describe /api/linkedin/company # Full endpoint details
78
+ anysite describe --search "company" # Search by keyword
79
+ anysite describe --json -q # Machine-readable output
80
+ ```
81
+
82
+ Output shows: endpoint path, description, input parameters (name, type, required), output fields (name, type).
83
+
84
+ ---
85
+
86
+ ## anysite config
87
+
88
+ Manage configuration in `~/.anysite/config.yaml`.
89
+
90
+ ```bash
91
+ anysite config set <key> <value> # Set value (supports nesting: defaults.format)
92
+ anysite config get <key> # Get value
93
+ anysite config list # Show all settings
94
+ anysite config path # Show config file location
95
+ anysite config init # Interactive setup
96
+ anysite config reset --force # Reset to defaults
97
+ ```
98
+
99
+ ### Config Priority
100
+ 1. CLI arguments (`--api-key`)
101
+ 2. Environment variables (`ANYSITE_API_KEY`, `ANYSITE_BASE_URL`)
102
+ 3. Config file (`~/.anysite/config.yaml`)
103
+ 4. Defaults
104
+
105
+ ---
106
+
107
+ ## anysite schema
108
+
109
+ Manage the API schema cache.
110
+
111
+ ```bash
112
+ anysite schema update # Fetch and cache OpenAPI spec
113
+ ```
114
+
115
+ Schema is cached to `~/.anysite/schema.json`. Required for `anysite describe` and auto-type conversion in `anysite api`.
116
+
117
+ ---
118
+
119
+ ## Global Options
120
+
121
+ ```
122
+ --api-key TEXT Override API key
123
+ --base-url TEXT Override API base URL
124
+ --debug Enable debug output
125
+ --no-color Disable colored output
126
+ --version, -v Show version
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Common API Endpoints
132
+
133
+ ### LinkedIn
134
+ ```
135
+ /api/linkedin/user user=<username>
136
+ /api/linkedin/company company=<alias>
137
+ /api/linkedin/search/users keywords=<text> count=<n>
138
+ /api/linkedin/company/employees companies=[{type,value}] count=<n>
139
+ /api/linkedin/user/posts urn=<urn> count=<n>
140
+ /api/linkedin/post/comments urn=<urn> count=<n>
141
+ ```
142
+
143
+ ### Instagram
144
+ ```
145
+ /api/instagram/user user=<username>
146
+ /api/instagram/user/posts user=<username> count=<n>
147
+ ```
148
+
149
+ ### Twitter/X
150
+ ```
151
+ /api/twitter/user user=<username>
152
+ /api/twitter/user/posts user_id=<id> count=<n>
153
+ ```
154
+
155
+ ### Web
156
+ ```
157
+ /api/web/parse url=<url>
158
+ ```
159
+
160
+ Use `anysite describe --search <keyword>` to discover more endpoints.