clawpowers 1.1.3 → 2.0.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 (74) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/LICENSE +44 -0
  3. package/README.md +202 -384
  4. package/SECURITY.md +72 -0
  5. package/dist/index.d.ts +844 -0
  6. package/dist/index.js +2536 -0
  7. package/dist/index.js.map +1 -0
  8. package/package.json +52 -42
  9. package/.claude-plugin/manifest.json +0 -19
  10. package/.codex/INSTALL.md +0 -36
  11. package/.cursor-plugin/manifest.json +0 -21
  12. package/.opencode/INSTALL.md +0 -52
  13. package/ARCHITECTURE.md +0 -69
  14. package/bin/clawpowers.js +0 -625
  15. package/bin/clawpowers.sh +0 -91
  16. package/docs/demo/clawpowers-demo.cast +0 -197
  17. package/docs/demo/clawpowers-demo.gif +0 -0
  18. package/docs/launch-images/25-skills-breakdown.jpg +0 -0
  19. package/docs/launch-images/clawpowers-vs-superpowers.jpg +0 -0
  20. package/docs/launch-images/economic-code-optimization.jpg +0 -0
  21. package/docs/launch-images/native-vs-bridge-2.jpg +0 -0
  22. package/docs/launch-images/native-vs-bridge.jpg +0 -0
  23. package/docs/launch-images/post1-hero-lobster.jpg +0 -0
  24. package/docs/launch-images/post2-dashboard.jpg +0 -0
  25. package/docs/launch-images/post3-superpowers.jpg +0 -0
  26. package/docs/launch-images/post4-before-after.jpg +0 -0
  27. package/docs/launch-images/post5-install-now.jpg +0 -0
  28. package/docs/launch-images/ultimate-stack.jpg +0 -0
  29. package/docs/launch-posts.md +0 -76
  30. package/docs/quickstart-first-transaction.md +0 -204
  31. package/gemini-extension.json +0 -32
  32. package/hooks/session-start +0 -205
  33. package/hooks/session-start.cmd +0 -43
  34. package/hooks/session-start.js +0 -163
  35. package/runtime/demo/README.md +0 -78
  36. package/runtime/demo/x402-mock-server.js +0 -230
  37. package/runtime/feedback/analyze.js +0 -621
  38. package/runtime/feedback/analyze.sh +0 -546
  39. package/runtime/init.js +0 -210
  40. package/runtime/init.sh +0 -178
  41. package/runtime/metrics/collector.js +0 -361
  42. package/runtime/metrics/collector.sh +0 -308
  43. package/runtime/payments/ledger.js +0 -305
  44. package/runtime/payments/ledger.sh +0 -262
  45. package/runtime/payments/pipeline.js +0 -459
  46. package/runtime/persistence/store.js +0 -433
  47. package/runtime/persistence/store.sh +0 -303
  48. package/skill.json +0 -106
  49. package/skills/agent-bounties/SKILL.md +0 -553
  50. package/skills/agent-payments/SKILL.md +0 -479
  51. package/skills/brainstorming/SKILL.md +0 -233
  52. package/skills/content-pipeline/SKILL.md +0 -282
  53. package/skills/cross-project-knowledge/SKILL.md +0 -345
  54. package/skills/dispatching-parallel-agents/SKILL.md +0 -305
  55. package/skills/economic-code-optimization/SKILL.md +0 -265
  56. package/skills/executing-plans/SKILL.md +0 -255
  57. package/skills/finishing-a-development-branch/SKILL.md +0 -260
  58. package/skills/formal-verification-lite/SKILL.md +0 -441
  59. package/skills/learn-how-to-learn/SKILL.md +0 -235
  60. package/skills/market-intelligence/SKILL.md +0 -323
  61. package/skills/meta-skill-evolution/SKILL.md +0 -325
  62. package/skills/prospecting/SKILL.md +0 -454
  63. package/skills/receiving-code-review/SKILL.md +0 -225
  64. package/skills/requesting-code-review/SKILL.md +0 -206
  65. package/skills/security-audit/SKILL.md +0 -353
  66. package/skills/self-healing-code/SKILL.md +0 -369
  67. package/skills/subagent-driven-development/SKILL.md +0 -244
  68. package/skills/systematic-debugging/SKILL.md +0 -355
  69. package/skills/test-driven-development/SKILL.md +0 -416
  70. package/skills/using-clawpowers/SKILL.md +0 -160
  71. package/skills/using-git-worktrees/SKILL.md +0 -261
  72. package/skills/verification-before-completion/SKILL.md +0 -254
  73. package/skills/writing-plans/SKILL.md +0 -276
  74. package/skills/writing-skills/SKILL.md +0 -260
@@ -1,230 +0,0 @@
1
- #!/usr/bin/env node
2
- // runtime/demo/x402-mock-server.js — x402 Mock Merchant Demo Server
3
- //
4
- // Starts a local HTTP server that demonstrates the x402 payment-required flow:
5
- // 1. GET /api/premium-data without payment header → 402 Payment Required
6
- // 2. GET /api/premium-data with 'x-payment: mock-proof' header → 200 OK with data
7
- //
8
- // This server is for DEMO and DEVELOPMENT ONLY — it does not process real payments.
9
- //
10
- // Usage:
11
- // node runtime/demo/x402-mock-server.js
12
- // npx clawpowers demo x402
13
- //
14
- // The server picks a random available port and prints instructions on startup.
15
- // Press Ctrl+C to stop.
16
- 'use strict';
17
-
18
- const http = require('http');
19
- const os = require('os');
20
-
21
- // Track requests for demo visibility
22
- let requestCount = 0;
23
-
24
- /**
25
- * Returns an ISO 8601 timestamp without milliseconds.
26
- *
27
- * @returns {string} e.g. "2026-03-22T21:42:00Z"
28
- */
29
- function isoTimestamp() {
30
- return new Date().toISOString().replace(/\.\d{3}Z$/, 'Z');
31
- }
32
-
33
- /**
34
- * Logs a request to stdout with timestamp and key details.
35
- * Allows the demo runner to see exactly what is happening.
36
- *
37
- * @param {string} method - HTTP method (GET, POST, etc.)
38
- * @param {string} url - Request URL path
39
- * @param {number} status - Response HTTP status code
40
- * @param {string} [note=''] - Optional human-readable note about this request
41
- */
42
- function logRequest(method, url, status, note = '') {
43
- const ts = isoTimestamp();
44
- const noteStr = note ? ` — ${note}` : '';
45
- console.log(` [${ts}] ${method} ${url} → ${status}${noteStr}`);
46
- }
47
-
48
- /**
49
- * Builds the x402 Payment Required response body for the mock merchant.
50
- * This mimics the response a real x402-compliant API would return.
51
- *
52
- * @param {number} port - The port this server is running on (embedded in the resource URL).
53
- * @returns {object} x402 payment requirements object.
54
- */
55
- function buildPaymentRequired(port) {
56
- return {
57
- x402Version: 1,
58
- accepts: [
59
- {
60
- scheme: 'exact',
61
- network: 'base-sepolia',
62
- maxAmountRequired: '100000',
63
- resource: `http://localhost:${port}/api/premium-data`,
64
- asset: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
65
- payTo: '0xff86829393C6C26A4EC122bE0Cc3E466Ef876AdD',
66
- },
67
- ],
68
- error: 'Payment Required',
69
- };
70
- }
71
-
72
- /**
73
- * Builds the mock premium data response returned after (simulated) payment.
74
- *
75
- * @returns {object} Mock API data payload.
76
- */
77
- function buildPremiumData() {
78
- return {
79
- status: 'ok',
80
- data: {
81
- market: 'AGENT/USDC',
82
- price: '4.20',
83
- volume_24h: '1234567.89',
84
- change_24h: '+12.3%',
85
- source: 'mock-premium-api',
86
- paid_with: 'x402',
87
- timestamp: isoTimestamp(),
88
- },
89
- message: 'Payment accepted. Here is your premium data.',
90
- };
91
- }
92
-
93
- /**
94
- * Main HTTP request handler for the mock x402 merchant.
95
- *
96
- * Routes:
97
- * GET /api/premium-data — Returns 402 or 200 depending on x-payment header
98
- * GET / — Returns a simple HTML help page
99
- * All others — Returns 404
100
- *
101
- * @param {http.IncomingMessage} req - Incoming HTTP request
102
- * @param {http.ServerResponse} res - HTTP response object
103
- */
104
- function handleRequest(req, res) {
105
- requestCount++;
106
- const url = req.url || '/';
107
- const method = req.method || 'GET';
108
-
109
- // CORS headers — allow curl and browser requests during demo
110
- res.setHeader('Access-Control-Allow-Origin', '*');
111
- res.setHeader('Access-Control-Allow-Headers', 'x-payment, content-type');
112
-
113
- if (url === '/api/premium-data' && method === 'GET') {
114
- const paymentHeader = req.headers['x-payment'];
115
-
116
- if (!paymentHeader) {
117
- // No payment header — return 402 Payment Required with x402 spec body
118
- const body = JSON.stringify(buildPaymentRequired(server.address().port), null, 2);
119
- res.setHeader('Content-Type', 'application/json');
120
- res.writeHead(402);
121
- res.end(body);
122
- logRequest(method, url, 402, 'No x-payment header — returning payment requirements');
123
- } else {
124
- // Payment header present — simulate successful payment verification
125
- const body = JSON.stringify(buildPremiumData(), null, 2);
126
- res.setHeader('Content-Type', 'application/json');
127
- res.writeHead(200);
128
- res.end(body);
129
- logRequest(method, url, 200, `x-payment: ${paymentHeader} — payment accepted, returning data`);
130
- }
131
-
132
- } else if (url === '/' && method === 'GET') {
133
- // Help page — shows curl examples
134
- const port = server.address().port;
135
- const body = [
136
- '<html><body><pre>',
137
- 'x402 Mock Merchant Demo',
138
- '=======================',
139
- '',
140
- 'Try these curl commands:',
141
- '',
142
- `# Step 1: Request without payment (returns 402)`,
143
- `curl -i http://localhost:${port}/api/premium-data`,
144
- '',
145
- `# Step 2: Request with payment header (returns 200 + data)`,
146
- `curl -i -H "x-payment: mock-proof" http://localhost:${port}/api/premium-data`,
147
- '</pre></body></html>',
148
- ].join('\n');
149
- res.setHeader('Content-Type', 'text/html');
150
- res.writeHead(200);
151
- res.end(body);
152
- logRequest(method, url, 200, 'help page');
153
-
154
- } else {
155
- res.setHeader('Content-Type', 'application/json');
156
- res.writeHead(404);
157
- res.end(JSON.stringify({ error: 'Not Found', path: url }));
158
- logRequest(method, url, 404);
159
- }
160
- }
161
-
162
- /**
163
- * Finds a random available port by binding to port 0 and reading what the OS assigned.
164
- * Returns a Promise that resolves to the chosen port number.
165
- *
166
- * @returns {Promise<number>} Available port number.
167
- */
168
- function getAvailablePort() {
169
- return new Promise((resolve, reject) => {
170
- const tmp = http.createServer();
171
- tmp.listen(0, '127.0.0.1', () => {
172
- const port = tmp.address().port;
173
- tmp.close(() => resolve(port));
174
- });
175
- tmp.on('error', reject);
176
- });
177
- }
178
-
179
- // The server object is referenced inside handleRequest for the port — declare before use
180
- /** @type {http.Server} */
181
- const server = http.createServer(handleRequest);
182
-
183
- /**
184
- * Main entry point: picks a port, starts the server, and prints instructions.
185
- * Waits for Ctrl+C (SIGINT) or SIGTERM to shut down cleanly.
186
- */
187
- async function main() {
188
- let port;
189
- try {
190
- port = await getAvailablePort();
191
- } catch (_) {
192
- // If dynamic port detection fails, fall back to a fixed high port
193
- port = 18402;
194
- }
195
-
196
- server.listen(port, '127.0.0.1', () => {
197
- console.log('');
198
- console.log('╔══════════════════════════════════════════════════════════════╗');
199
- console.log('║ x402 Mock Merchant — Demo Server ║');
200
- console.log('╚══════════════════════════════════════════════════════════════╝');
201
- console.log('');
202
- console.log(` Mock x402 merchant running on http://localhost:${port}`);
203
- console.log('');
204
- console.log(' Try:');
205
- console.log(` curl http://localhost:${port}/api/premium-data`);
206
- console.log('');
207
- console.log(' The server will return 402 (Payment Required) on first request.');
208
- console.log('');
209
- console.log(` curl -H 'x-payment: mock-proof' http://localhost:${port}/api/premium-data`);
210
- console.log('');
211
- console.log(" Send with header 'x-payment: mock-proof' to simulate payment.");
212
- console.log('');
213
- console.log(' Request log:');
214
- });
215
-
216
- // Handle Ctrl+C and process termination signals cleanly
217
- const shutdown = () => {
218
- console.log('');
219
- console.log(` Shutting down after ${requestCount} request(s). Goodbye.`);
220
- server.close(() => process.exit(0));
221
- };
222
-
223
- process.on('SIGINT', shutdown);
224
- process.on('SIGTERM', shutdown);
225
- }
226
-
227
- main().catch((err) => {
228
- process.stderr.write(`Error starting mock server: ${err.message}\n`);
229
- process.exit(1);
230
- });