@countrystatecity/cli 0.1.1

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dr5hn
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,146 @@
1
+ # @countrystatecity/cli
2
+
3
+ Official CLI for the [Country State City API](https://countrystatecity.in) — search, explore, and generate code from geographic data.
4
+
5
+ ```bash
6
+ npm install -g @countrystatecity/cli
7
+ ```
8
+
9
+ ## Quick Start
10
+
11
+ ```bash
12
+ # 1. Get your free API key at https://app.countrystatecity.in
13
+ csc auth login
14
+
15
+ # 2. Search countries
16
+ csc search countries
17
+
18
+ # 3. Get country details
19
+ csc get country IN
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ ### Authentication
25
+
26
+ ```bash
27
+ csc auth login # Interactive login with API key
28
+ csc auth login --key <KEY> # Login with key directly
29
+ csc auth status # Check current auth status
30
+ csc auth logout # Remove stored API key
31
+ ```
32
+
33
+ ### Search
34
+
35
+ ```bash
36
+ # List all countries
37
+ csc search countries
38
+ csc search countries --filter "united"
39
+ csc search countries --json
40
+
41
+ # List states for a country
42
+ csc search states --country IN
43
+ csc search states -c US --filter "new"
44
+
45
+ # List cities for a state
46
+ csc search cities --country IN --state MH
47
+ csc search cities -c US -s CA --json
48
+
49
+ # Global search (matches country names)
50
+ csc search india
51
+ ```
52
+
53
+ ### Get Details
54
+
55
+ ```bash
56
+ # Detailed country info (timezones, coordinates, currency, etc.)
57
+ csc get country IN
58
+ csc get country US --json
59
+
60
+ # Detailed state info
61
+ csc get state IN MH
62
+ ```
63
+
64
+ ### Usage & Billing
65
+
66
+ ```bash
67
+ # View API usage with progress bars
68
+ csc usage
69
+
70
+ # View plans and open pricing page
71
+ csc upgrade
72
+ ```
73
+
74
+ ### Code Generation
75
+
76
+ Generate ready-to-use components and seed files from live API data.
77
+
78
+ > Requires Supporter plan or above ($9/mo). Run `csc upgrade` to view plans.
79
+
80
+ ```bash
81
+ # Generate a React dropdown component
82
+ csc generate dropdown --entity countries --format react
83
+ csc generate dropdown -e states -f react --country IN
84
+ csc generate dropdown -e cities -f react -c IN -s MH
85
+
86
+ # Generate a Prisma seed file
87
+ csc generate seed --entity countries --format prisma
88
+ csc generate seed -e states -f prisma --country IN
89
+ csc generate seed -e cities -f prisma -c IN -s MH
90
+
91
+ # Options
92
+ --output <dir> # Output directory (default: current directory)
93
+ --no-typescript # Generate .jsx instead of .tsx
94
+ ```
95
+
96
+ #### Example: Generated Country Dropdown
97
+
98
+ ```tsx
99
+ // CountrySelect.tsx — generated by csc
100
+ import { useState } from 'react';
101
+
102
+ const countries = [
103
+ { id: 101, name: "India", iso2: "IN", phonecode: "91", emoji: "🇮🇳" },
104
+ // ... 250 countries embedded
105
+ ];
106
+
107
+ export default function CountrySelect({ value, onChange, placeholder, className, disabled }) {
108
+ // Full select component with onChange handler
109
+ }
110
+ ```
111
+
112
+ #### Example: Generated Prisma Seed
113
+
114
+ ```typescript
115
+ // seed-countries.ts — generated by csc
116
+ import { PrismaClient } from '@prisma/client';
117
+ const prisma = new PrismaClient();
118
+
119
+ const countries = [
120
+ { name: "India", iso2: "IN", iso3: "IND", phonecode: "91", capital: "New Delhi", currency: "INR" },
121
+ // ... 250 countries
122
+ ];
123
+
124
+ async function main() {
125
+ await prisma.country.createMany({ data: countries, skipDuplicates: true });
126
+ }
127
+ ```
128
+
129
+ ## Tiers
130
+
131
+ | Feature | Community (Free) | Starter ($5/mo) | Supporter ($9/mo) | Professional ($29/mo) | Business ($79/mo) |
132
+ |---------|------------------|-----------------|-------------------|----------------------|-------------------|
133
+ | Search & Get | Yes | Yes | Yes | Yes | Yes |
134
+ | Daily requests | 100 | 300 | 1,000 | 3,300 | 25,000 |
135
+ | Monthly requests | 3,000 | 9,000 | 30,000 | 100,000 | 750,000 |
136
+ | Code generation | No | No | Yes | Yes | Yes |
137
+
138
+ ## Links
139
+
140
+ - [API Documentation](https://countrystatecity.in/docs/)
141
+ - [Dashboard](https://app.countrystatecity.in)
142
+ - [Pricing](https://app.countrystatecity.in/pricing)
143
+
144
+ ## License
145
+
146
+ MIT
@@ -0,0 +1 @@
1
+ #!/usr/bin/env node