@moneysiren/cli 0.1.0-alpha.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 (128) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -0
  3. package/dist/apps/cli/src/cli.d.ts +56 -0
  4. package/dist/apps/cli/src/cli.js +182 -0
  5. package/dist/apps/cli/src/commands/dashboard.d.ts +3 -0
  6. package/dist/apps/cli/src/commands/dashboard.js +239 -0
  7. package/dist/apps/cli/src/commands/doctor.d.ts +3 -0
  8. package/dist/apps/cli/src/commands/doctor.js +25 -0
  9. package/dist/apps/cli/src/commands/init.d.ts +3 -0
  10. package/dist/apps/cli/src/commands/init.js +18 -0
  11. package/dist/apps/cli/src/commands/install.d.ts +3 -0
  12. package/dist/apps/cli/src/commands/install.js +116 -0
  13. package/dist/apps/cli/src/commands/modes.d.ts +3 -0
  14. package/dist/apps/cli/src/commands/modes.js +65 -0
  15. package/dist/apps/cli/src/commands/notify.d.ts +3 -0
  16. package/dist/apps/cli/src/commands/notify.js +430 -0
  17. package/dist/apps/cli/src/commands/report.d.ts +3 -0
  18. package/dist/apps/cli/src/commands/report.js +206 -0
  19. package/dist/apps/cli/src/commands/runtime.d.ts +5 -0
  20. package/dist/apps/cli/src/commands/runtime.js +133 -0
  21. package/dist/apps/cli/src/commands/shared.d.ts +9 -0
  22. package/dist/apps/cli/src/commands/shared.js +29 -0
  23. package/dist/apps/cli/src/commands/summary.d.ts +3 -0
  24. package/dist/apps/cli/src/commands/summary.js +15 -0
  25. package/dist/apps/cli/src/commands/sync.d.ts +3 -0
  26. package/dist/apps/cli/src/commands/sync.js +393 -0
  27. package/dist/apps/cli/src/commands/theme.d.ts +3 -0
  28. package/dist/apps/cli/src/commands/theme.js +181 -0
  29. package/dist/apps/cli/src/home.d.ts +7 -0
  30. package/dist/apps/cli/src/home.js +97 -0
  31. package/dist/apps/cli/src/index.d.ts +3 -0
  32. package/dist/apps/cli/src/index.js +14 -0
  33. package/dist/apps/cli/src/install-profile.d.ts +35 -0
  34. package/dist/apps/cli/src/install-profile.js +124 -0
  35. package/dist/apps/cli/src/install-selector.d.ts +10 -0
  36. package/dist/apps/cli/src/install-selector.js +66 -0
  37. package/dist/apps/cli/src/interactive.d.ts +3 -0
  38. package/dist/apps/cli/src/interactive.js +32 -0
  39. package/dist/apps/cli/src/postinstall.d.ts +3 -0
  40. package/dist/apps/cli/src/postinstall.js +42 -0
  41. package/dist/apps/cli/src/runtime-adapter.d.ts +24 -0
  42. package/dist/apps/cli/src/runtime-adapter.js +185 -0
  43. package/dist/apps/cli/src/slash.d.ts +15 -0
  44. package/dist/apps/cli/src/slash.js +202 -0
  45. package/dist/apps/cli/src/summary-model.d.ts +51 -0
  46. package/dist/apps/cli/src/summary-model.js +136 -0
  47. package/dist/apps/cli/src/theme.d.ts +18 -0
  48. package/dist/apps/cli/src/theme.js +118 -0
  49. package/dist/packages/config/src/index.d.ts +3 -0
  50. package/dist/packages/config/src/index.js +3 -0
  51. package/dist/packages/config/src/load.d.ts +3 -0
  52. package/dist/packages/config/src/load.js +77 -0
  53. package/dist/packages/config/src/schema.d.ts +46 -0
  54. package/dist/packages/config/src/schema.js +25 -0
  55. package/dist/packages/connectors/aws/src/cost-explorer.d.ts +34 -0
  56. package/dist/packages/connectors/aws/src/cost-explorer.js +43 -0
  57. package/dist/packages/connectors/aws/src/index.d.ts +35 -0
  58. package/dist/packages/connectors/aws/src/index.js +67 -0
  59. package/dist/packages/connectors/aws/src/normalize.d.ts +69 -0
  60. package/dist/packages/connectors/aws/src/normalize.js +141 -0
  61. package/dist/packages/connectors/aws/src/sdk-client.d.ts +6 -0
  62. package/dist/packages/connectors/aws/src/sdk-client.js +21 -0
  63. package/dist/packages/connectors/cloudflare/src/client.d.ts +23 -0
  64. package/dist/packages/connectors/cloudflare/src/client.js +107 -0
  65. package/dist/packages/connectors/cloudflare/src/index.d.ts +33 -0
  66. package/dist/packages/connectors/cloudflare/src/index.js +81 -0
  67. package/dist/packages/connectors/cloudflare/src/normalize.d.ts +113 -0
  68. package/dist/packages/connectors/cloudflare/src/normalize.js +288 -0
  69. package/dist/packages/connectors/mock/src/index.d.ts +58 -0
  70. package/dist/packages/connectors/mock/src/index.js +66 -0
  71. package/dist/packages/connectors/openai/src/index.d.ts +55 -0
  72. package/dist/packages/connectors/openai/src/index.js +169 -0
  73. package/dist/packages/connectors/openai/src/normalize.d.ts +91 -0
  74. package/dist/packages/connectors/openai/src/normalize.js +180 -0
  75. package/dist/packages/connectors/supabase/src/client.d.ts +22 -0
  76. package/dist/packages/connectors/supabase/src/client.js +132 -0
  77. package/dist/packages/connectors/supabase/src/index.d.ts +33 -0
  78. package/dist/packages/connectors/supabase/src/index.js +87 -0
  79. package/dist/packages/connectors/supabase/src/normalize.d.ts +106 -0
  80. package/dist/packages/connectors/supabase/src/normalize.js +266 -0
  81. package/dist/packages/core/src/collector.d.ts +12 -0
  82. package/dist/packages/core/src/collector.js +68 -0
  83. package/dist/packages/core/src/index.d.ts +5 -0
  84. package/dist/packages/core/src/index.js +4 -0
  85. package/dist/packages/core/src/provider.d.ts +18 -0
  86. package/dist/packages/core/src/provider.js +2 -0
  87. package/dist/packages/core/src/risk-engine.d.ts +9 -0
  88. package/dist/packages/core/src/risk-engine.js +4 -0
  89. package/dist/packages/core/src/snapshots.d.ts +49 -0
  90. package/dist/packages/core/src/snapshots.js +9 -0
  91. package/dist/packages/db/src/client.d.ts +11 -0
  92. package/dist/packages/db/src/client.js +14 -0
  93. package/dist/packages/db/src/index.d.ts +6 -0
  94. package/dist/packages/db/src/index.js +6 -0
  95. package/dist/packages/db/src/local-store.d.ts +161 -0
  96. package/dist/packages/db/src/local-store.js +623 -0
  97. package/dist/packages/db/src/migrate.d.ts +17 -0
  98. package/dist/packages/db/src/migrate.js +35 -0
  99. package/dist/packages/db/src/schema.d.ts +5 -0
  100. package/dist/packages/db/src/schema.js +120 -0
  101. package/dist/packages/db/src/sqlite-bin.d.ts +3 -0
  102. package/dist/packages/db/src/sqlite-bin.js +16 -0
  103. package/dist/packages/local-api/src/index.d.ts +2 -0
  104. package/dist/packages/local-api/src/index.js +2 -0
  105. package/dist/packages/local-api/src/server.d.ts +36 -0
  106. package/dist/packages/local-api/src/server.js +310 -0
  107. package/dist/packages/report/src/daily.d.ts +24 -0
  108. package/dist/packages/report/src/daily.js +9 -0
  109. package/dist/packages/report/src/index.d.ts +4 -0
  110. package/dist/packages/report/src/index.js +4 -0
  111. package/dist/packages/report/src/korean.d.ts +3 -0
  112. package/dist/packages/report/src/korean.js +62 -0
  113. package/dist/packages/report/src/slack.d.ts +34 -0
  114. package/dist/packages/report/src/slack.js +134 -0
  115. package/dist/packages/runtime/src/index.d.ts +2 -0
  116. package/dist/packages/runtime/src/index.js +2 -0
  117. package/dist/packages/runtime/src/runtime.d.ts +26 -0
  118. package/dist/packages/runtime/src/runtime.js +182 -0
  119. package/dist/packages/view-model/src/index.d.ts +3 -0
  120. package/dist/packages/view-model/src/index.js +3 -0
  121. package/dist/packages/view-model/src/notification-preferences-model.d.ts +47 -0
  122. package/dist/packages/view-model/src/notification-preferences-model.js +218 -0
  123. package/dist/packages/view-model/src/notification-preferences.d.ts +6 -0
  124. package/dist/packages/view-model/src/notification-preferences.js +36 -0
  125. package/dist/packages/view-model/src/view-model.d.ts +193 -0
  126. package/dist/packages/view-model/src/view-model.js +684 -0
  127. package/package.json +49 -0
  128. package/scripts/postinstall.mjs +11 -0
@@ -0,0 +1,193 @@
1
+ import { type NotificationPreferences, type NotificationWidgetKey } from "./notification-preferences.js";
2
+ export interface LocalSafeEnvelope {
3
+ generatedAt: string;
4
+ localOnly: true;
5
+ secretsReturned: false;
6
+ }
7
+ export type ViewModelHealthStatus = "ok" | "degraded" | "down" | "unknown";
8
+ export type ViewModelRiskSeverity = "info" | "warning" | "critical";
9
+ export interface ViewModelProviderRecord {
10
+ key: string;
11
+ displayName: string;
12
+ }
13
+ export interface ViewModelUsageSnapshotRecord {
14
+ providerKey: string;
15
+ collectedAt: string;
16
+ service: string;
17
+ metric: string;
18
+ unit: string;
19
+ value: number;
20
+ }
21
+ export interface ViewModelBillingSnapshotRecord {
22
+ providerKey: string;
23
+ collectedAt: string;
24
+ amountMinor: number;
25
+ currency: string;
26
+ status: string;
27
+ }
28
+ export interface ViewModelServiceHealthSnapshotRecord {
29
+ providerKey: string;
30
+ collectedAt: string;
31
+ service: string;
32
+ status: ViewModelHealthStatus;
33
+ region?: string;
34
+ message?: string;
35
+ }
36
+ export interface ViewModelCostEstimateRecord {
37
+ providerKey: string;
38
+ collectedAt: string;
39
+ estimatedAmountMinor: number;
40
+ currency: string;
41
+ confidence: "low" | "medium" | "high";
42
+ }
43
+ export interface ViewModelAlertRecord {
44
+ providerKey?: string;
45
+ createdAt: string;
46
+ severity: ViewModelRiskSeverity;
47
+ category: string;
48
+ title: string;
49
+ message: string;
50
+ }
51
+ export interface ViewModelStore {
52
+ providers: readonly ViewModelProviderRecord[];
53
+ usageSnapshots: readonly ViewModelUsageSnapshotRecord[];
54
+ billingSnapshots: readonly ViewModelBillingSnapshotRecord[];
55
+ serviceHealthSnapshots: readonly ViewModelServiceHealthSnapshotRecord[];
56
+ costEstimates: readonly ViewModelCostEstimateRecord[];
57
+ alerts: readonly ViewModelAlertRecord[];
58
+ }
59
+ export type ViewModelReadStore = () => Promise<ViewModelStore>;
60
+ export interface OperationsOverview extends LocalSafeEnvelope {
61
+ source: "sqlite" | "empty";
62
+ summary: {
63
+ providerCount: number;
64
+ connectedProviderCount: number;
65
+ totalEstimatedAmountMinor: number;
66
+ totalBillingAmountMinor: number;
67
+ currency: string;
68
+ usageSnapshotCount: number;
69
+ costEstimateCount: number;
70
+ alertCount: number;
71
+ criticalAlertCount: number;
72
+ healthStatus: ViewModelHealthStatus;
73
+ };
74
+ providers: readonly OperationsOverviewProvider[];
75
+ alerts: readonly OperationsOverviewAlert[];
76
+ }
77
+ export interface OperationsOverviewProvider {
78
+ providerKey: string;
79
+ displayName: string;
80
+ estimatedAmountMinor: number;
81
+ billingAmountMinor: number;
82
+ currency: string;
83
+ usageSnapshotCount: number;
84
+ costEstimateCount: number;
85
+ latestCollectedAt: string | null;
86
+ healthStatus: ViewModelHealthStatus;
87
+ riskLevel: "low" | "warning" | "critical";
88
+ alertCount: number;
89
+ }
90
+ export interface OperationsOverviewAlert {
91
+ providerKey: string | null;
92
+ displayName: string | null;
93
+ severity: ViewModelRiskSeverity;
94
+ category: string;
95
+ title: string;
96
+ message: string;
97
+ createdAt: string;
98
+ }
99
+ export interface TodayLiveView extends LocalSafeEnvelope {
100
+ timezone: string;
101
+ dateKey: string;
102
+ cacheState: "empty" | "fresh" | "stale";
103
+ summary: {
104
+ providerCount: number;
105
+ includedProviderCount: number;
106
+ todayLiveAmountMinor: number | null;
107
+ currency: string;
108
+ };
109
+ providers: readonly TodayLiveProviderView[];
110
+ }
111
+ export interface TodayLiveProviderInput {
112
+ providerKey: string;
113
+ displayName: string;
114
+ checkedAt: string | null;
115
+ freshness: "live" | "stale" | "error" | "unavailable" | "not_configured" | "locked";
116
+ confidence: "high" | "medium" | "low" | "none";
117
+ todayLiveAmountMinor: number | null;
118
+ currency: string;
119
+ included: boolean;
120
+ metrics?: readonly TodayLiveMetric[];
121
+ }
122
+ export interface TodayLiveProviderView extends TodayLiveProviderInput {
123
+ metrics: readonly TodayLiveMetric[];
124
+ }
125
+ export interface TodayLiveMetric {
126
+ key: string;
127
+ value: number;
128
+ unit: string;
129
+ }
130
+ export interface NotificationDigest extends LocalSafeEnvelope {
131
+ title: string;
132
+ status: "ok" | "attention" | "critical";
133
+ suppressedReason: string | null;
134
+ items: readonly NotificationDigestItem[];
135
+ }
136
+ export interface NotificationDigestItem {
137
+ widgetKey: NotificationWidgetKey;
138
+ kind: "summary" | "live" | "risk" | "usage" | "health";
139
+ severity: ViewModelRiskSeverity;
140
+ label: string;
141
+ value: string;
142
+ freshness?: TodayLiveProviderView["freshness"];
143
+ confidence?: TodayLiveProviderView["confidence"];
144
+ clickPath?: string;
145
+ }
146
+ export interface TrayMenuModel extends LocalSafeEnvelope {
147
+ title: string;
148
+ subtitle: string;
149
+ status: "ok" | "attention" | "critical";
150
+ items: readonly TrayMenuItem[];
151
+ }
152
+ export interface TrayMenuItem {
153
+ id: string;
154
+ label: string;
155
+ enabled: boolean;
156
+ kind: "command" | "separator" | "status";
157
+ action?: string;
158
+ urlPath?: string;
159
+ durationMinutes?: number;
160
+ }
161
+ export interface ReadOperationsOverviewOptions {
162
+ now?: () => Date;
163
+ store?: ViewModelStore;
164
+ readStore?: ViewModelReadStore;
165
+ }
166
+ export interface ReadTodayLiveViewOptions extends ReadOperationsOverviewOptions {
167
+ timezone?: string;
168
+ liveProviders?: readonly TodayLiveProviderInput[];
169
+ }
170
+ export interface ReadNotificationDigestOptions extends ReadTodayLiveViewOptions {
171
+ overview?: OperationsOverview;
172
+ todayLive?: TodayLiveView;
173
+ notificationPreferences?: NotificationPreferences;
174
+ }
175
+ export interface ReadTrayMenuModelOptions extends ReadNotificationDigestOptions {
176
+ digest?: NotificationDigest;
177
+ }
178
+ export declare function readOperationsOverview(options?: ReadOperationsOverviewOptions): Promise<OperationsOverview>;
179
+ export declare function buildOperationsOverview(store: ViewModelStore, options: {
180
+ generatedAt: string;
181
+ }): OperationsOverview;
182
+ export declare function readTodayLiveView(options?: ReadTodayLiveViewOptions): Promise<TodayLiveView>;
183
+ export declare function buildTodayLiveView(store: ViewModelStore, options: {
184
+ generatedAt: string;
185
+ now: Date;
186
+ timezone: string;
187
+ liveProviders?: readonly TodayLiveProviderInput[];
188
+ }): TodayLiveView;
189
+ export declare function readNotificationDigest(options?: ReadNotificationDigestOptions): Promise<NotificationDigest>;
190
+ export declare function buildNotificationDigest(overview: OperationsOverview, todayLive: TodayLiveView, preferences?: NotificationPreferences): NotificationDigest;
191
+ export declare function readTrayMenuModel(options?: ReadTrayMenuModelOptions): Promise<TrayMenuModel>;
192
+ export declare function buildTrayMenuModel(digest: NotificationDigest): TrayMenuModel;
193
+ //# sourceMappingURL=view-model.d.ts.map