langctl 0.0.1 → 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.
Files changed (44) hide show
  1. package/NPM_PUBLISH_GUIDE.md +293 -0
  2. package/QUICK_PUBLISH.md +64 -0
  3. package/README.md +300 -30
  4. package/SECURITY_FIX.md +167 -0
  5. package/dist/auth.d.ts +33 -0
  6. package/dist/auth.js +106 -0
  7. package/dist/commands/auth.d.ts +3 -0
  8. package/dist/commands/auth.js +33 -0
  9. package/dist/commands/config.d.ts +2 -0
  10. package/dist/commands/config.js +30 -0
  11. package/dist/commands/debug.d.ts +3 -0
  12. package/dist/commands/debug.js +57 -0
  13. package/dist/commands/init.d.ts +2 -0
  14. package/dist/commands/init.js +87 -0
  15. package/dist/commands/projects.d.ts +2 -0
  16. package/dist/commands/projects.js +54 -0
  17. package/dist/commands/pull.d.ts +9 -0
  18. package/dist/commands/pull.js +194 -0
  19. package/dist/config.d.ts +47 -0
  20. package/dist/config.js +69 -0
  21. package/dist/exporters/index.d.ts +36 -0
  22. package/dist/exporters/index.js +214 -0
  23. package/dist/index.d.ts +3 -0
  24. package/dist/index.js +166 -0
  25. package/dist/supabase.d.ts +14 -0
  26. package/dist/supabase.js +30 -0
  27. package/dist/utils/banner.d.ts +9 -0
  28. package/dist/utils/banner.js +24 -0
  29. package/package.json +22 -3
  30. package/translations/en.json +5 -0
  31. package/translations/en.xml +9 -0
  32. package/translations/fr.json +4 -0
  33. package/translations/fr.xml +7 -0
  34. package/translations/hi.json +4 -0
  35. package/translations/hi.xml +7 -0
  36. package/translations/ios/en.strings +9 -0
  37. package/translations/ios/fr.strings +6 -0
  38. package/translations/ios/hi.strings +6 -0
  39. package/translations/ios/ja.strings +6 -0
  40. package/translations/ja.json +4 -0
  41. package/translations/ja.xml +7 -0
  42. package/PUBLISH_GUIDE.md +0 -209
  43. package/bin/langctl.js +0 -19
  44. package/index.js +0 -26
@@ -0,0 +1,293 @@
1
+ # 🚀 Publishing Langctl CLI to npm
2
+
3
+ **Date:** January 5, 2026
4
+ **Package:** langctl
5
+ **Version:** 0.1.0
6
+
7
+ ---
8
+
9
+ ## ✅ Pre-Publish Checklist
10
+
11
+ Before publishing, verify these items:
12
+
13
+ - [x] Package name available: `langctl` ✅
14
+ - [x] README.md complete with examples ✅
15
+ - [x] package.json properly configured ✅
16
+ - [x] .npmignore configured ✅
17
+ - [x] TypeScript source code ready ✅
18
+ - [x] License file present (MIT) ✅
19
+
20
+ ---
21
+
22
+ ## 📋 Step-by-Step Publishing Guide
23
+
24
+ ### Step 1: Verify npm Login
25
+
26
+ Check if you're logged into npm:
27
+
28
+ ```bash
29
+ npm whoami
30
+ ```
31
+
32
+ **If not logged in:**
33
+
34
+ ```bash
35
+ npm login
36
+ ```
37
+
38
+ Enter your credentials:
39
+ - Username
40
+ - Password
41
+ - Email
42
+ - One-time password (if 2FA enabled)
43
+
44
+ ---
45
+
46
+ ### Step 2: Final Build & Test
47
+
48
+ ```bash
49
+ cd /Users/siddharthsaxena/Documents/projects/langctl/langctl-cli
50
+
51
+ # Clean previous build
52
+ rm -rf dist/
53
+
54
+ # Fresh build
55
+ npm run build
56
+
57
+ # Verify build succeeded
58
+ ls -la dist/
59
+ ```
60
+
61
+ **Expected:** You should see `.js` and `.d.ts` files in dist/
62
+
63
+ ---
64
+
65
+ ### Step 3: Test Package Locally
66
+
67
+ Before publishing, test the package works:
68
+
69
+ ```bash
70
+ # Link package globally for testing
71
+ npm link
72
+
73
+ # Test the CLI
74
+ langctl --version
75
+ langctl --help
76
+
77
+ # If it works, unlink
78
+ npm unlink -g langctl
79
+ ```
80
+
81
+ ---
82
+
83
+ ### Step 4: Dry Run (Recommended)
84
+
85
+ See what will be published WITHOUT actually publishing:
86
+
87
+ ```bash
88
+ npm pack --dry-run
89
+ ```
90
+
91
+ This shows:
92
+ - ✅ Files that will be included
93
+ - ✅ Package size
94
+ - ✅ No errors
95
+
96
+ ---
97
+
98
+ ### Step 5: Create Package Tarball (Optional)
99
+
100
+ Create actual tarball to inspect:
101
+
102
+ ```bash
103
+ npm pack
104
+ ```
105
+
106
+ This creates: `langctl-0.1.0.tgz`
107
+
108
+ **To inspect:**
109
+ ```bash
110
+ tar -xzf langctl-0.1.0.tgz
111
+ ls -la package/
112
+ ```
113
+
114
+ **Clean up after:**
115
+ ```bash
116
+ rm langctl-0.1.0.tgz
117
+ rm -rf package/
118
+ ```
119
+
120
+ ---
121
+
122
+ ### Step 6: Publish to npm! 🚀
123
+
124
+ **First time publishing (public package):**
125
+
126
+ ```bash
127
+ npm publish --access public
128
+ ```
129
+
130
+ **Expected output:**
131
+ ```
132
+ npm notice
133
+ npm notice 📦 langctl@0.1.0
134
+ npm notice === Tarball Contents ===
135
+ npm notice 1.1kB LICENSE
136
+ npm notice 2.3kB README.md
137
+ npm notice 845B package.json
138
+ npm notice 15.2kB dist/...
139
+ npm notice === Tarball Details ===
140
+ npm notice name: langctl
141
+ npm notice version: 0.1.0
142
+ npm notice package size: XX.X kB
143
+ npm notice unpacked size: XXX.X kB
144
+ npm notice total files: XX
145
+ npm notice
146
+ + langctl@0.1.0
147
+ ```
148
+
149
+ ---
150
+
151
+ ### Step 7: Verify Publication
152
+
153
+ **Check on npm:**
154
+ 1. Visit: https://www.npmjs.com/package/langctl
155
+ 2. Verify README displays correctly
156
+ 3. Check version number
157
+
158
+ **Test installation:**
159
+ ```bash
160
+ # In a different directory
161
+ npx langctl@latest --version
162
+ ```
163
+
164
+ ---
165
+
166
+ ## 🎉 Success! Package Published
167
+
168
+ Your CLI is now available globally at:
169
+ - **npm:** https://www.npmjs.com/package/langctl
170
+ - **Install:** `npm install -g langctl`
171
+ - **Use:** `npx langctl`
172
+
173
+ ---
174
+
175
+ ## 📊 Post-Publish Tasks
176
+
177
+ ### Update Landing Page
178
+
179
+ Add npm install instructions to langctl.com:
180
+
181
+ ```bash
182
+ npm install -g langctl
183
+ ```
184
+
185
+ ### Update README (if needed)
186
+
187
+ If you notice issues, you can publish patches:
188
+
189
+ ```bash
190
+ # Fix README or other files
191
+ # Bump version
192
+ npm version patch # 0.1.0 → 0.1.1
193
+
194
+ # Rebuild and republish
195
+ npm run build
196
+ npm publish
197
+ ```
198
+
199
+ ### Monitor npm Stats
200
+
201
+ Check download stats:
202
+ - https://www.npmjs.com/package/langctl
203
+ - https://npmtrends.com/langctl
204
+
205
+ ---
206
+
207
+ ## 🔧 Troubleshooting
208
+
209
+ ### Error: "You do not have permission to publish"
210
+
211
+ **Solution:**
212
+ ```bash
213
+ npm login
214
+ npm whoami # Verify correct account
215
+ ```
216
+
217
+ ### Error: "Package name already exists"
218
+
219
+ **Solution:** The name is taken. Since you reserved it, make sure you're logged in correctly.
220
+
221
+ ### Error: "Must be logged in to publish"
222
+
223
+ **Solution:**
224
+ ```bash
225
+ npm login
226
+ ```
227
+
228
+ ### Build errors
229
+
230
+ **Solution:**
231
+ ```bash
232
+ rm -rf node_modules/ dist/
233
+ npm install
234
+ npm run build
235
+ ```
236
+
237
+ ---
238
+
239
+ ## 📈 Version Updates (Future)
240
+
241
+ **Patch (bug fixes):** 0.1.0 → 0.1.1
242
+ ```bash
243
+ npm version patch
244
+ npm run build
245
+ npm publish
246
+ ```
247
+
248
+ **Minor (new features):** 0.1.0 → 0.2.0
249
+ ```bash
250
+ npm version minor
251
+ npm run build
252
+ npm publish
253
+ ```
254
+
255
+ **Major (breaking changes):** 0.1.0 → 1.0.0
256
+ ```bash
257
+ npm version major
258
+ npm run build
259
+ npm publish
260
+ ```
261
+
262
+ ---
263
+
264
+ ## ✅ Final Checklist
265
+
266
+ Before running `npm publish`:
267
+
268
+ - [ ] Logged into npm (`npm whoami`)
269
+ - [ ] Build succeeded (`npm run build`)
270
+ - [ ] Local test passed (`npm link` + test commands)
271
+ - [ ] Dry run clean (`npm pack --dry-run`)
272
+ - [ ] Ready to publish! (`npm publish --access public`)
273
+
274
+ ---
275
+
276
+ ## 🎯 Quick Command Summary
277
+
278
+ ```bash
279
+ # From langctl-cli directory:
280
+ npm whoami # Verify login
281
+ npm run build # Build TypeScript
282
+ npm pack --dry-run # Preview package
283
+ npm publish --access public # Publish!
284
+ npx langctl@latest --version # Verify
285
+ ```
286
+
287
+ ---
288
+
289
+ **Good luck! You're about to publish your first npm package! 🚀**
290
+
291
+ **Questions? Issues?**
292
+ - npm support: https://www.npmjs.com/support
293
+ - Package page: https://www.npmjs.com/package/langctl
@@ -0,0 +1,64 @@
1
+ # 🚀 PUBLISH LANGCTL - QUICK COMMANDS
2
+
3
+ **Run these commands in order on YOUR MAC:**
4
+
5
+ ```bash
6
+ # 1. Navigate to CLI directory
7
+ cd /Users/siddharthsaxena/Documents/projects/langctl/langctl-cli
8
+
9
+ # 2. Check npm login
10
+ npm whoami
11
+
12
+ # 3. If not logged in:
13
+ npm login
14
+
15
+ # 4. Build the package
16
+ npm run build
17
+
18
+ # 5. Test locally (optional but recommended)
19
+ npm link
20
+ langctl --version
21
+ langctl --help
22
+ npm unlink -g langctl
23
+
24
+ # 6. Dry run to preview
25
+ npm pack --dry-run
26
+
27
+ # 7. PUBLISH! 🚀
28
+ npm publish --access public
29
+
30
+ # 8. Verify it worked
31
+ npx langctl@latest --version
32
+ ```
33
+
34
+ ---
35
+
36
+ ## ✅ Expected Result
37
+
38
+ After `npm publish`, you should see:
39
+
40
+ ```
41
+ + langctl@0.1.0
42
+ ```
43
+
44
+ Then check: https://www.npmjs.com/package/langctl
45
+
46
+ ---
47
+
48
+ ## 🎉 That's It!
49
+
50
+ Your CLI is now installable worldwide:
51
+
52
+ ```bash
53
+ npm install -g langctl
54
+ ```
55
+
56
+ or
57
+
58
+ ```bash
59
+ npx langctl --help
60
+ ```
61
+
62
+ ---
63
+
64
+ **Full guide:** See `NPM_PUBLISH_GUIDE.md` for detailed instructions and troubleshooting.
package/README.md CHANGED
@@ -1,57 +1,327 @@
1
- # Langctl
1
+ # Langctl CLI
2
2
 
3
3
  > CLI-first translation management for developers
4
4
 
5
- 🚧 **Coming Soon** - This package is currently in development.
5
+ Langctl is a command-line tool that lets you manage translations directly from your terminal. Pull translations in multiple formats, sync with your projects, and integrate seamlessly into your CI/CD pipeline.
6
6
 
7
- ## What is Langctl?
7
+ ## Installation
8
8
 
9
- Langctl is a modern translation management tool built for developers who want to:
10
- - Manage translations from the command line
11
- - Use AI-powered translations
12
- - Save money compared to enterprise tools
13
- - Integrate seamlessly with their development workflow
9
+ ```bash
10
+ npm install -g langctl
11
+ ```
12
+
13
+ Or use with npx:
14
+
15
+ ```bash
16
+ npx langctl --help
17
+ ```
18
+
19
+ ## Quick Start
14
20
 
15
- ## Features (Planned)
21
+ ### 1. Get Your API Key
16
22
 
17
- - 🖥️ **CLI-First** - Manage translations from your terminal
18
- - 🤖 **AI-Powered** - Context-aware translations using advanced AI
19
- - 💰 **Affordable** - Starting free, pay only for what you use
20
- - ⚡ **Fast** - Setup in under 2 minutes
21
- - 🔧 **Framework Agnostic** - Works with Angular, React, Vue, and more
23
+ Generate an API key from your Langctl dashboard:
24
+ 1. Go to **Settings → API Keys**
25
+ 2. Click **"Generate New Key"**
26
+ 3. Copy the key (shown only once)
22
27
 
23
- ## Installation (When Available)
28
+ ### 2. Authenticate
24
29
 
25
30
  ```bash
26
- npm install -g langctl
31
+ langctl init
32
+ ```
33
+
34
+ This interactive wizard will:
35
+ - Authenticate with your API key
36
+ - Set your default language preference
37
+
38
+ ### 3. List Your Projects
39
+
40
+ View all projects you have access to:
41
+
42
+ ```bash
43
+ langctl projects list
27
44
  ```
28
45
 
29
- ## Usage (When Available)
46
+ ### 4. Pull Translations
47
+
48
+ Download translations for a project:
49
+
50
+ ```bash
51
+ langctl pull <project-id> --language en --format json
52
+ ```
53
+
54
+ ---
55
+
56
+ ## Commands
57
+
58
+ ### `langctl init`
59
+
60
+ Interactive setup wizard to configure the CLI.
30
61
 
31
62
  ```bash
32
- # Initialize langctl in your project
33
63
  langctl init
64
+ ```
65
+
66
+ ### `langctl auth <api-key>`
67
+
68
+ Authenticate with an API key from the dashboard.
69
+
70
+ ```bash
71
+ langctl auth lc_abc123...
72
+ ```
73
+
74
+ ### `langctl logout`
75
+
76
+ Clear authentication credentials.
77
+
78
+ ```bash
79
+ langctl logout
80
+ ```
81
+
82
+ ### `langctl config`
83
+
84
+ View current configuration.
85
+
86
+ ```bash
87
+ langctl config
88
+ ```
89
+
90
+ ### `langctl projects list`
91
+
92
+ Show all accessible projects.
93
+
94
+ ```bash
95
+ langctl projects list
96
+ ```
97
+
98
+ ### `langctl pull <project-id>`
99
+
100
+ Pull translations from a project.
101
+
102
+ ```bash
103
+ langctl pull <project-id> [options]
104
+ ```
105
+
106
+ **Options:**
107
+
108
+ - `-l, --language <code>` - Language code to pull (default: `en`)
109
+ - `-f, --format <type>` - Export format (default: `json`)
110
+ - `json` - Flat JSON (key-value pairs)
111
+ - `json-nested` - Nested JSON (organized by key structure)
112
+ - `ios` - iOS .strings format
113
+ - `android` - Android XML format
114
+ - `flutter` - Flutter ARB format
115
+ - `-o, --output <path>` - Output file path (default: `./translations/`)
116
+ - `--no-published-only` - Include unpublished translations
117
+
118
+ **Examples:**
119
+
120
+ ```bash
121
+ # Pull English translations as JSON
122
+ langctl pull abc-123 --language en --format json
123
+
124
+ # Pull Spanish translations as iOS strings
125
+ langctl pull abc-123 --language es --format ios
126
+
127
+ # Pull all translations (including unpublished)
128
+ langctl pull abc-123 --language en --no-published-only
129
+
130
+ # Custom output path
131
+ langctl pull abc-123 --language en --output ./locales/en.json
132
+ ```
34
133
 
35
- # Scan for translation keys
36
- langctl scan
134
+ ---
135
+
136
+ ## Export Formats
137
+
138
+ ### JSON (Flat)
139
+
140
+ Simple key-value pairs with dot notation.
141
+
142
+ ```json
143
+ {
144
+ "home.welcome": "Welcome!",
145
+ "home.subtitle": "Get started with {{appName}}"
146
+ }
147
+ ```
148
+
149
+ ### JSON (Nested)
150
+
151
+ Organized by key structure.
152
+
153
+ ```json
154
+ {
155
+ "home": {
156
+ "welcome": "Welcome!",
157
+ "subtitle": "Get started with {{appName}}"
158
+ }
159
+ }
160
+ ```
161
+
162
+ ### iOS Strings
163
+
164
+ Standard iOS `.strings` format.
165
+
166
+ ```
167
+ "home.welcome" = "Welcome!";
168
+ "home.subtitle" = "Get started with %1$@";
169
+ ```
170
+
171
+ ### Android XML
172
+
173
+ Android resources XML format.
174
+
175
+ ```xml
176
+ <?xml version="1.0" encoding="utf-8"?>
177
+ <resources>
178
+ <string name="home.welcome">Welcome!</string>
179
+ <string name="home.subtitle">Get started with %1$s</string>
180
+ </resources>
181
+ ```
182
+
183
+ ### Flutter ARB
184
+
185
+ Application Resource Bundle format for Flutter.
186
+
187
+ ```json
188
+ {
189
+ "@@locale": "en",
190
+ "home.welcome": "Welcome!",
191
+ "home.subtitle": "Get started with {appName}",
192
+ "@home.subtitle": {
193
+ "placeholders": {
194
+ "appName": {
195
+ "type": "String"
196
+ }
197
+ }
198
+ }
199
+ }
200
+ ```
201
+
202
+ ---
203
+
204
+ ## CI/CD Integration
205
+
206
+ ### GitHub Actions
207
+
208
+ Example workflow for daily translation syncs:
209
+
210
+ ```yaml
211
+ name: Sync Translations
212
+
213
+ on:
214
+ schedule:
215
+ - cron: '0 0 * * *' # Daily at midnight
216
+ workflow_dispatch:
37
217
 
38
- # Translate to multiple languages
39
- langctl translate --target es,fr,de --ai
218
+ jobs:
219
+ sync:
220
+ runs-on: ubuntu-latest
221
+ steps:
222
+ - uses: actions/checkout@v3
40
223
 
41
- # Push to cloud
42
- langctl push
224
+ - name: Setup Node.js
225
+ uses: actions/setup-node@v3
226
+ with:
227
+ node-version: '18'
228
+
229
+ - name: Install Langctl
230
+ run: npm install -g langctl
231
+
232
+ - name: Authenticate
233
+ env:
234
+ LANGCTL_API_KEY: ${{ secrets.LANGCTL_API_KEY }}
235
+ run: langctl auth $LANGCTL_API_KEY
236
+
237
+ - name: Pull Translations
238
+ run: |
239
+ langctl pull ${{ secrets.PROJECT_ID }} --language en --format json
240
+ langctl pull ${{ secrets.PROJECT_ID }} --language es --format json
241
+
242
+ - name: Commit Changes
243
+ run: |
244
+ git config --global user.name "Langctl Bot"
245
+ git config --global user.email "bot@langctl.com"
246
+ git add translations/
247
+ git commit -m "chore: update translations" || echo "No changes"
248
+ git push
43
249
  ```
44
250
 
45
- ## Stay Updated
251
+ **Setup:**
252
+ 1. Add `LANGCTL_API_KEY` to your repository secrets
253
+ 2. Add `PROJECT_ID` to your repository secrets
254
+ 3. Adjust languages and format as needed
255
+
256
+ ---
257
+
258
+ ## Troubleshooting
259
+
260
+ ### "Not authenticated" error
261
+
262
+ **Solution:** Run `langctl init` or `langctl auth <api-key>` to authenticate.
263
+
264
+ ### "Project not found" error
265
+
266
+ **Possible causes:**
267
+ - Invalid project ID - verify with `langctl projects list`
268
+ - API key doesn't have access to the project
269
+ - Project belongs to different organization
270
+
271
+ ### Invalid API key format
272
+
273
+ API keys must:
274
+ - Start with `lc_`
275
+ - Be 67 characters long (including `lc_` prefix)
276
+ - Be generated from the Langctl dashboard at [langctl.com](https://langctl.com)
277
+
278
+ ### Connection issues
279
+
280
+ If you experience connectivity problems:
281
+ - Check your internet connection
282
+ - Verify you're not behind a restrictive firewall
283
+ - Try again in a few moments
46
284
 
47
- - 🌐 Website: [langctl.com](https://langctl.com)
48
- - 📧 Email: hello@langctl.com
49
- - 🐙 GitHub: [github.com/siddharthsaxena0/langctl](https://github.com/siddharthsaxena0/langctl)
285
+ ---
286
+
287
+ ## API Keys
288
+
289
+ API keys are **organization-scoped** and provide access to all projects within that organization.
290
+
291
+ **Security best practices:**
292
+ - ✅ Store API keys in environment variables or secrets managers
293
+ - ✅ Use different keys for development and production
294
+ - ✅ Rotate keys periodically
295
+ - ❌ Never commit API keys to version control
296
+ - ❌ Never share API keys publicly
297
+
298
+ **Revoke compromised keys immediately** from your dashboard.
299
+
300
+ ---
301
+
302
+ ## Platform Support
303
+
304
+ - ✅ macOS (Apple Silicon & Intel)
305
+ - ✅ Linux (x64, ARM)
306
+ - ✅ Windows (x64)
307
+ - ✅ Node.js 16.0.0+
308
+
309
+ ---
310
+
311
+ ## Links
312
+
313
+ - **Dashboard:** [app.langctl.com](https://app.langctl.com)
314
+ - **Documentation:** [langctl.com/docs](https://langctl.com/docs)
315
+ - **GitHub:** [github.com/siddharthsaxena0/langctl](https://github.com/siddharthsaxena0/langctl)
316
+ - **Issues:** [github.com/siddharthsaxena0/langctl/issues](https://github.com/siddharthsaxena0/langctl/issues)
317
+ - **Email:** [hello@langctl.com](mailto:hello@langctl.com)
318
+
319
+ ---
50
320
 
51
321
  ## License
52
322
 
53
- MIT © Langctl
323
+ MIT License - see [LICENSE](LICENSE) file for details.
54
324
 
55
325
  ---
56
326
 
57
- **Note:** This is a placeholder package to reserve the name. The actual CLI tool is under development and will be released soon.
327
+ **Made with ❤️ by the Langctl team**