@tokscale/cli 1.4.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.
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +128 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -26
- package/dist/auth.d.ts +0 -17
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -162
- package/dist/auth.js.map +0 -1
- package/dist/cli.d.ts +0 -9
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -1550
- package/dist/cli.js.map +0 -1
- package/dist/credentials.d.ts +0 -50
- package/dist/credentials.d.ts.map +0 -1
- package/dist/credentials.js +0 -151
- package/dist/credentials.js.map +0 -1
- package/dist/cursor.d.ts +0 -167
- package/dist/cursor.d.ts.map +0 -1
- package/dist/cursor.js +0 -906
- package/dist/cursor.js.map +0 -1
- package/dist/date-utils.d.ts +0 -10
- package/dist/date-utils.d.ts.map +0 -1
- package/dist/date-utils.js +0 -47
- package/dist/date-utils.js.map +0 -1
- package/dist/graph-types.d.ts +0 -142
- package/dist/graph-types.d.ts.map +0 -1
- package/dist/graph-types.js +0 -6
- package/dist/graph-types.js.map +0 -1
- package/dist/native-runner.d.ts +0 -11
- package/dist/native-runner.d.ts.map +0 -1
- package/dist/native-runner.js +0 -77
- package/dist/native-runner.js.map +0 -1
- package/dist/native.d.ts +0 -106
- package/dist/native.d.ts.map +0 -1
- package/dist/native.js +0 -302
- package/dist/native.js.map +0 -1
- package/dist/sessions/types.d.ts +0 -28
- package/dist/sessions/types.d.ts.map +0 -1
- package/dist/sessions/types.js +0 -27
- package/dist/sessions/types.js.map +0 -1
- package/dist/spinner.d.ts +0 -75
- package/dist/spinner.d.ts.map +0 -1
- package/dist/spinner.js +0 -203
- package/dist/spinner.js.map +0 -1
- package/dist/submit.d.ts +0 -23
- package/dist/submit.d.ts.map +0 -1
- package/dist/submit.js +0 -294
- package/dist/submit.js.map +0 -1
- package/dist/table.d.ts +0 -42
- package/dist/table.d.ts.map +0 -1
- package/dist/table.js +0 -181
- package/dist/table.js.map +0 -1
- package/dist/tui/App.d.ts +0 -4
- package/dist/tui/App.d.ts.map +0 -1
- package/dist/tui/App.js +0 -333
- package/dist/tui/App.js.map +0 -1
- package/dist/tui/components/BarChart.d.ts +0 -17
- package/dist/tui/components/BarChart.d.ts.map +0 -1
- package/dist/tui/components/BarChart.js +0 -146
- package/dist/tui/components/BarChart.js.map +0 -1
- package/dist/tui/components/DailyView.d.ts +0 -13
- package/dist/tui/components/DailyView.d.ts.map +0 -1
- package/dist/tui/components/DailyView.js +0 -86
- package/dist/tui/components/DailyView.js.map +0 -1
- package/dist/tui/components/DateBreakdownPanel.d.ts +0 -7
- package/dist/tui/components/DateBreakdownPanel.d.ts.map +0 -1
- package/dist/tui/components/DateBreakdownPanel.js +0 -36
- package/dist/tui/components/DateBreakdownPanel.js.map +0 -1
- package/dist/tui/components/Footer.d.ts +0 -28
- package/dist/tui/components/Footer.d.ts.map +0 -1
- package/dist/tui/components/Footer.js +0 -130
- package/dist/tui/components/Footer.js.map +0 -1
- package/dist/tui/components/Header.d.ts +0 -9
- package/dist/tui/components/Header.d.ts.map +0 -1
- package/dist/tui/components/Header.js +0 -20
- package/dist/tui/components/Header.js.map +0 -1
- package/dist/tui/components/Legend.d.ts +0 -7
- package/dist/tui/components/Legend.d.ts.map +0 -1
- package/dist/tui/components/Legend.js +0 -16
- package/dist/tui/components/Legend.js.map +0 -1
- package/dist/tui/components/LoadingSpinner.d.ts +0 -8
- package/dist/tui/components/LoadingSpinner.d.ts.map +0 -1
- package/dist/tui/components/LoadingSpinner.js +0 -55
- package/dist/tui/components/LoadingSpinner.js.map +0 -1
- package/dist/tui/components/ModelRow.d.ts +0 -13
- package/dist/tui/components/ModelRow.d.ts.map +0 -1
- package/dist/tui/components/ModelRow.js +0 -15
- package/dist/tui/components/ModelRow.js.map +0 -1
- package/dist/tui/components/ModelView.d.ts +0 -13
- package/dist/tui/components/ModelView.d.ts.map +0 -1
- package/dist/tui/components/ModelView.js +0 -96
- package/dist/tui/components/ModelView.js.map +0 -1
- package/dist/tui/components/OverviewView.d.ts +0 -14
- package/dist/tui/components/OverviewView.d.ts.map +0 -1
- package/dist/tui/components/OverviewView.js +0 -65
- package/dist/tui/components/OverviewView.js.map +0 -1
- package/dist/tui/components/StatsView.d.ts +0 -14
- package/dist/tui/components/StatsView.d.ts.map +0 -1
- package/dist/tui/components/StatsView.js +0 -102
- package/dist/tui/components/StatsView.js.map +0 -1
- package/dist/tui/components/TokenBreakdown.d.ts +0 -14
- package/dist/tui/components/TokenBreakdown.d.ts.map +0 -1
- package/dist/tui/components/TokenBreakdown.js +0 -10
- package/dist/tui/components/TokenBreakdown.js.map +0 -1
- package/dist/tui/components/index.d.ts +0 -16
- package/dist/tui/components/index.d.ts.map +0 -1
- package/dist/tui/components/index.js +0 -13
- package/dist/tui/components/index.js.map +0 -1
- package/dist/tui/config/settings.d.ts +0 -15
- package/dist/tui/config/settings.d.ts.map +0 -1
- package/dist/tui/config/settings.js +0 -147
- package/dist/tui/config/settings.js.map +0 -1
- package/dist/tui/config/themes.d.ts +0 -15
- package/dist/tui/config/themes.d.ts.map +0 -1
- package/dist/tui/config/themes.js +0 -82
- package/dist/tui/config/themes.js.map +0 -1
- package/dist/tui/hooks/useData.d.ts +0 -19
- package/dist/tui/hooks/useData.d.ts.map +0 -1
- package/dist/tui/hooks/useData.js +0 -468
- package/dist/tui/hooks/useData.js.map +0 -1
- package/dist/tui/index.d.ts +0 -4
- package/dist/tui/index.d.ts.map +0 -1
- package/dist/tui/index.js +0 -36
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/types/index.d.ts +0 -137
- package/dist/tui/types/index.d.ts.map +0 -1
- package/dist/tui/types/index.js +0 -26
- package/dist/tui/types/index.js.map +0 -1
- package/dist/tui/utils/cleanup.d.ts +0 -22
- package/dist/tui/utils/cleanup.d.ts.map +0 -1
- package/dist/tui/utils/cleanup.js +0 -59
- package/dist/tui/utils/cleanup.js.map +0 -1
- package/dist/tui/utils/colors.d.ts +0 -19
- package/dist/tui/utils/colors.d.ts.map +0 -1
- package/dist/tui/utils/colors.js +0 -71
- package/dist/tui/utils/colors.js.map +0 -1
- package/dist/tui/utils/format.d.ts +0 -7
- package/dist/tui/utils/format.d.ts.map +0 -1
- package/dist/tui/utils/format.js +0 -45
- package/dist/tui/utils/format.js.map +0 -1
- package/dist/tui/utils/responsive.d.ts +0 -5
- package/dist/tui/utils/responsive.d.ts.map +0 -1
- package/dist/tui/utils/responsive.js +0 -5
- package/dist/tui/utils/responsive.js.map +0 -1
- package/dist/wrapped.d.ts +0 -43
- package/dist/wrapped.d.ts.map +0 -1
- package/dist/wrapped.js +0 -719
- package/dist/wrapped.js.map +0 -1
- package/src/auth.ts +0 -211
- package/src/cli.ts +0 -1892
- package/src/credentials.ts +0 -176
- package/src/cursor.ts +0 -1044
- package/src/date-utils.ts +0 -51
- package/src/graph-types.ts +0 -175
- package/src/native-runner.js +0 -4
- package/src/native-runner.ts +0 -91
- package/src/native.ts +0 -633
- package/src/sessions/types.ts +0 -59
- package/src/spinner.ts +0 -283
- package/src/submit.ts +0 -360
- package/src/table.ts +0 -233
- package/src/tui/App.tsx +0 -453
- package/src/tui/components/BarChart.tsx +0 -205
- package/src/tui/components/DailyView.tsx +0 -132
- package/src/tui/components/DateBreakdownPanel.tsx +0 -79
- package/src/tui/components/Footer.tsx +0 -380
- package/src/tui/components/Header.tsx +0 -68
- package/src/tui/components/Legend.tsx +0 -39
- package/src/tui/components/LoadingSpinner.tsx +0 -81
- package/src/tui/components/ModelRow.tsx +0 -47
- package/src/tui/components/ModelView.tsx +0 -147
- package/src/tui/components/OverviewView.tsx +0 -121
- package/src/tui/components/StatsView.tsx +0 -249
- package/src/tui/components/TokenBreakdown.tsx +0 -46
- package/src/tui/components/index.ts +0 -15
- package/src/tui/config/settings.ts +0 -183
- package/src/tui/config/themes.ts +0 -115
- package/src/tui/hooks/useData.ts +0 -558
- package/src/tui/index.tsx +0 -44
- package/src/tui/opentui.d.ts +0 -166
- package/src/tui/types/index.ts +0 -173
- package/src/tui/utils/cleanup.ts +0 -65
- package/src/tui/utils/colors.ts +0 -78
- package/src/tui/utils/format.ts +0 -36
- package/src/tui/utils/responsive.ts +0 -8
- package/src/types.d.ts +0 -28
- package/src/wrapped.ts +0 -848
package/src/date-utils.ts
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
export function formatDateLocal(date: Date): string {
|
|
2
|
-
const y = date.getFullYear();
|
|
3
|
-
const m = String(date.getMonth() + 1).padStart(2, "0");
|
|
4
|
-
const d = String(date.getDate()).padStart(2, "0");
|
|
5
|
-
return `${y}-${m}-${d}`;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export function parseDateStringToLocal(dateStr: string): Date | null {
|
|
9
|
-
const match = dateStr.match(/^(\d{4})-(\d{2})-(\d{2})$/);
|
|
10
|
-
if (!match) return null;
|
|
11
|
-
const [, yearStr, monthStr, dayStr] = match;
|
|
12
|
-
const year = parseInt(yearStr);
|
|
13
|
-
const month = parseInt(monthStr) - 1;
|
|
14
|
-
const day = parseInt(dayStr);
|
|
15
|
-
const date = new Date(year, month, day);
|
|
16
|
-
if (date.getFullYear() !== year || date.getMonth() !== month || date.getDate() !== day) {
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
return date;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export function getStartOfDayTimestamp(date: Date): number {
|
|
23
|
-
const start = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0, 0, 0, 0);
|
|
24
|
-
return start.getTime();
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export function getEndOfDayTimestamp(date: Date): number {
|
|
28
|
-
// Returns start of NEXT day (exclusive upper bound for half-open interval [since, until))
|
|
29
|
-
const nextDay = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1, 0, 0, 0, 0);
|
|
30
|
-
return nextDay.getTime();
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export function getContributionLocalDate(contrib: { date: string; timestampMs?: number }): string {
|
|
34
|
-
if (contrib.timestampMs != null) {
|
|
35
|
-
return formatDateLocal(new Date(contrib.timestampMs));
|
|
36
|
-
}
|
|
37
|
-
return contrib.date;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const MIN_VALID_TIMESTAMP_MS = 1_000_000_000_000;
|
|
41
|
-
const MAX_VALID_TIMESTAMP_MS = 4_102_444_800_000;
|
|
42
|
-
|
|
43
|
-
export function validateTimestampMs(ts: number, label: string): number {
|
|
44
|
-
if (!Number.isFinite(ts) || !Number.isSafeInteger(ts)) {
|
|
45
|
-
throw new Error(`${label} must be a finite safe integer, got ${ts}`);
|
|
46
|
-
}
|
|
47
|
-
if (ts < MIN_VALID_TIMESTAMP_MS || ts > MAX_VALID_TIMESTAMP_MS) {
|
|
48
|
-
throw new Error(`${label} out of valid range (${MIN_VALID_TIMESTAMP_MS}..${MAX_VALID_TIMESTAMP_MS}), got ${ts}`);
|
|
49
|
-
}
|
|
50
|
-
return ts;
|
|
51
|
-
}
|
package/src/graph-types.ts
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type definitions for contribution graph data
|
|
3
|
-
* Note: intensity is calculated based on COST ($), not tokens
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Valid source identifiers
|
|
8
|
-
*/
|
|
9
|
-
export type SourceType = "opencode" | "claude" | "codex" | "gemini" | "cursor" | "amp" | "droid" | "openclaw" | "pi" | "kimi";
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Token breakdown by category
|
|
13
|
-
*/
|
|
14
|
-
export interface TokenBreakdown {
|
|
15
|
-
input: number;
|
|
16
|
-
output: number;
|
|
17
|
-
cacheRead: number;
|
|
18
|
-
cacheWrite: number;
|
|
19
|
-
reasoning: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Per-source contribution for a single day
|
|
24
|
-
*/
|
|
25
|
-
export interface SourceContribution {
|
|
26
|
-
/** Source identifier */
|
|
27
|
-
source: SourceType;
|
|
28
|
-
|
|
29
|
-
/** Exact model ID as reported by the source */
|
|
30
|
-
modelId: string;
|
|
31
|
-
|
|
32
|
-
/** Provider ID if available */
|
|
33
|
-
providerId?: string;
|
|
34
|
-
|
|
35
|
-
/** Token counts */
|
|
36
|
-
tokens: TokenBreakdown;
|
|
37
|
-
|
|
38
|
-
/** Calculated cost for this source/model combination */
|
|
39
|
-
cost: number;
|
|
40
|
-
|
|
41
|
-
/** Number of messages/requests */
|
|
42
|
-
messages: number;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Daily contribution entry with full granularity
|
|
47
|
-
*/
|
|
48
|
-
export interface DailyContribution {
|
|
49
|
-
/** ISO date string (YYYY-MM-DD) in UTC - note: this is the UTC day bucket, not local date */
|
|
50
|
-
date: string;
|
|
51
|
-
|
|
52
|
-
/** Unix timestampMs (ms) of earliest message in this UTC day bucket.
|
|
53
|
-
* Undefined for days with no valid timestamps. */
|
|
54
|
-
timestampMs?: number;
|
|
55
|
-
|
|
56
|
-
/** Aggregated totals for the day */
|
|
57
|
-
totals: {
|
|
58
|
-
/** Total tokens (input + output + cache) */
|
|
59
|
-
tokens: number;
|
|
60
|
-
/** Total cost in USD */
|
|
61
|
-
cost: number;
|
|
62
|
-
/** Number of messages/requests */
|
|
63
|
-
messages: number;
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
/**
|
|
67
|
-
* Calculated intensity grade (0-4)
|
|
68
|
-
* Based on COST, not tokens
|
|
69
|
-
* 0 = no activity, 4 = highest cost relative to max
|
|
70
|
-
*/
|
|
71
|
-
intensity: 0 | 1 | 2 | 3 | 4;
|
|
72
|
-
|
|
73
|
-
/** Token breakdown by category (aggregated across all sources) */
|
|
74
|
-
tokenBreakdown: TokenBreakdown;
|
|
75
|
-
|
|
76
|
-
/** Per-source breakdown with model information */
|
|
77
|
-
sources: SourceContribution[];
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/**
|
|
81
|
-
* Year-level summary
|
|
82
|
-
*/
|
|
83
|
-
export interface YearSummary {
|
|
84
|
-
/** Year as string (e.g., "2024") */
|
|
85
|
-
year: string;
|
|
86
|
-
|
|
87
|
-
/** Total tokens for the year */
|
|
88
|
-
totalTokens: number;
|
|
89
|
-
|
|
90
|
-
/** Total cost for the year */
|
|
91
|
-
totalCost: number;
|
|
92
|
-
|
|
93
|
-
/** Date range for this year's data */
|
|
94
|
-
range: {
|
|
95
|
-
start: string;
|
|
96
|
-
end: string;
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Summary statistics
|
|
102
|
-
*/
|
|
103
|
-
export interface DataSummary {
|
|
104
|
-
/** Total tokens across all time */
|
|
105
|
-
totalTokens: number;
|
|
106
|
-
|
|
107
|
-
/** Total cost across all time */
|
|
108
|
-
totalCost: number;
|
|
109
|
-
|
|
110
|
-
/** Total number of days in date range */
|
|
111
|
-
totalDays: number;
|
|
112
|
-
|
|
113
|
-
/** Number of days with activity */
|
|
114
|
-
activeDays: number;
|
|
115
|
-
|
|
116
|
-
/** Average cost per day (based on active days) */
|
|
117
|
-
averagePerDay: number;
|
|
118
|
-
|
|
119
|
-
/** Maximum cost in a single day (used for intensity calculation) */
|
|
120
|
-
maxCostInSingleDay: number;
|
|
121
|
-
|
|
122
|
-
/** All sources present in the data */
|
|
123
|
-
sources: SourceType[];
|
|
124
|
-
|
|
125
|
-
/** All unique model IDs across all sources */
|
|
126
|
-
models: string[];
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
/**
|
|
130
|
-
* Metadata about the export
|
|
131
|
-
*/
|
|
132
|
-
export interface ExportMeta {
|
|
133
|
-
/** ISO timestamp of when the data was generated */
|
|
134
|
-
generatedAt: string;
|
|
135
|
-
|
|
136
|
-
/** CLI version that generated this data */
|
|
137
|
-
version: string;
|
|
138
|
-
|
|
139
|
-
/** Date range of the data */
|
|
140
|
-
dateRange: {
|
|
141
|
-
start: string;
|
|
142
|
-
end: string;
|
|
143
|
-
};
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* Root data structure exported by CLI
|
|
148
|
-
* This is the complete JSON schema for contribution graph data
|
|
149
|
-
*/
|
|
150
|
-
export interface TokenContributionData {
|
|
151
|
-
/** Metadata about the export */
|
|
152
|
-
meta: ExportMeta;
|
|
153
|
-
|
|
154
|
-
/** Summary statistics */
|
|
155
|
-
summary: DataSummary;
|
|
156
|
-
|
|
157
|
-
/** Year-by-year breakdown for multi-year views */
|
|
158
|
-
years: YearSummary[];
|
|
159
|
-
|
|
160
|
-
/** Daily contribution data - the core dataset */
|
|
161
|
-
contributions: DailyContribution[];
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
* Unified message format for aggregation
|
|
166
|
-
* Used internally to normalize data from different sources
|
|
167
|
-
*/
|
|
168
|
-
export interface UnifiedMessage {
|
|
169
|
-
source: SourceType;
|
|
170
|
-
modelId: string;
|
|
171
|
-
providerId?: string;
|
|
172
|
-
timestampMs: number; // Unix milliseconds
|
|
173
|
-
tokens: TokenBreakdown;
|
|
174
|
-
cost: number;
|
|
175
|
-
}
|
package/src/native-runner.js
DELETED
package/src/native-runner.ts
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* Native Runner - Subprocess for non-blocking native Rust calls
|
|
4
|
-
*
|
|
5
|
-
* This script runs in a separate process to keep the main event loop free
|
|
6
|
-
* for UI rendering (e.g., spinner animation).
|
|
7
|
-
*
|
|
8
|
-
* Communication: tmpfile (JSON input) -> tmpfile (JSON output)
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { readFileSync, writeFileSync } from "node:fs";
|
|
12
|
-
|
|
13
|
-
interface NativeRunnerRequest {
|
|
14
|
-
method: string;
|
|
15
|
-
args: unknown[];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
async function main() {
|
|
19
|
-
const inputFile = process.argv[2];
|
|
20
|
-
const outputFile = process.argv[3];
|
|
21
|
-
|
|
22
|
-
if (!inputFile || !outputFile) {
|
|
23
|
-
process.stderr.write(JSON.stringify({ error: "Usage: native-runner <inputFile> <outputFile>" }));
|
|
24
|
-
process.exit(1);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
// Dynamic import so that load failures are caught and reported as JSON to stderr
|
|
28
|
-
// rather than causing an unhandled crash with no diagnostic output (e.g. on NixOS
|
|
29
|
-
// where the .node binary's dynamic linker path differs from standard Linux paths).
|
|
30
|
-
let nativeCore: typeof import("@tokscale/core");
|
|
31
|
-
try {
|
|
32
|
-
const mod = await import("@tokscale/core");
|
|
33
|
-
// CJS modules wrapped by Bun expose exports as .default; fall back to the namespace.
|
|
34
|
-
nativeCore = ((mod as unknown as { default: typeof mod }).default ?? mod) as typeof import("@tokscale/core");
|
|
35
|
-
} catch (e) {
|
|
36
|
-
const err = e as Error;
|
|
37
|
-
process.stderr.write(JSON.stringify({
|
|
38
|
-
error: `Failed to load native module (@tokscale/core): ${err.message}`,
|
|
39
|
-
stack: err.stack,
|
|
40
|
-
}));
|
|
41
|
-
process.exit(1);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
const input = readFileSync(inputFile, "utf-8");
|
|
45
|
-
|
|
46
|
-
let request: NativeRunnerRequest;
|
|
47
|
-
try {
|
|
48
|
-
request = JSON.parse(input) as NativeRunnerRequest;
|
|
49
|
-
} catch (e) {
|
|
50
|
-
throw new Error(`Malformed JSON input: ${(e as Error).message}`);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const { method, args } = request;
|
|
54
|
-
|
|
55
|
-
if (!Array.isArray(args) || args.length === 0) {
|
|
56
|
-
throw new Error(`Invalid args for method '${method}': expected at least 1 argument`);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
let result: unknown;
|
|
60
|
-
|
|
61
|
-
switch (method) {
|
|
62
|
-
case "parseLocalSources":
|
|
63
|
-
result = nativeCore.parseLocalSources(args[0] as Parameters<typeof nativeCore.parseLocalSources>[0]);
|
|
64
|
-
break;
|
|
65
|
-
case "finalizeReport":
|
|
66
|
-
result = await nativeCore.finalizeReport(args[0] as Parameters<typeof nativeCore.finalizeReport>[0]);
|
|
67
|
-
break;
|
|
68
|
-
case "finalizeMonthlyReport":
|
|
69
|
-
result = await nativeCore.finalizeMonthlyReport(args[0] as Parameters<typeof nativeCore.finalizeMonthlyReport>[0]);
|
|
70
|
-
break;
|
|
71
|
-
case "finalizeGraph":
|
|
72
|
-
result = await nativeCore.finalizeGraph(args[0] as Parameters<typeof nativeCore.finalizeGraph>[0]);
|
|
73
|
-
break;
|
|
74
|
-
case "finalizeReportAndGraph":
|
|
75
|
-
result = await nativeCore.finalizeReportAndGraph(args[0] as Parameters<typeof nativeCore.finalizeReportAndGraph>[0]);
|
|
76
|
-
break;
|
|
77
|
-
default:
|
|
78
|
-
throw new Error(`Unknown method: ${method}`);
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
writeFileSync(outputFile, JSON.stringify(result), "utf-8");
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
main().catch((e) => {
|
|
85
|
-
const error = e as Error;
|
|
86
|
-
process.stderr.write(JSON.stringify({
|
|
87
|
-
error: error.message,
|
|
88
|
-
stack: error.stack,
|
|
89
|
-
}));
|
|
90
|
-
process.exit(1);
|
|
91
|
-
});
|