@countrystatecity/cli 0.1.1 → 0.1.3

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 (2) hide show
  1. package/README.md +49 -2
  2. package/package.json +16 -13
package/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # @countrystatecity/cli
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@countrystatecity/cli)](https://www.npmjs.com/package/@countrystatecity/cli)
4
+ [![CI](https://github.com/dr5hn/countrystatecity-npm/workflows/Pipeline/badge.svg)](https://github.com/dr5hn/countrystatecity-npm/actions/workflows/ci.yml)
5
+ [![npm downloads](https://img.shields.io/npm/dm/@countrystatecity/cli?label=cli)](https://www.npmjs.com/package/@countrystatecity/cli)
6
+ [![npm downloads](https://img.shields.io/npm/dw/@countrystatecity/cli?label=cli)](https://www.npmjs.com/package/@countrystatecity/cli)
7
+
3
8
  Official CLI for the [Country State City API](https://countrystatecity.in) — search, explore, and generate code from geographic data.
4
9
 
5
10
  ```bash
@@ -19,6 +24,16 @@ csc search countries
19
24
  csc get country IN
20
25
  ```
21
26
 
27
+ ## Global Flags
28
+
29
+ These flags work on every command:
30
+
31
+ | Flag | Short | Description |
32
+ |------|-------|-------------|
33
+ | `--json` | | Output raw JSON instead of formatted tables |
34
+ | `--quiet` | `-q` | Suppress all decorative output (spinners, tips) |
35
+ | `--no-footer` | | Hide the API usage footer after each command |
36
+
22
37
  ## Commands
23
38
 
24
39
  ### Authentication
@@ -27,7 +42,9 @@ csc get country IN
27
42
  csc auth login # Interactive login with API key
28
43
  csc auth login --key <KEY> # Login with key directly
29
44
  csc auth status # Check current auth status
45
+ csc auth status --json # Returns { authenticated, key, tier, daily, monthly }
30
46
  csc auth logout # Remove stored API key
47
+ csc auth logout --json # Returns { success: true }
31
48
  ```
32
49
 
33
50
  ### Search
@@ -56,9 +73,12 @@ csc search india
56
73
  # Detailed country info (timezones, coordinates, currency, etc.)
57
74
  csc get country IN
58
75
  csc get country US --json
76
+ csc get country # Interactive — prompts to pick a country (TTY only)
59
77
 
60
78
  # Detailed state info
61
79
  csc get state IN MH
80
+ csc get state IN MH --json
81
+ csc get state # Interactive — prompts for country then state (TTY only)
62
82
  ```
63
83
 
64
84
  ### Usage & Billing
@@ -66,9 +86,11 @@ csc get state IN MH
66
86
  ```bash
67
87
  # View API usage with progress bars
68
88
  csc usage
89
+ csc usage --json # Returns { plan, price, daily, monthly }
69
90
 
70
91
  # View plans and open pricing page
71
92
  csc upgrade
93
+ csc upgrade --json # Returns { plans, currentPlan }
72
94
  ```
73
95
 
74
96
  ### Code Generation
@@ -88,9 +110,9 @@ csc generate seed --entity countries --format prisma
88
110
  csc generate seed -e states -f prisma --country IN
89
111
  csc generate seed -e cities -f prisma -c IN -s MH
90
112
 
91
- # Options
113
+ # Options (apply to both dropdown and seed)
92
114
  --output <dir> # Output directory (default: current directory)
93
- --no-typescript # Generate .jsx instead of .tsx
115
+ --no-typescript # Generate .jsx instead of .tsx (dropdown only)
94
116
  ```
95
117
 
96
118
  #### Example: Generated Country Dropdown
@@ -126,6 +148,30 @@ async function main() {
126
148
  }
127
149
  ```
128
150
 
151
+ ### Interactive Explorer
152
+
153
+ ```bash
154
+ # Launch an interactive browser: pick a country, then a state, then an action
155
+ csc explore
156
+ ```
157
+
158
+ From the action menu you can:
159
+ - View all cities for the selected state
160
+ - View full country or state details
161
+ - Get the equivalent `csc generate` command to copy-paste
162
+
163
+ > Requires an interactive terminal (TTY). Use `csc search` for scripts.
164
+
165
+ ### Export
166
+
167
+ ```bash
168
+ # Open the online bulk export tool in your browser
169
+ csc export
170
+
171
+ # Get the export URL as JSON (useful for scripts)
172
+ csc export --json
173
+ ```
174
+
129
175
  ## Tiers
130
176
 
131
177
  | Feature | Community (Free) | Starter ($5/mo) | Supporter ($9/mo) | Professional ($29/mo) | Business ($79/mo) |
@@ -140,6 +186,7 @@ async function main() {
140
186
  - [API Documentation](https://countrystatecity.in/docs/)
141
187
  - [Dashboard](https://app.countrystatecity.in)
142
188
  - [Pricing](https://app.countrystatecity.in/pricing)
189
+ - [GitHub (monorepo)](https://github.com/dr5hn/countrystatecity-npm/tree/main/packages/cli)
143
190
 
144
191
  ## License
145
192
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@countrystatecity/cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Official CLI for the Country State City API - search, explore, and generate code from geographic data",
5
5
  "files": [
6
6
  "dist",
@@ -14,13 +14,6 @@
14
14
  "engines": {
15
15
  "node": ">=18"
16
16
  },
17
- "scripts": {
18
- "build": "tsup src/index.ts --format esm --dts --clean",
19
- "dev": "tsx src/index.ts",
20
- "test": "vitest",
21
- "lint": "eslint src/",
22
- "prepublishOnly": "npm run build"
23
- },
24
17
  "keywords": [
25
18
  "country",
26
19
  "state",
@@ -36,9 +29,13 @@
36
29
  ],
37
30
  "author": "dr5hn",
38
31
  "license": "MIT",
32
+ "homepage": "https://github.com/dr5hn/countrystatecity-npm/tree/main/packages/cli#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/dr5hn/countrystatecity-npm/issues"
35
+ },
39
36
  "repository": {
40
37
  "type": "git",
41
- "url": "git+https://github.com/dr5hn/countrystatecity-cli.git"
38
+ "url": "git+https://github.com/dr5hn/countrystatecity-npm.git"
42
39
  },
43
40
  "publishConfig": {
44
41
  "access": "public"
@@ -57,9 +54,15 @@
57
54
  "devDependencies": {
58
55
  "@types/node": "^22.0.0",
59
56
  "eslint": "^9.0.0",
60
- "tsup": "^8.0.0",
61
- "tsx": "^4.0.0",
57
+ "tsup": "^8.5.1",
58
+ "tsx": "~4.21.1",
62
59
  "typescript": "^5.7.0",
63
- "vitest": "^3.0.0"
60
+ "vitest": "^4.1.8"
61
+ },
62
+ "scripts": {
63
+ "build": "tsup src/index.ts --format esm --dts --clean",
64
+ "dev": "tsx src/index.ts",
65
+ "test": "vitest",
66
+ "lint": "eslint src/"
64
67
  }
65
- }
68
+ }