codecard-cli 0.1.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 (71) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +94 -0
  3. package/dist/commands/alerts.d.ts +2 -0
  4. package/dist/commands/alerts.js +44 -0
  5. package/dist/commands/auth/login.d.ts +2 -0
  6. package/dist/commands/auth/login.js +43 -0
  7. package/dist/commands/auth/logout.d.ts +2 -0
  8. package/dist/commands/auth/logout.js +20 -0
  9. package/dist/commands/auth/whoami.d.ts +2 -0
  10. package/dist/commands/auth/whoami.js +32 -0
  11. package/dist/commands/balance.d.ts +2 -0
  12. package/dist/commands/balance.js +35 -0
  13. package/dist/commands/card/freeze.d.ts +3 -0
  14. package/dist/commands/card/freeze.js +68 -0
  15. package/dist/commands/card/list.d.ts +2 -0
  16. package/dist/commands/card/list.js +44 -0
  17. package/dist/commands/pnl.d.ts +2 -0
  18. package/dist/commands/pnl.js +57 -0
  19. package/dist/commands/project/create.d.ts +2 -0
  20. package/dist/commands/project/create.js +36 -0
  21. package/dist/commands/project/list.d.ts +2 -0
  22. package/dist/commands/project/list.js +42 -0
  23. package/dist/commands/rewards.d.ts +2 -0
  24. package/dist/commands/rewards.js +61 -0
  25. package/dist/commands/spend.d.ts +2 -0
  26. package/dist/commands/spend.js +116 -0
  27. package/dist/index.d.ts +2 -0
  28. package/dist/index.js +52 -0
  29. package/dist/lib/api-client.d.ts +23 -0
  30. package/dist/lib/api-client.js +113 -0
  31. package/dist/lib/config.d.ts +16 -0
  32. package/dist/lib/config.js +40 -0
  33. package/dist/lib/output.d.ts +20 -0
  34. package/dist/lib/output.js +69 -0
  35. package/dist/lib/update-check.d.ts +1 -0
  36. package/dist/lib/update-check.js +74 -0
  37. package/dist/mcp-server.d.ts +2 -0
  38. package/dist/mcp-server.js +133 -0
  39. package/dist/shared/alert.d.ts +24 -0
  40. package/dist/shared/alert.js +2 -0
  41. package/dist/shared/alerts.d.ts +3 -0
  42. package/dist/shared/alerts.js +103 -0
  43. package/dist/shared/card.d.ts +12 -0
  44. package/dist/shared/card.js +2 -0
  45. package/dist/shared/cards.d.ts +2 -0
  46. package/dist/shared/cards.js +60 -0
  47. package/dist/shared/common.d.ts +21 -0
  48. package/dist/shared/common.js +2 -0
  49. package/dist/shared/filters.d.ts +8 -0
  50. package/dist/shared/filters.js +59 -0
  51. package/dist/shared/formatters.d.ts +7 -0
  52. package/dist/shared/formatters.js +44 -0
  53. package/dist/shared/index.d.ts +15 -0
  54. package/dist/shared/index.js +43 -0
  55. package/dist/shared/project.d.ts +24 -0
  56. package/dist/shared/project.js +2 -0
  57. package/dist/shared/projects.d.ts +3 -0
  58. package/dist/shared/projects.js +104 -0
  59. package/dist/shared/reward.d.ts +26 -0
  60. package/dist/shared/reward.js +2 -0
  61. package/dist/shared/rewards.d.ts +4 -0
  62. package/dist/shared/rewards.js +25 -0
  63. package/dist/shared/transaction.d.ts +36 -0
  64. package/dist/shared/transaction.js +2 -0
  65. package/dist/shared/transactions.d.ts +2 -0
  66. package/dist/shared/transactions.js +34 -0
  67. package/dist/shared/user.d.ts +12 -0
  68. package/dist/shared/user.js +2 -0
  69. package/dist/shared/users.d.ts +3 -0
  70. package/dist/shared/users.js +15 -0
  71. package/package.json +41 -0
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockProjectPnls = exports.mockProjects = void 0;
4
+ exports.mockProjects = [
5
+ {
6
+ id: "proj_001",
7
+ name: "ai-tutor-app",
8
+ description: "AI-powered tutoring platform with adaptive learning paths",
9
+ status: "active",
10
+ color: "#b8f036",
11
+ cardId: "card_001",
12
+ monthlyBudget: 5000,
13
+ createdAt: "2026-01-10T08:00:00Z",
14
+ },
15
+ {
16
+ id: "proj_002",
17
+ name: "vibe-cli",
18
+ description: "CLI tool for scaffolding AI-powered apps",
19
+ status: "active",
20
+ color: "#5b8cff",
21
+ cardId: "card_002",
22
+ monthlyBudget: 2000,
23
+ createdAt: "2026-02-01T12:00:00Z",
24
+ },
25
+ {
26
+ id: "proj_003",
27
+ name: "client-dashco",
28
+ description: "Dashboard analytics for enterprise clients",
29
+ status: "active",
30
+ color: "#a07cff",
31
+ cardId: "card_003",
32
+ monthlyBudget: 8000,
33
+ createdAt: "2026-02-15T09:00:00Z",
34
+ },
35
+ {
36
+ id: "proj_004",
37
+ name: "experiment-rag",
38
+ description: "Experimental RAG pipeline for document Q&A",
39
+ status: "active",
40
+ color: "#3ee8c8",
41
+ cardId: "card_004",
42
+ monthlyBudget: 1000,
43
+ createdAt: "2026-03-01T14:00:00Z",
44
+ },
45
+ ];
46
+ exports.mockProjectPnls = [
47
+ {
48
+ projectId: "proj_001",
49
+ projectName: "ai-tutor-app",
50
+ period: "March 2026",
51
+ spend: 2340,
52
+ revenue: 8120,
53
+ net: 5780,
54
+ margin: 71.2,
55
+ topProviders: [
56
+ { name: "OpenAI", amount: 1200 },
57
+ { name: "Anthropic", amount: 680 },
58
+ { name: "Vercel", amount: 460 },
59
+ ],
60
+ },
61
+ {
62
+ projectId: "proj_002",
63
+ projectName: "vibe-cli",
64
+ period: "March 2026",
65
+ spend: 890,
66
+ revenue: 3200,
67
+ net: 2310,
68
+ margin: 72.2,
69
+ topProviders: [
70
+ { name: "Anthropic", amount: 520 },
71
+ { name: "AWS", amount: 230 },
72
+ { name: "GitHub", amount: 140 },
73
+ ],
74
+ },
75
+ {
76
+ projectId: "proj_003",
77
+ projectName: "client-dashco",
78
+ period: "March 2026",
79
+ spend: 4100,
80
+ revenue: 3800,
81
+ net: -300,
82
+ margin: -7.9,
83
+ topProviders: [
84
+ { name: "OpenAI", amount: 1800 },
85
+ { name: "Vercel", amount: 1200 },
86
+ { name: "Supabase", amount: 600 },
87
+ { name: "PostHog", amount: 500 },
88
+ ],
89
+ },
90
+ {
91
+ projectId: "proj_004",
92
+ projectName: "experiment-rag",
93
+ period: "March 2026",
94
+ spend: 560,
95
+ revenue: 0,
96
+ net: -560,
97
+ margin: -100,
98
+ topProviders: [
99
+ { name: "Anthropic", amount: 320 },
100
+ { name: "Replicate", amount: 160 },
101
+ { name: "Supabase", amount: 80 },
102
+ ],
103
+ },
104
+ ];
@@ -0,0 +1,26 @@
1
+ export interface RewardBalance {
2
+ totalCredits: number;
3
+ pendingCredits: number;
4
+ lifetimeEarned: number;
5
+ lifetimeRedeemed: number;
6
+ }
7
+ export interface RewardTier {
8
+ category: string;
9
+ rate: number;
10
+ earned: number;
11
+ spend: number;
12
+ }
13
+ export interface Redemption {
14
+ id: string;
15
+ provider: string;
16
+ amount: number;
17
+ boostedValue: number;
18
+ date: string;
19
+ }
20
+ export interface RewardHistory {
21
+ id: string;
22
+ type: "earned" | "redeemed";
23
+ amount: number;
24
+ description: string;
25
+ date: string;
26
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ import { RewardBalance, RewardTier, RewardHistory } from "./reward";
2
+ export declare const mockRewardBalance: RewardBalance;
3
+ export declare const mockRewardTiers: RewardTier[];
4
+ export declare const mockRewardHistory: RewardHistory[];
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockRewardHistory = exports.mockRewardTiers = exports.mockRewardBalance = void 0;
4
+ exports.mockRewardBalance = {
5
+ totalCredits: 142.3,
6
+ pendingCredits: 18.5,
7
+ lifetimeEarned: 342.3,
8
+ lifetimeRedeemed: 200,
9
+ };
10
+ exports.mockRewardTiers = [
11
+ { category: "AI Model APIs", rate: 5, earned: 234.0, spend: 4680 },
12
+ { category: "Cloud & Infrastructure", rate: 4, earned: 78.8, spend: 1970 },
13
+ { category: "Dev Tools & SaaS", rate: 3, earned: 20.1, spend: 670 },
14
+ { category: "Everything Else", rate: 1, earned: 9.4, spend: 940 },
15
+ ];
16
+ exports.mockRewardHistory = [
17
+ { id: "rh_001", type: "earned", amount: 45, description: "5% on OpenAI — ai-tutor-app", date: "2026-03-28T10:00:00Z" },
18
+ { id: "rh_002", type: "earned", amount: 17, description: "5% on Anthropic — ai-tutor-app", date: "2026-03-25T11:00:00Z" },
19
+ { id: "rh_003", type: "redeemed", amount: -100, description: "Statement credit", date: "2026-03-20T08:00:00Z" },
20
+ { id: "rh_004", type: "earned", amount: 24, description: "4% on Vercel — client-dashco", date: "2026-03-15T00:00:00Z" },
21
+ { id: "rh_005", type: "redeemed", amount: -100, description: "Anthropic API credits (1.5x = $150 value)", date: "2026-03-10T09:00:00Z" },
22
+ { id: "rh_006", type: "earned", amount: 13, description: "5% on Anthropic — vibe-cli", date: "2026-03-05T15:00:00Z" },
23
+ { id: "rh_007", type: "earned", amount: 9.2, description: "4% on AWS — vibe-cli", date: "2026-03-01T00:00:00Z" },
24
+ { id: "rh_008", type: "earned", amount: 15, description: "3% on PostHog — client-dashco", date: "2026-03-01T00:00:00Z" },
25
+ ];
@@ -0,0 +1,36 @@
1
+ export type SpendCategory = "ai-apis" | "cloud-infra" | "dev-tools" | "other";
2
+ export interface Transaction {
3
+ id: string;
4
+ cardId: string;
5
+ projectId: string;
6
+ merchant: string;
7
+ provider: string;
8
+ category: SpendCategory;
9
+ amount: number;
10
+ rewardRate: number;
11
+ rewardEarned: number;
12
+ date: string;
13
+ description: string;
14
+ }
15
+ export interface SpendBreakdown {
16
+ totalSpend: number;
17
+ byCategory: {
18
+ category: SpendCategory;
19
+ amount: number;
20
+ percentage: number;
21
+ }[];
22
+ byProvider: {
23
+ provider: string;
24
+ amount: number;
25
+ percentage: number;
26
+ }[];
27
+ byProject: {
28
+ projectId: string;
29
+ projectName: string;
30
+ amount: number;
31
+ }[];
32
+ dailyTrend: {
33
+ date: string;
34
+ amount: number;
35
+ }[];
36
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ import { Transaction } from "./transaction";
2
+ export declare const mockTransactions: Transaction[];
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockTransactions = void 0;
4
+ const cat = (c) => c;
5
+ exports.mockTransactions = [
6
+ // ai-tutor-app transactions
7
+ { id: "tx_001", cardId: "card_001", projectId: "proj_001", merchant: "OpenAI", provider: "OpenAI", category: cat("ai-apis"), amount: 420, rewardRate: 0.05, rewardEarned: 21, date: "2026-03-28T10:00:00Z", description: "GPT-4o API usage" },
8
+ { id: "tx_002", cardId: "card_001", projectId: "proj_001", merchant: "OpenAI", provider: "OpenAI", category: cat("ai-apis"), amount: 380, rewardRate: 0.05, rewardEarned: 19, date: "2026-03-21T14:00:00Z", description: "GPT-4o API usage" },
9
+ { id: "tx_003", cardId: "card_001", projectId: "proj_001", merchant: "OpenAI", provider: "OpenAI", category: cat("ai-apis"), amount: 400, rewardRate: 0.05, rewardEarned: 20, date: "2026-03-14T09:00:00Z", description: "GPT-4o API usage" },
10
+ { id: "tx_004", cardId: "card_001", projectId: "proj_001", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 340, rewardRate: 0.05, rewardEarned: 17, date: "2026-03-25T11:00:00Z", description: "Claude API usage" },
11
+ { id: "tx_005", cardId: "card_001", projectId: "proj_001", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 340, rewardRate: 0.05, rewardEarned: 17, date: "2026-03-18T08:00:00Z", description: "Claude API usage" },
12
+ { id: "tx_006", cardId: "card_001", projectId: "proj_001", merchant: "Vercel", provider: "Vercel", category: cat("cloud-infra"), amount: 230, rewardRate: 0.04, rewardEarned: 9.2, date: "2026-03-01T00:00:00Z", description: "Vercel Pro plan" },
13
+ { id: "tx_007", cardId: "card_001", projectId: "proj_001", merchant: "Vercel", provider: "Vercel", category: cat("cloud-infra"), amount: 230, rewardRate: 0.04, rewardEarned: 9.2, date: "2026-03-15T00:00:00Z", description: "Vercel bandwidth overage" },
14
+ // vibe-cli transactions
15
+ { id: "tx_008", cardId: "card_002", projectId: "proj_002", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 260, rewardRate: 0.05, rewardEarned: 13, date: "2026-03-26T15:00:00Z", description: "Claude Sonnet API" },
16
+ { id: "tx_009", cardId: "card_002", projectId: "proj_002", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 260, rewardRate: 0.05, rewardEarned: 13, date: "2026-03-19T10:00:00Z", description: "Claude Sonnet API" },
17
+ { id: "tx_010", cardId: "card_002", projectId: "proj_002", merchant: "AWS", provider: "AWS", category: cat("cloud-infra"), amount: 230, rewardRate: 0.04, rewardEarned: 9.2, date: "2026-03-01T00:00:00Z", description: "AWS Lambda + S3" },
18
+ { id: "tx_011", cardId: "card_002", projectId: "proj_002", merchant: "GitHub", provider: "GitHub", category: cat("dev-tools"), amount: 140, rewardRate: 0.03, rewardEarned: 4.2, date: "2026-03-01T00:00:00Z", description: "GitHub Team plan" },
19
+ // client-dashco transactions
20
+ { id: "tx_012", cardId: "card_003", projectId: "proj_003", merchant: "OpenAI", provider: "OpenAI", category: cat("ai-apis"), amount: 900, rewardRate: 0.05, rewardEarned: 45, date: "2026-03-27T12:00:00Z", description: "GPT-4o embeddings" },
21
+ { id: "tx_013", cardId: "card_003", projectId: "proj_003", merchant: "OpenAI", provider: "OpenAI", category: cat("ai-apis"), amount: 900, rewardRate: 0.05, rewardEarned: 45, date: "2026-03-20T12:00:00Z", description: "GPT-4o embeddings" },
22
+ { id: "tx_014", cardId: "card_003", projectId: "proj_003", merchant: "Vercel", provider: "Vercel", category: cat("cloud-infra"), amount: 600, rewardRate: 0.04, rewardEarned: 24, date: "2026-03-01T00:00:00Z", description: "Vercel Enterprise" },
23
+ { id: "tx_015", cardId: "card_003", projectId: "proj_003", merchant: "Vercel", provider: "Vercel", category: cat("cloud-infra"), amount: 600, rewardRate: 0.04, rewardEarned: 24, date: "2026-03-15T00:00:00Z", description: "Vercel bandwidth" },
24
+ { id: "tx_016", cardId: "card_003", projectId: "proj_003", merchant: "Supabase", provider: "Supabase", category: cat("cloud-infra"), amount: 600, rewardRate: 0.04, rewardEarned: 24, date: "2026-03-01T00:00:00Z", description: "Supabase Pro plan" },
25
+ { id: "tx_017", cardId: "card_003", projectId: "proj_003", merchant: "PostHog", provider: "PostHog", category: cat("dev-tools"), amount: 500, rewardRate: 0.03, rewardEarned: 15, date: "2026-03-01T00:00:00Z", description: "PostHog Scale plan" },
26
+ // experiment-rag transactions
27
+ { id: "tx_018", cardId: "card_004", projectId: "proj_004", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 160, rewardRate: 0.05, rewardEarned: 8, date: "2026-03-24T16:00:00Z", description: "Claude Haiku API" },
28
+ { id: "tx_019", cardId: "card_004", projectId: "proj_004", merchant: "Anthropic", provider: "Anthropic", category: cat("ai-apis"), amount: 160, rewardRate: 0.05, rewardEarned: 8, date: "2026-03-17T11:00:00Z", description: "Claude Haiku API" },
29
+ { id: "tx_020", cardId: "card_004", projectId: "proj_004", merchant: "Replicate", provider: "Replicate", category: cat("ai-apis"), amount: 160, rewardRate: 0.05, rewardEarned: 8, date: "2026-03-22T09:00:00Z", description: "Replicate inference" },
30
+ { id: "tx_021", cardId: "card_004", projectId: "proj_004", merchant: "Supabase", provider: "Supabase", category: cat("cloud-infra"), amount: 80, rewardRate: 0.04, rewardEarned: 3.2, date: "2026-03-01T00:00:00Z", description: "Supabase vector DB" },
31
+ // Misc personal spend
32
+ { id: "tx_022", cardId: "card_001", projectId: "proj_001", merchant: "Cursor", provider: "Cursor", category: cat("dev-tools"), amount: 20, rewardRate: 0.03, rewardEarned: 0.6, date: "2026-03-01T00:00:00Z", description: "Cursor Pro" },
33
+ { id: "tx_023", cardId: "card_001", projectId: "proj_001", merchant: "Linear", provider: "Linear", category: cat("dev-tools"), amount: 10, rewardRate: 0.03, rewardEarned: 0.3, date: "2026-03-01T00:00:00Z", description: "Linear Starter" },
34
+ ];
@@ -0,0 +1,12 @@
1
+ export interface User {
2
+ id: string;
3
+ name: string;
4
+ email: string;
5
+ avatarUrl?: string;
6
+ createdAt: string;
7
+ }
8
+ export interface AuthSession {
9
+ user: User;
10
+ token: string;
11
+ expiresAt: string;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,3 @@
1
+ import { User, AuthSession } from "./user";
2
+ export declare const mockUser: User;
3
+ export declare const mockSession: AuthSession;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockSession = exports.mockUser = void 0;
4
+ exports.mockUser = {
5
+ id: "user_001",
6
+ name: "Sarah Chen",
7
+ email: "sarah@dev.io",
8
+ avatarUrl: undefined,
9
+ createdAt: "2026-02-15T10:00:00Z",
10
+ };
11
+ exports.mockSession = {
12
+ user: exports.mockUser,
13
+ token: "mock_token_abc123xyz",
14
+ expiresAt: "2026-12-31T23:59:59Z",
15
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "codecard-cli",
3
+ "version": "0.1.0",
4
+ "description": "code_ CLI — The financial stack for AI-native builders",
5
+ "author": "Code Financial, Inc.",
6
+ "license": "MIT",
7
+ "homepage": "https://codecard.ai/docs/cli",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/rajparekh7/code_.git",
11
+ "directory": "code_-cli"
12
+ },
13
+ "keywords": ["cli", "fintech", "neobank", "ai", "developers", "mcp", "virtual-cards"],
14
+ "bin": {
15
+ "codecard": "./dist/index.js",
16
+ "codecard-mcp": "./dist/mcp-server.js"
17
+ },
18
+ "files": ["dist", "README.md", "LICENSE"],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "dev": "tsc --watch",
22
+ "start": "node dist/index.js",
23
+ "prepublishOnly": "npm run build"
24
+ },
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.29.0",
27
+ "chalk": "^4.1.2",
28
+ "cli-table3": "^0.6.5",
29
+ "commander": "^12.1.0",
30
+ "conf": "^10.2.0",
31
+ "ora": "^5.4.1",
32
+ "zod": "^4.3.6"
33
+ },
34
+ "devDependencies": {
35
+ "@types/node": "^20.0.0",
36
+ "typescript": "^5.7.0"
37
+ },
38
+ "engines": {
39
+ "node": ">=18.0.0"
40
+ }
41
+ }