@unveil/vk 0.2.0 → 0.3.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.
Files changed (2) hide show
  1. package/README.md +99 -0
  2. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # vk
2
+
3
+ Fetch GitHub account activity and analyze it for automation patterns
4
+
5
+ This is the batteries-included wrapper around [`@unveil/identity`](https://github.com/unveil-project/identity). Give it a username and it does the GitHub API calls for you, then hands the result to the scoring engine.
6
+
7
+ Both packages are the logic behind [AgentScan](https://agentscan.netlify.app), a tool for analyzing GitHub account behavior to detect potential AI agents and automated activity. The results are indicators, not verdicts.
8
+
9
+ ### Install
10
+
11
+ ```bash
12
+ npm install @unveil/vk
13
+ ```
14
+
15
+ ### Usage
16
+
17
+ ```js
18
+ import { analyze } from "@unveil/vk";
19
+
20
+ const { analysis, eventsCount } = await analyze("github_account_username", {
21
+ token: process.env.GITHUB_TOKEN,
22
+ });
23
+
24
+ console.log(analysis.classification); // "organic" | "mixed" | "automation" | "insufficient-data"
25
+ console.log(analysis.score); // 100 = human, 0 = automation
26
+ console.log(analysis.confidence); // 0-1: how much evidence there was
27
+ console.log(eventsCount); // how many events we actually got back
28
+ ```
29
+
30
+ ### Options
31
+
32
+ ```js
33
+ analyze(username, {
34
+ token: "ghp_...", // GitHub token. Optional, but strongly recommended
35
+ showEvents: true, // return the raw events too. Off by default
36
+ });
37
+ ```
38
+
39
+ `token` is passed straight to Octokit. Without it you are on the unauthenticated
40
+ rate limit, which is 60 requests per hour for the whole IP — and each `analyze`
41
+ call spends 4 of them. With a token you get 5000 per hour. The token needs no
42
+ scopes; all the data read here is public.
43
+
44
+ `showEvents` controls whether the raw events come back in the result. They are
45
+ left out by default because 300 GitHub events is a lot of JSON to carry around
46
+ when all you wanted was the score.
47
+
48
+ ### Result
49
+
50
+ ```js
51
+ {
52
+ analysis, // the full IdentifyResult from @unveil/identity
53
+ events, // the raw events, or [] unless showEvents is set
54
+ eventsCount, // always the real count, even when events is empty
55
+ }
56
+ ```
57
+
58
+ `analysis` is whatever `identify()` returns — score, classification, confidence,
59
+ flags, groups, window, timezone and profile. See the
60
+ [identity README](https://github.com/unveil-project/identity#readme) for the full
61
+ shape and for what each of the 53 heuristics looks at.
62
+
63
+ ### How much it fetches
64
+
65
+ `analyze` requests three pages of 100 public events, in parallel. That is both
66
+ the maximum GitHub serves from the public events endpoint and the window
67
+ `@unveil/identity` scores over, so there is nothing to gain from asking for more.
68
+
69
+ Accounts with less activity than that simply return fewer events, and the
70
+ analysis reports lower `confidence` to match.
71
+
72
+ ### Errors
73
+
74
+ `analyze` rejects instead of returning a partial result. A missing user, a
75
+ revoked token or an exhausted rate limit all come back as the Octokit error, so
76
+ you can read `status` off it:
77
+
78
+ ```js
79
+ try {
80
+ await analyze("ghost");
81
+ } catch (error) {
82
+ if (error.status === 404) {
83
+ // no such account
84
+ }
85
+ }
86
+ ```
87
+
88
+ ### Which package do I want?
89
+
90
+ Use **`@unveil/vk`** when you have a username and want an answer.
91
+
92
+ Use [**`@unveil/identity`**](https://github.com/unveil-project/identity) when you
93
+ already have the user and events — from your own database, a cache, a webhook, or
94
+ your own authenticated client — and only want the scoring. It has no network
95
+ access and no dependencies on how you got the data.
96
+
97
+ ### Issues and feature requests
98
+
99
+ Please drop an issue if you find something that doesn't work, or have an idea for something that works better.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@unveil/vk",
3
- "version": "0.2.0",
4
- "description": "Automation-pattern analysis for GitHub accounts",
3
+ "version": "0.3.0",
4
+ "description": "Fetch GitHub account activity and analyze it for automation patterns",
5
5
  "type": "module",
6
6
  "packageManager": "pnpm@11.22.0",
7
7
  "exports": {