tokens-for-good 0.2.2 → 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.2",
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.2',
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
@@ -1,21 +1,20 @@
1
1
  // Platform detection and automation guidance
2
2
 
3
3
  export function detectPlatform() {
4
- // Check environment hints
5
4
  if (process.env.CLAUDE_CODE) return 'claude-code';
6
5
  if (process.env.OPENCODE) return 'opencode';
7
6
  if (process.env.DEVIN) return 'devin';
8
7
  if (process.env.CURSOR_SESSION) return 'cursor';
9
8
  if (process.env.WINDSURF_SESSION) return 'windsurf';
10
9
 
11
- // Check parent process name
12
10
  const parentName = process.env._ || process.env.PARENT_PROCESS || '';
13
11
  if (parentName.includes('claude')) return 'claude-code';
14
12
  if (parentName.includes('opencode')) return 'opencode';
15
13
  if (parentName.includes('cursor')) return 'cursor';
16
14
  if (parentName.includes('windsurf')) return 'windsurf';
17
15
 
18
- return 'unknown';
16
+ // Default to claude-code since it's the primary MCP host
17
+ return 'claude-code';
19
18
  }
20
19
 
21
20
  export function isSchedulable(platform) {
@@ -91,6 +90,40 @@ Method: POST
91
90
  Headers: X-TFG-Api-Key: ${apiKey}, Content-Type: application/json
92
91
  Body: {"claim_id": <claim_id from step 1>, "report_markdown": "<full report>", "model_used": "claude-code-scheduled"}
93
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
+
94
127
  ### Rules
95
128
  - Every factual claim needs an inline citation [Source Name](URL)
96
129
  - Only use direct results from the org, not from similar orgs
@@ -137,7 +170,7 @@ Configure a ${frequency} recurring session with the prompt:
137
170
  Devin runs in the cloud, fully autonomous.`;
138
171
 
139
172
  default:
140
- return `Automated contributions are not available on this platform. You can contribute manually by saying "Research an org for Fierce Philanthropy" in any session.`;
173
+ return getAutomationInstructions('claude-code', frequency, apiKey);
141
174
  }
142
175
  }
143
176