@agent-analytics/cli 0.1.7 → 0.1.8

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.
Files changed (3) hide show
  1. package/README.md +13 -13
  2. package/bin/cli.mjs +26 -26
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -8,35 +8,35 @@ Web analytics your AI agent can read. Drop a JS snippet on your site, query the
8
8
  # 1. Get your API key from https://api.agentanalytics.sh (sign in with GitHub)
9
9
 
10
10
  # 2. Save your key
11
- npx agent-analytics login --token aak_your_key
11
+ npx @agent-analytics/cli login --token aak_your_key
12
12
 
13
13
  # 3. Create a project
14
- npx agent-analytics create my-site --domain https://mysite.com
14
+ npx @agent-analytics/cli create my-site --domain https://mysite.com
15
15
 
16
16
  # 4. Check your stats
17
- npx agent-analytics stats my-site
17
+ npx @agent-analytics/cli stats my-site
18
18
  ```
19
19
 
20
20
  ## Commands
21
21
 
22
22
  ```bash
23
23
  # Auth
24
- npx agent-analytics login --token <key> # Save your API key
25
- npx agent-analytics whoami # Show current account
24
+ npx @agent-analytics/cli login --token <key> # Save your API key
25
+ npx @agent-analytics/cli whoami # Show current account
26
26
 
27
27
  # Projects
28
- npx agent-analytics create <name> --domain <url> # Create a project
29
- npx agent-analytics projects # List your projects
30
- npx agent-analytics delete <id> # Delete a project
28
+ npx @agent-analytics/cli create <name> --domain <url> # Create a project
29
+ npx @agent-analytics/cli projects # List your projects
30
+ npx @agent-analytics/cli delete <id> # Delete a project
31
31
 
32
32
  # Analytics
33
- npx agent-analytics stats <name> # Stats (last 7 days)
34
- npx agent-analytics stats <name> --days 30 # Stats (last 30 days)
35
- npx agent-analytics events <name> # Recent events
36
- npx agent-analytics properties-received <name> # Property keys per event
33
+ npx @agent-analytics/cli stats <name> # Stats (last 7 days)
34
+ npx @agent-analytics/cli stats <name> --days 30 # Stats (last 30 days)
35
+ npx @agent-analytics/cli events <name> # Recent events
36
+ npx @agent-analytics/cli properties-received <name> # Property keys per event
37
37
 
38
38
  # Security
39
- npx agent-analytics revoke-key # Revoke and regenerate API key
39
+ npx @agent-analytics/cli revoke-key # Revoke and regenerate API key
40
40
  ```
41
41
 
42
42
  ## For AI Agents
package/bin/cli.mjs CHANGED
@@ -4,17 +4,17 @@
4
4
  * agent-analytics CLI
5
5
  *
6
6
  * Usage:
7
- * npx agent-analytics login --token <key> — Save your API key
8
- * npx agent-analytics create <name> — Create a project and get your snippet
9
- * npx agent-analytics projects — List your projects
10
- * npx agent-analytics stats <name> — Get stats for a project
11
- * npx agent-analytics events <name> — Get recent events
12
- * npx agent-analytics properties-received <name> — Show property keys per event
13
- * npx agent-analytics init <name> — Alias for create
14
- * npx agent-analytics delete <id> — Delete a project
15
- * npx agent-analytics revoke-key — Revoke and regenerate API key
16
- * npx agent-analytics delete-account — Delete your account (opens dashboard)
17
- * npx agent-analytics whoami — Show current account
7
+ * npx @agent-analytics/cli login --token <key> — Save your API key
8
+ * npx @agent-analytics/cli create <name> — Create a project and get your snippet
9
+ * npx @agent-analytics/cli projects — List your projects
10
+ * npx @agent-analytics/cli stats <name> — Get stats for a project
11
+ * npx @agent-analytics/cli events <name> — Get recent events
12
+ * npx @agent-analytics/cli properties-received <name> — Show property keys per event
13
+ * npx @agent-analytics/cli init <name> — Alias for create
14
+ * npx @agent-analytics/cli delete <id> — Delete a project
15
+ * npx @agent-analytics/cli revoke-key — Revoke and regenerate API key
16
+ * npx @agent-analytics/cli delete-account — Delete your account (opens dashboard)
17
+ * npx @agent-analytics/cli whoami — Show current account
18
18
  */
19
19
 
20
20
  import { AgentAnalyticsAPI } from '../lib/api.mjs';
@@ -37,7 +37,7 @@ function heading(msg) { log(`\n${BOLD}${msg}${RESET}`); }
37
37
  function requireKey() {
38
38
  const key = getApiKey();
39
39
  if (!key) {
40
- error('Not logged in. Run: npx agent-analytics login');
40
+ error('Not logged in. Run: npx @agent-analytics/cli login');
41
41
  }
42
42
  return new AgentAnalyticsAPI(key, getBaseUrl());
43
43
  }
@@ -49,7 +49,7 @@ async function cmdLogin(token) {
49
49
  heading('Agent Analytics — Login');
50
50
  log('');
51
51
  log('Pass your API key from the dashboard:');
52
- log(` ${CYAN}npx agent-analytics login --token aak_your_key_here${RESET}`);
52
+ log(` ${CYAN}npx @agent-analytics/cli login --token aak_your_key_here${RESET}`);
53
53
  log('');
54
54
  log('Or set it as an environment variable:');
55
55
  log(` ${CYAN}export AGENT_ANALYTICS_API_KEY=aak_your_key_here${RESET}`);
@@ -71,15 +71,15 @@ async function cmdLogin(token) {
71
71
 
72
72
  success(`Logged in as ${BOLD}${account.github_login || account.email}${RESET}`);
73
73
  log(`${DIM}API key saved to ~/.config/agent-analytics/config.json${RESET}`);
74
- log(`\nNext: ${CYAN}npx agent-analytics create my-site${RESET}`);
74
+ log(`\nNext: ${CYAN}npx @agent-analytics/cli create my-site${RESET}`);
75
75
  } catch (err) {
76
76
  error(`Invalid API key: ${err.message}`);
77
77
  }
78
78
  }
79
79
 
80
80
  async function cmdCreate(name, domain) {
81
- if (!name) error('Usage: npx agent-analytics create <project-name> --domain https://mysite.com');
82
- if (!domain) error('Usage: npx agent-analytics create <project-name> --domain https://mysite.com\n\nThe domain is required so we can restrict tracking to your site.');
81
+ if (!name) error('Usage: npx @agent-analytics/cli create <project-name> --domain https://mysite.com');
82
+ if (!domain) error('Usage: npx @agent-analytics/cli create <project-name> --domain https://mysite.com\n\nThe domain is required so we can restrict tracking to your site.');
83
83
 
84
84
  const api = requireKey();
85
85
 
@@ -115,7 +115,7 @@ async function cmdProjects() {
115
115
 
116
116
  if (!projects || projects.length === 0) {
117
117
  log('No projects yet. Create one:');
118
- log(` ${CYAN}npx agent-analytics create my-site${RESET}`);
118
+ log(` ${CYAN}npx @agent-analytics/cli create my-site${RESET}`);
119
119
  return;
120
120
  }
121
121
 
@@ -135,7 +135,7 @@ async function cmdProjects() {
135
135
  }
136
136
 
137
137
  async function cmdStats(project, days = 7) {
138
- if (!project) error('Usage: npx agent-analytics stats <project-name> [--days N]');
138
+ if (!project) error('Usage: npx @agent-analytics/cli stats <project-name> [--days N]');
139
139
 
140
140
  const api = requireKey();
141
141
 
@@ -192,7 +192,7 @@ async function cmdStats(project, days = 7) {
192
192
  }
193
193
 
194
194
  async function cmdEvents(project, opts = {}) {
195
- if (!project) error('Usage: npx agent-analytics events <project-name> [--days N] [--limit N]');
195
+ if (!project) error('Usage: npx @agent-analytics/cli events <project-name> [--days N] [--limit N]');
196
196
 
197
197
  const api = requireKey();
198
198
 
@@ -221,7 +221,7 @@ async function cmdEvents(project, opts = {}) {
221
221
  }
222
222
 
223
223
  async function cmdPropertiesReceived(project, opts = {}) {
224
- if (!project) error('Usage: npx agent-analytics properties-received <project-name> [--since DATE] [--sample N]');
224
+ if (!project) error('Usage: npx @agent-analytics/cli properties-received <project-name> [--since DATE] [--sample N]');
225
225
 
226
226
  const api = requireKey();
227
227
 
@@ -258,7 +258,7 @@ async function cmdPropertiesReceived(project, opts = {}) {
258
258
  }
259
259
 
260
260
  async function cmdDelete(id) {
261
- if (!id) error('Usage: npx agent-analytics delete <project-id>');
261
+ if (!id) error('Usage: npx @agent-analytics/cli delete <project-id>');
262
262
 
263
263
  const api = requireKey();
264
264
 
@@ -320,7 +320,7 @@ function showHelp() {
320
320
  ${BOLD}agent-analytics${RESET} — Web analytics your AI agent can read
321
321
 
322
322
  ${BOLD}USAGE${RESET}
323
- npx agent-analytics <command> [options]
323
+ npx @agent-analytics/cli <command> [options]
324
324
 
325
325
  ${BOLD}COMMANDS${RESET}
326
326
  ${CYAN}login${RESET} --token <key> Save your API key
@@ -348,13 +348,13 @@ ${BOLD}ENVIRONMENT${RESET}
348
348
 
349
349
  ${BOLD}EXAMPLES${RESET}
350
350
  ${DIM}# First time: save your API key (from app.agentanalytics.sh)${RESET}
351
- npx agent-analytics login --token aak_your_key
351
+ npx @agent-analytics/cli login --token aak_your_key
352
352
 
353
353
  ${DIM}# Create a project${RESET}
354
- npx agent-analytics create my-site --domain https://mysite.com
354
+ npx @agent-analytics/cli create my-site --domain https://mysite.com
355
355
 
356
356
  ${DIM}# Check how your site is doing${RESET}
357
- npx agent-analytics stats my-site --days 30
357
+ npx @agent-analytics/cli stats my-site --days 30
358
358
 
359
359
  ${DIM}# Your agent can also use the API directly${RESET}
360
360
  curl "https://api.agentanalytics.sh/stats?project=my-site&days=7" \\
@@ -421,7 +421,7 @@ try {
421
421
  showHelp();
422
422
  break;
423
423
  default:
424
- error(`Unknown command: ${command}. Run: npx agent-analytics help`);
424
+ error(`Unknown command: ${command}. Run: npx @agent-analytics/cli help`);
425
425
  }
426
426
  } catch (err) {
427
427
  error(err.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-analytics/cli",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "Web analytics your AI agent can read. CLI for managing projects and querying stats.",
5
5
  "bin": {
6
6
  "agent-analytics": "./bin/cli.mjs"