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
package/dist/index.js ADDED
@@ -0,0 +1,166 @@
1
+ #!/usr/bin/env node
2
+ import { Command } from 'commander';
3
+ import chalk from 'chalk';
4
+ import { initCommand } from './commands/init.js';
5
+ import { authCommand, logoutCommand } from './commands/auth.js';
6
+ import { configCommand } from './commands/config.js';
7
+ import { projectsListCommand } from './commands/projects.js';
8
+ import { pullCommand } from './commands/pull.js';
9
+ import { debugListApiKeys, debugListOrganizations } from './commands/debug.js';
10
+ import { showLogo } from './utils/banner.js';
11
+ const program = new Command();
12
+ // Package info
13
+ const packageJson = {
14
+ name: 'langctl',
15
+ version: '0.1.0',
16
+ description: 'CLI-first translation management for developers'
17
+ };
18
+ program
19
+ .name('langctl')
20
+ .description(packageJson.description)
21
+ .version(packageJson.version, '-v, --version', 'Show version number');
22
+ // Init command
23
+ program
24
+ .command('init')
25
+ .description('Interactive setup wizard')
26
+ .action(async () => {
27
+ try {
28
+ await initCommand();
29
+ }
30
+ catch (error) {
31
+ console.error(chalk.red(`Error: ${error.message}\n`));
32
+ process.exit(1);
33
+ }
34
+ });
35
+ // Auth command
36
+ program
37
+ .command('auth <api-key>')
38
+ .description('Authenticate and save credentials')
39
+ .action(async (apiKey) => {
40
+ try {
41
+ await authCommand(apiKey);
42
+ }
43
+ catch (error) {
44
+ console.error(chalk.red(`Error: ${error.message}\n`));
45
+ process.exit(1);
46
+ }
47
+ });
48
+ // Logout command
49
+ program
50
+ .command('logout')
51
+ .description('Clear authentication credentials')
52
+ .action(async () => {
53
+ try {
54
+ await logoutCommand();
55
+ }
56
+ catch (error) {
57
+ console.error(chalk.red(`Error: ${error.message}\n`));
58
+ process.exit(1);
59
+ }
60
+ });
61
+ // Config command
62
+ program
63
+ .command('config')
64
+ .description('View current configuration')
65
+ .action(() => {
66
+ try {
67
+ configCommand();
68
+ }
69
+ catch (error) {
70
+ console.error(chalk.red(`Error: ${error.message}\n`));
71
+ process.exit(1);
72
+ }
73
+ });
74
+ // Projects command
75
+ const projects = program
76
+ .command('projects')
77
+ .description('Manage projects');
78
+ projects
79
+ .command('list')
80
+ .description('Show all accessible projects')
81
+ .action(async () => {
82
+ try {
83
+ await projectsListCommand();
84
+ }
85
+ catch (error) {
86
+ console.error(chalk.red(`Error: ${error.message}\n`));
87
+ process.exit(1);
88
+ }
89
+ });
90
+ // Pull command
91
+ program
92
+ .command('pull <project>')
93
+ .description('Pull translations from a project (all languages by default)')
94
+ .option('-l, --language <code>', 'Pull specific language only (default: all)')
95
+ .option('-f, --format <type>', 'Export format: json, json-nested, ios, android, flutter (default: json)')
96
+ .option('-d, --dir <path>', 'Output directory (default: ./translations)')
97
+ .option('-o, --output <path>', 'Specific output file path (optional)')
98
+ .option('--no-published-only', 'Include unpublished translations')
99
+ .action(async (project, options) => {
100
+ try {
101
+ await pullCommand(project, options);
102
+ }
103
+ catch (error) {
104
+ console.error(chalk.red(`Error: ${error.message}\n`));
105
+ process.exit(1);
106
+ }
107
+ });
108
+ // Debug command
109
+ const debug = program
110
+ .command('debug')
111
+ .description('Debug helpers');
112
+ debug
113
+ .command('list-api-keys')
114
+ .description('List API keys visible to current Supabase credentials')
115
+ .action(async () => {
116
+ try {
117
+ await debugListApiKeys();
118
+ }
119
+ catch (error) {
120
+ console.error(chalk.red(`Error: ${error.message}\n`));
121
+ process.exit(1);
122
+ }
123
+ });
124
+ debug
125
+ .command('list-organizations')
126
+ .description('List organizations visible to current Supabase credentials')
127
+ .action(async () => {
128
+ try {
129
+ await debugListOrganizations();
130
+ }
131
+ catch (error) {
132
+ console.error(chalk.red(`Error: ${error.message}\n`));
133
+ process.exit(1);
134
+ }
135
+ });
136
+ // Help command
137
+ program.on('--help', () => {
138
+ console.log('');
139
+ console.log('Examples:');
140
+ console.log(' $ langctl init');
141
+ console.log(' $ langctl auth lc_abc123...');
142
+ console.log(' $ langctl projects list');
143
+ console.log('');
144
+ console.log(' # Pull all languages as JSON to ./translations/i18n/');
145
+ console.log(' $ langctl pull litcode');
146
+ console.log('');
147
+ console.log(' # Pull to custom directory (e.g., ./src/i18n/)');
148
+ console.log(' $ langctl pull litcode --dir ./src/i18n');
149
+ console.log('');
150
+ console.log(' # Pull specific language');
151
+ console.log(' $ langctl pull litcode --language en');
152
+ console.log('');
153
+ console.log(' # Pull all languages in iOS format to ./ios/localization/');
154
+ console.log(' $ langctl pull litcode --format ios --dir ./ios/localization');
155
+ console.log('');
156
+ console.log('For more information, visit: https://langctl.com/docs');
157
+ console.log('');
158
+ });
159
+ // Parse arguments
160
+ program.parse(process.argv);
161
+ // Show help if no command provided
162
+ if (!process.argv.slice(2).length) {
163
+ showLogo();
164
+ program.outputHelp();
165
+ }
166
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,14 @@
1
+ import { SupabaseClient } from '@supabase/supabase-js';
2
+ /**
3
+ * Initialize Supabase client with hardcoded credentials
4
+ */
5
+ export declare function initializeSupabase(): SupabaseClient;
6
+ /**
7
+ * Get existing Supabase client or initialize it
8
+ */
9
+ export declare function getSupabase(): SupabaseClient;
10
+ /**
11
+ * Reset Supabase client (useful for tests)
12
+ */
13
+ export declare function resetSupabase(): void;
14
+ //# sourceMappingURL=supabase.d.ts.map
@@ -0,0 +1,30 @@
1
+ import { createClient } from '@supabase/supabase-js';
2
+ // Hardcoded Supabase credentials (safe for client-side use with RLS)
3
+ const SUPABASE_URL = 'https://bcgnmvkgkbhbxzzflwdb.supabase.co';
4
+ const SUPABASE_ANON_KEY = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImJjZ25tdmtna2JoYnh6emZsd2RiIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MzQ3OTE4ODEsImV4cCI6MjA1MDM2Nzg4MX0.LqZYO8GGQfI-C9WCF_a2NTKqIrO1TDsPXU9LHRE8b0E';
5
+ let supabaseClient = null;
6
+ /**
7
+ * Initialize Supabase client with hardcoded credentials
8
+ */
9
+ export function initializeSupabase() {
10
+ if (!supabaseClient) {
11
+ supabaseClient = createClient(SUPABASE_URL, SUPABASE_ANON_KEY);
12
+ }
13
+ return supabaseClient;
14
+ }
15
+ /**
16
+ * Get existing Supabase client or initialize it
17
+ */
18
+ export function getSupabase() {
19
+ if (!supabaseClient) {
20
+ return initializeSupabase();
21
+ }
22
+ return supabaseClient;
23
+ }
24
+ /**
25
+ * Reset Supabase client (useful for tests)
26
+ */
27
+ export function resetSupabase() {
28
+ supabaseClient = null;
29
+ }
30
+ //# sourceMappingURL=supabase.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Langctl ASCII Logo - Emerald Green
3
+ */
4
+ export declare function showLogo(): void;
5
+ /**
6
+ * Simple banner for quick commands
7
+ */
8
+ export declare function showBanner(title: string): void;
9
+ //# sourceMappingURL=banner.d.ts.map
@@ -0,0 +1,24 @@
1
+ import chalk from 'chalk';
2
+ /**
3
+ * Langctl ASCII Logo - Emerald Green
4
+ */
5
+ export function showLogo() {
6
+ const logo = `
7
+ ██╗ █████╗ ███╗ ██╗ ██████╗ ██████╗████████╗██╗
8
+ ██║ ██╔══██╗████╗ ██║██╔════╝ ██╔════╝╚══██╔══╝██║
9
+ ██║ ███████║██╔██╗ ██║██║ ███╗██║ ██║ ██║
10
+ ██║ ██╔══██║██║╚██╗██║██║ ██║██║ ██║ ██║
11
+ ███████╗██║ ██║██║ ╚████║╚██████╔╝╚██████╗ ██║ ███████╗
12
+ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝
13
+ `;
14
+ console.log(chalk.hex('#10b981')(logo)); // Emerald-500
15
+ console.log(chalk.gray(' CLI-first translation management for developers\n'));
16
+ }
17
+ /**
18
+ * Simple banner for quick commands
19
+ */
20
+ export function showBanner(title) {
21
+ console.log(chalk.hex('#10b981').bold(`\n${title}`));
22
+ console.log(chalk.gray('─'.repeat(title.length)));
23
+ }
24
+ //# sourceMappingURL=banner.js.map
package/package.json CHANGED
@@ -1,12 +1,17 @@
1
1
  {
2
2
  "name": "langctl",
3
- "version": "0.0.1",
3
+ "version": "0.1.1",
4
4
  "description": "CLI-first translation management for developers. Affordable, AI-powered, and built for modern workflows.",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "type": "module",
6
7
  "bin": {
7
- "langctl": "./bin/langctl.js"
8
+ "langctl": "./dist/index.js"
8
9
  },
9
10
  "scripts": {
11
+ "build": "tsc",
12
+ "dev": "tsx src/index.ts",
13
+ "start": "node dist/index.js",
14
+ "prepublishOnly": "npm run build",
10
15
  "test": "echo \"Error: no test specified\" && exit 1"
11
16
  },
12
17
  "keywords": [
@@ -33,5 +38,19 @@
33
38
  "homepage": "https://langctl.com",
34
39
  "engines": {
35
40
  "node": ">=16.0.0"
41
+ },
42
+ "dependencies": {
43
+ "@supabase/supabase-js": "^2.89.0",
44
+ "chalk": "^5.6.2",
45
+ "commander": "^14.0.2",
46
+ "conf": "^15.0.2",
47
+ "inquirer": "^13.1.0",
48
+ "ora": "^9.0.0"
49
+ },
50
+ "devDependencies": {
51
+ "@types/inquirer": "^9.0.9",
52
+ "@types/node": "^25.0.3",
53
+ "tsx": "^4.21.0",
54
+ "typescript": "^5.9.3"
36
55
  }
37
56
  }
@@ -0,0 +1,5 @@
1
+ {
2
+ "home.translation_mgmt": "Translation Management",
3
+ "home.welcome_message": "Welcome Home",
4
+ "new_item": "New Item"
5
+ }
@@ -0,0 +1,9 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- Hero text -->
4
+ <string name="home.translation_mgmt">Translation Management</string>
5
+ <!-- Homepage wlecome message -->
6
+ <string name="home.welcome_message">Welcome Home</string>
7
+ <!-- This is a new item -->
8
+ <string name="new_item">New Item</string>
9
+ </resources>
@@ -0,0 +1,4 @@
1
+ {
2
+ "home.translation_mgmt": "Gestion des traductions",
3
+ "home.welcome_message": "bienvenue à la maison"
4
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- Hero text -->
4
+ <string name="home.translation_mgmt">Gestion des traductions</string>
5
+ <!-- Homepage wlecome message -->
6
+ <string name="home.welcome_message">bienvenue à la maison</string>
7
+ </resources>
@@ -0,0 +1,4 @@
1
+ {
2
+ "home.translation_mgmt": "अनुवाद प्रबंधन",
3
+ "home.welcome_message": "घर में आपका स्वागत है"
4
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- Hero text -->
4
+ <string name="home.translation_mgmt">अनुवाद प्रबंधन</string>
5
+ <!-- Homepage wlecome message -->
6
+ <string name="home.welcome_message">घर में आपका स्वागत है</string>
7
+ </resources>
@@ -0,0 +1,9 @@
1
+ /* Hero text */
2
+ "home.translation_mgmt" = "Translation Management";
3
+
4
+ /* Homepage wlecome message */
5
+ "home.welcome_message" = "Welcome Home";
6
+
7
+ /* This is a new item */
8
+ "new_item" = "New Item";
9
+
@@ -0,0 +1,6 @@
1
+ /* Hero text */
2
+ "home.translation_mgmt" = "Gestion des traductions";
3
+
4
+ /* Homepage wlecome message */
5
+ "home.welcome_message" = "bienvenue à la maison";
6
+
@@ -0,0 +1,6 @@
1
+ /* Hero text */
2
+ "home.translation_mgmt" = "अनुवाद प्रबंधन";
3
+
4
+ /* Homepage wlecome message */
5
+ "home.welcome_message" = "घर में आपका स्वागत है";
6
+
@@ -0,0 +1,6 @@
1
+ /* Hero text */
2
+ "home.translation_mgmt" = "翻訳管理";
3
+
4
+ /* Homepage wlecome message */
5
+ "home.welcome_message" = "お家へようこそ";
6
+
@@ -0,0 +1,4 @@
1
+ {
2
+ "home.translation_mgmt": "翻訳管理",
3
+ "home.welcome_message": "お家へようこそ"
4
+ }
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <resources>
3
+ <!-- Hero text -->
4
+ <string name="home.translation_mgmt">翻訳管理</string>
5
+ <!-- Homepage wlecome message -->
6
+ <string name="home.welcome_message">お家へようこそ</string>
7
+ </resources>
package/PUBLISH_GUIDE.md DELETED
@@ -1,209 +0,0 @@
1
- # Publishing Langctl to npm
2
-
3
- ## 📦 Reserve the `langctl` Package Name
4
-
5
- ### Prerequisites
6
- - npm account (create at https://www.npmjs.com/signup)
7
- - Email verified on npm
8
- - Two-factor authentication enabled (recommended)
9
-
10
- ---
11
-
12
- ## Step-by-Step Publishing Guide
13
-
14
- ### 1. Login to npm
15
-
16
- ```bash
17
- cd /Users/siddharthsaxena/Documents/projects/langctl/langctl-cli
18
-
19
- # Login to npm
20
- npm login
21
-
22
- # Enter your credentials:
23
- # - Username
24
- # - Password
25
- # - Email
26
- # - OTP (if 2FA enabled)
27
- ```
28
-
29
- ### 2. Check if Name is Available
30
-
31
- ```bash
32
- npm search langctl
33
- ```
34
-
35
- If nothing shows up, the name is available! ✅
36
-
37
- ### 3. Test the Package Locally
38
-
39
- ```bash
40
- # Make the CLI executable
41
- chmod +x bin/langctl.js
42
- chmod +x index.js
43
-
44
- # Test it works
45
- node bin/langctl.js
46
- ```
47
-
48
- You should see the "Coming Soon" message.
49
-
50
- ### 4. Publish to npm
51
-
52
- ```bash
53
- # Publish as public package (free)
54
- npm publish --access public
55
- ```
56
-
57
- **Expected output:**
58
- ```
59
- + langctl@0.0.1
60
- ```
61
-
62
- ### 5. Verify It's Published
63
-
64
- ```bash
65
- # Search for your package
66
- npm search langctl
67
-
68
- # View package page
69
- npm view langctl
70
-
71
- # Visit on web
72
- # https://www.npmjs.com/package/langctl
73
- ```
74
-
75
- ### 6. Test Installation
76
-
77
- ```bash
78
- # Test installing globally
79
- npm install -g langctl
80
-
81
- # Run it
82
- langctl
83
-
84
- # You should see the "Coming Soon" message
85
- ```
86
-
87
- ---
88
-
89
- ## 🎉 Success!
90
-
91
- Your package is now published and the name is reserved!
92
-
93
- Anyone who tries:
94
- ```bash
95
- npm install -g langctl
96
- ```
97
-
98
- Will get your placeholder package with the "Coming Soon" message.
99
-
100
- ---
101
-
102
- ## 📈 Update Version When Ready
103
-
104
- When you build the actual CLI:
105
-
106
- ```bash
107
- # Update version
108
- npm version patch # 0.0.1 -> 0.0.2
109
- npm version minor # 0.0.1 -> 0.1.0
110
- npm version major # 0.0.1 -> 1.0.0
111
-
112
- # Publish update
113
- npm publish
114
- ```
115
-
116
- ---
117
-
118
- ## 🔐 Security Best Practices
119
-
120
- ### Enable 2FA on npm Account
121
- ```bash
122
- npm profile enable-2fa auth-and-writes
123
- ```
124
-
125
- ### Use npm Access Tokens (for CI/CD later)
126
- ```bash
127
- npm token create --read-only
128
- ```
129
-
130
- ---
131
-
132
- ## 📝 Package Details
133
-
134
- **Package Name:** `langctl`
135
- **Current Version:** `0.0.1`
136
- **Type:** Placeholder
137
- **License:** MIT
138
- **Homepage:** https://langctl.com
139
-
140
- ---
141
-
142
- ## 🚀 Next Steps
143
-
144
- 1. ✅ Publish placeholder package (reserve name)
145
- 2. 🏗️ Build actual CLI tool
146
- 3. 📦 Update package with real functionality
147
- 4. 🎯 Publish v1.0.0 when ready
148
-
149
- ---
150
-
151
- ## ⚠️ Important Notes
152
-
153
- - **Placeholder package is intentional** - This reserves the name while you build
154
- - **Users will see "Coming Soon"** - They know it's in development
155
- - **npm allows placeholders** - As long as they have valid code
156
- - **Update regularly** - Update description/readme as you build
157
-
158
- ---
159
-
160
- ## 🐛 Troubleshooting
161
-
162
- ### "Package name already taken"
163
- ```bash
164
- # Try variations:
165
- # @your-username/langctl
166
- # langctl-cli
167
- # langctl-tool
168
- ```
169
-
170
- ### "You must verify your email"
171
- 1. Check your email for npm verification link
172
- 2. Click the link
173
- 3. Try publishing again
174
-
175
- ### "You must sign in to publish"
176
- ```bash
177
- npm logout
178
- npm login
179
- npm publish --access public
180
- ```
181
-
182
- ### "Package too large"
183
- ```bash
184
- # Check package size
185
- npm pack --dry-run
186
-
187
- # Should be very small (<10KB for placeholder)
188
- ```
189
-
190
- ---
191
-
192
- ## 📧 Support
193
-
194
- Questions about npm publishing?
195
- - npm docs: https://docs.npmjs.com/
196
- - npm support: support@npmjs.com
197
- - Langctl: hello@langctl.com
198
-
199
- ---
200
-
201
- **Ready to publish? Just run:**
202
-
203
- ```bash
204
- cd /Users/siddharthsaxena/Documents/projects/langctl/langctl-cli
205
- npm login
206
- npm publish --access public
207
- ```
208
-
209
- That's it! 🚀
package/bin/langctl.js DELETED
@@ -1,19 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- console.log(`
4
- ╔══════════════════════════════════════════════════════════╗
5
- ║ ║
6
- ║ 🚧 Coming Soon 🚧 ║
7
- ║ ║
8
- ║ Langctl CLI is under development ║
9
- ║ ║
10
- ║ Translation management for developers who code ║
11
- ║ CLI-first • AI-powered • Affordable ║
12
- ║ ║
13
- ║ Learn more: https://langctl.com ║
14
- ║ Email: hello@langctl.com ║
15
- ║ ║
16
- ╚══════════════════════════════════════════════════════════╝
17
- `);
18
-
19
- process.exit(0);
package/index.js DELETED
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Langctl - CLI-first translation management for developers
5
- *
6
- * This is a placeholder package. The full CLI is under development.
7
- * Visit https://langctl.com for updates.
8
- */
9
-
10
- console.log(`
11
- ╔══════════════════════════════════════════════════════════╗
12
- ║ ║
13
- ║ 🚧 Coming Soon 🚧 ║
14
- ║ ║
15
- ║ Langctl CLI is under development ║
16
- ║ ║
17
- ║ Translation management for developers who code ║
18
- ║ CLI-first • AI-powered • Affordable ║
19
- ║ ║
20
- ║ Learn more: https://langctl.com ║
21
- ║ Email: hello@langctl.com ║
22
- ║ ║
23
- ╚══════════════════════════════════════════════════════════╝
24
- `);
25
-
26
- module.exports = {};