claude-rpc 0.7.2 → 0.7.3

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.
@@ -8,7 +8,7 @@ import { readAggregate } from '../scanner.js';
8
8
  import { generateInsights } from '../insights.js';
9
9
  import { badgeSvg } from '../badge.js';
10
10
  import { renderCard } from '../card.js';
11
- import { snapshot, windowedAggregate } from './api.js';
11
+ import { snapshot, windowedAggregate, aggregateToCsv } from './api.js';
12
12
 
13
13
  export const JSON_HEADERS = {
14
14
  'content-type': 'application/json',
@@ -51,6 +51,29 @@ ROUTES.set('GET /api/badge.svg', (req, res, { query }) => {
51
51
  res.end(svg);
52
52
  });
53
53
 
54
+ // Data export. content-disposition: attachment makes the browser download
55
+ // rather than render. The JSON is the raw aggregate; the CSV is byDay
56
+ // flattened to daily rows (see aggregateToCsv).
57
+ ROUTES.set('GET /api/export.json', (req, res) => {
58
+ const agg = readAggregate() || {};
59
+ res.writeHead(200, {
60
+ 'content-type': 'application/json; charset=utf-8',
61
+ 'content-disposition': 'attachment; filename="claude-rpc-aggregate.json"',
62
+ 'cache-control': 'no-store',
63
+ });
64
+ res.end(JSON.stringify(agg, null, 2));
65
+ });
66
+
67
+ ROUTES.set('GET /api/export.csv', (req, res) => {
68
+ const agg = readAggregate() || {};
69
+ res.writeHead(200, {
70
+ 'content-type': 'text/csv; charset=utf-8',
71
+ 'content-disposition': 'attachment; filename="claude-rpc-daily.csv"',
72
+ 'cache-control': 'no-store',
73
+ });
74
+ res.end(aggregateToCsv(agg));
75
+ });
76
+
54
77
  // Poster-style card. `?range=year|month|week|all` (default year).
55
78
  ROUTES.set('GET /api/card.svg', (req, res, { query }) => {
56
79
  const agg = readAggregate();
package/src/version.js CHANGED
@@ -11,7 +11,7 @@ import { readFileSync } from 'node:fs';
11
11
  import { join } from 'node:path';
12
12
  import { ROOT } from './paths.js';
13
13
 
14
- const BAKED = '0.7.2';
14
+ const BAKED = '0.7.3';
15
15
 
16
16
  function readPkgVersion() {
17
17
  try {