MCPcopy Create free account
hub / github.com/garrytan/gstack / main

Function main

scripts/analytics.ts:155–186  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153}
154
155function main() {
156 // Parse --period flag
157 let period = 'all';
158 const args = process.argv.slice(2);
159 for (let i = 0; i < args.length; i++) {
160 if (args[i] === '--period' && i + 1 < args.length) {
161 period = args[i + 1];
162 i++;
163 }
164 }
165
166 // Read file
167 if (!fs.existsSync(ANALYTICS_FILE)) {
168 console.log('No analytics data found.');
169 process.exit(0);
170 }
171
172 const content = fs.readFileSync(ANALYTICS_FILE, 'utf-8').trim();
173 if (!content) {
174 console.log('No analytics data found.');
175 process.exit(0);
176 }
177
178 const events = parseJSONL(content);
179 if (events.length === 0) {
180 console.log('No analytics data found.');
181 process.exit(0);
182 }
183
184 const filtered = filterByPeriod(events, period);
185 console.log(formatReport(filtered, period));
186}
187
188if (import.meta.main) {
189 main();

Callers 1

analytics.tsFile · 0.70

Calls 3

parseJSONLFunction · 0.85
filterByPeriodFunction · 0.85
formatReportFunction · 0.85

Tested by

no test coverage detected