proof-of-commitment 1.19.0 → 1.20.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 (3) hide show
  1. package/README.md +15 -12
  2. package/index.js +75 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -51,23 +51,26 @@ npx proof-of-commitment --file go.sum # full transitive set
51
51
 
52
52
  **Web demo (no install):** [getcommit.dev/audit](https://getcommit.dev/audit) — paste your packages, see risk scores in seconds.
53
53
 
54
- ## Get notified before the next attack
55
-
56
- The CLI tells you what's risky today. A free API key unlocks **monitoring** — daily score recomputation across the packages you depend on, with alerts when one degrades (publisher drops, release stalls, score falls ≥10 points).
57
-
58
- [**Get a free API key →**](https://getcommit.dev/get-started?ref=npm-readme-monitoring&utm_source=cli) — no card, 30 seconds · 200 audits/day free · Developer $15/mo unlocks alerts + watchlist.
59
-
54
+ **Account + monitoring (v1.10.0):**
60
55
  ```bash
61
56
  # Install once, then use the `poc` alias:
62
57
  npm install -g proof-of-commitment
63
58
 
64
- # After getting your free key:
65
- poc login sk_commit_your_key_here # save and validate
66
- poc status # check tier + usage
67
- poc watch chalk # start monitoring (Developer $15/mo)
59
+ # Get a free API key at https://getcommit.dev/get-started?utm_source=cli, then:
60
+ poc login sk_commit_your_key_here
61
+ # Authenticated Tier: Free — Usage: 0/200 requests (daily)
62
+
63
+ poc status # check tier + usage anytime
64
+ poc logout # remove saved key
65
+
66
+ # Monitoring (Developer $15/mo+ — daily scans + alerts):
67
+ poc watch chalk
68
68
  poc watch requests --ecosystem pypi
69
- poc watchlist # view all watched packages
70
- poc init # add CI gate to this project
69
+ poc watch serde --ecosystem cargo
70
+ poc watchlist # view scores + risk levels
71
+ poc unwatch chalk
72
+
73
+ # Enable monitoring: https://getcommit.dev/pricing
71
74
  ```
72
75
 
73
76
  Alerts fire on: score drop ≥10 points · package crosses CRITICAL threshold · recovery to HEALTHY.
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * proof-of-commitment CLI v1.19.0
3
+ * proof-of-commitment CLI v1.20.0
4
4
  * Scores npm/PyPI/Cargo/Go packages on behavioral commitment signals.
5
5
  * Usage: npx proof-of-commitment [packages...] [options]
6
6
  */
@@ -113,14 +113,80 @@ async function handle429(res) {
113
113
  );
114
114
  }
115
115
  console.error('');
116
- console.error(clr(c.cyan + c.bold, ` → Free API key in 30 seconds (no card): ${instantKeyUrl}`));
117
- if (retryAfter && retryAfter > 0) {
118
- const hours = Math.floor(retryAfter / 3600);
119
- const mins = Math.floor((retryAfter % 3600) / 60);
120
- const resetIn = hours > 0 ? `${hours}h ${mins}m` : `${mins}m`;
121
- console.error(clr(c.dim, ` or wait — free-tier resets in ${resetIn} (00:00 UTC).`));
116
+
117
+ // TTY: inline signup collapses the 6-step browser flow (visit URL → enter
118
+ // email copy key → switch back to terminal → export key → re-run) to a
119
+ // single terminal prompt. Non-TTY (CI/piped) falls through to the URL.
120
+ if (process.stdin.isTTY && process.stdout.isTTY) {
121
+ console.error(clr(c.dim, ' ─────────────────────────────────────────────'));
122
+ console.error(clr(c.bold, ' Get a free key and keep scanning (no card, saves to ~/.commit/config):'));
123
+ console.error('');
124
+
125
+ const { createInterface } = await import('readline');
126
+ const rl = createInterface({ input: process.stdin, output: process.stderr });
127
+
128
+ const email = await new Promise(resolve => {
129
+ rl.question(clr(c.dim, ' Your email (Enter to skip): '), answer => {
130
+ rl.close();
131
+ resolve(answer.trim());
132
+ });
133
+ });
134
+
135
+ if (email && /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(email)) {
136
+ process.stderr.write(clr(c.dim, ' Creating key...'));
137
+ try {
138
+ const createRes = await fetch('https://poc-backend.amdal-dev.workers.dev/api/keys/create', {
139
+ method: 'POST',
140
+ headers: { 'Content-Type': 'application/json' },
141
+ body: JSON.stringify({ email, source: 'audit-cli-429' }),
142
+ });
143
+ const keyData = await createRes.json();
144
+ if (keyData.key) {
145
+ await writeApiKey(keyData.key);
146
+ console.error(clr(c.green, ' ✓ Key saved to ~/.commit/config'));
147
+ console.error(clr(c.dim, ` Backup sent to ${email}`));
148
+ console.error('');
149
+ console.error(clr(c.bold, ' Re-run your command to continue with your new key.'));
150
+ console.error('');
151
+ } else {
152
+ const errMsg = keyData.error === 'rate_limit_exceeded'
153
+ ? 'Too many keys from this IP today — try again tomorrow.'
154
+ : (keyData.message || 'Could not create key. Try the web: ' + instantKeyUrl);
155
+ console.error(clr(c.red, ` Failed: ${errMsg}`));
156
+ console.error('');
157
+ }
158
+ } catch (err) {
159
+ console.error(clr(c.red, ` Error: ${err.message}`));
160
+ console.error(clr(c.dim, ` Try the web: ${instantKeyUrl}`));
161
+ console.error('');
162
+ }
163
+ } else if (email) {
164
+ console.error(clr(c.red, ' Invalid email. Skipped.'));
165
+ console.error(clr(c.dim, ` Try the web: ${instantKeyUrl}`));
166
+ console.error('');
167
+ } else {
168
+ // User pressed Enter to skip — show URL as fallback
169
+ console.error(clr(c.cyan + c.bold, ` → Get a free key later: ${instantKeyUrl}`));
170
+ if (retryAfter && retryAfter > 0) {
171
+ const hours = Math.floor(retryAfter / 3600);
172
+ const mins = Math.floor((retryAfter % 3600) / 60);
173
+ const resetIn = hours > 0 ? `${hours}h ${mins}m` : `${mins}m`;
174
+ console.error(clr(c.dim, ` or wait — free-tier resets in ${resetIn} (00:00 UTC).`));
175
+ }
176
+ console.error('');
177
+ }
178
+ } else {
179
+ // Non-TTY fallback: print URL for CI/piped contexts
180
+ console.error(clr(c.cyan + c.bold, ` → Free API key in 30 seconds (no card): ${instantKeyUrl}`));
181
+ if (retryAfter && retryAfter > 0) {
182
+ const hours = Math.floor(retryAfter / 3600);
183
+ const mins = Math.floor((retryAfter % 3600) / 60);
184
+ const resetIn = hours > 0 ? `${hours}h ${mins}m` : `${mins}m`;
185
+ console.error(clr(c.dim, ` or wait — free-tier resets in ${resetIn} (00:00 UTC).`));
186
+ }
187
+ console.error('');
122
188
  }
123
- console.error('');
189
+
124
190
  process.exit(1);
125
191
  }
126
192
 
@@ -396,7 +462,7 @@ async function inlineSignup(results) {
396
462
 
397
463
  function printHelp() {
398
464
  console.log(`
399
- ${clr(c.bold, 'proof-of-commitment')} v1.19.0 — supply chain risk scorer
465
+ ${clr(c.bold, 'proof-of-commitment')} v1.20.0 — supply chain risk scorer
400
466
 
401
467
  ${clr(c.bold, 'Usage:')}
402
468
  npx proof-of-commitment Auto-detect manifest in current dir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "proof-of-commitment",
3
- "version": "1.19.0",
3
+ "version": "1.20.0",
4
4
  "mcpName": "io.github.piiiico/proof-of-commitment",
5
5
  "description": "Supply chain risk scorer for npm, PyPI, Cargo, and Go packages — behavioral signals that can't be faked",
6
6
  "type": "module",