tokens-for-good 0.2.3 → 0.2.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tokens-for-good",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "description": "Donate your spare AI tokens to research nonprofits for Fierce Philanthropy",
6
6
  "bin": {
package/src/mcp-server.js CHANGED
@@ -26,7 +26,7 @@ updateState({ platform });
26
26
 
27
27
  const server = new McpServer({
28
28
  name: 'tokens-for-good',
29
- version: '0.2.3',
29
+ version: '0.2.4',
30
30
  });
31
31
 
32
32
  // --- No-key onboarding message ---
@@ -287,6 +287,29 @@ server.tool('my_impact', 'See your personal contribution stats, tier, and histor
287
287
  }
288
288
  });
289
289
 
290
+ server.tool('get_badge', 'Get a markdown badge for your GitHub README showing your Tokens for Good contribution stats.', {}, async () => {
291
+ if (!client) return { content: [{ type: 'text', text: 'Error: TFG_API_KEY not set.' }] };
292
+
293
+ try {
294
+ const result = await client.getImpact();
295
+ const c = result.contributor;
296
+ const tier = c.tier || 'new';
297
+ const orgCount = c.total_orgs || 0;
298
+ const label = `Tokens_for_Good`;
299
+ const message = `${orgCount}_org${orgCount !== 1 ? 's' : ''}_researched`;
300
+ const color = tier === 'gold' ? 'FFD700' : tier === 'silver' ? 'C0C0C0' : tier === 'bronze' ? 'CD7F32' : '54BC4B';
301
+ const badgeUrl = `https://img.shields.io/badge/${label}-${message}-${color}?style=flat`;
302
+ const linkUrl = `https://fierce-philanthropy-directory.laravel.cloud/contribute`;
303
+ const markdown = `[![Tokens for Good](${badgeUrl})](${linkUrl})`;
304
+
305
+ return {
306
+ content: [{ type: 'text', text: `Add this badge to your GitHub README:\n\n\`\`\`markdown\n${markdown}\n\`\`\`\n\nPreview: ${markdown}\n\nTier: ${tier} | Orgs: ${orgCount}` }],
307
+ };
308
+ } catch (err) {
309
+ return { content: [{ type: 'text', text: `Error: ${err.message}` }] };
310
+ }
311
+ });
312
+
290
313
  server.tool('setup_guide', 'Get setup instructions for Tokens for Good. Use this if the user needs help with installation, API keys, or configuration.', {}, async () => {
291
314
  return { content: [{ type: 'text', text: NO_KEY_INSTRUCTIONS }] };
292
315
  });
package/src/platform.js CHANGED
@@ -90,6 +90,40 @@ Method: POST
90
90
  Headers: X-TFG-Api-Key: ${apiKey}, Content-Type: application/json
91
91
  Body: {"claim_id": <claim_id from step 1>, "report_markdown": "<full report>", "model_used": "claude-code-scheduled"}
92
92
 
93
+ ### 5. Check next-action
94
+ After submitting, check if you need to do a peer review before continuing:
95
+
96
+ WebFetch URL: https://fierce-philanthropy-directory.laravel.cloud/api/research/next-action
97
+ Method: GET
98
+ Headers: X-TFG-Api-Key: ${apiKey}, Accept: application/json
99
+
100
+ If the response says action is "review", do the review:
101
+
102
+ **5a. Get the review:**
103
+ WebFetch URL: https://fierce-philanthropy-directory.laravel.cloud/api/research/review/next
104
+ Method: GET
105
+ Headers: X-TFG-Api-Key: ${apiKey}, Accept: application/json
106
+
107
+ **5b. Review the report** — score it 1-4 (4=great, 3=good with minor fixes, 2=needs redo, 1=bad actor)
108
+
109
+ **5c. Submit the review:**
110
+ WebFetch URL: https://fierce-philanthropy-directory.laravel.cloud/api/research/review/submit
111
+ Method: POST
112
+ Headers: X-TFG-Api-Key: ${apiKey}, Content-Type: application/json
113
+ Body: {"claim_id": <claim_id>, "score": <1-4>, "notes": "<review notes>", "updated_report": "<fixed report if score is 3>"}
114
+
115
+ ### 6. Repeat (up to 3 orgs per session)
116
+ After completing each org (and any peer review), loop back to Step 1 and claim the next org.
117
+ Research up to 3 orgs total per session. After 3 orgs (or if no more are available), stop.
118
+
119
+ ## Batch Flow Summary
120
+ \`\`\`
121
+ for i in 1..3:
122
+ claim org → research → submit report
123
+ check next-action → if review needed, do review
124
+ repeat
125
+ \`\`\`
126
+
93
127
  ### Rules
94
128
  - Every factual claim needs an inline citation [Source Name](URL)
95
129
  - Only use direct results from the org, not from similar orgs