@babelize/cli 1.0.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 (179) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +137 -0
  3. package/dist/client.d.ts +6 -0
  4. package/dist/client.d.ts.map +1 -0
  5. package/dist/client.js +137 -0
  6. package/dist/client.js.map +1 -0
  7. package/dist/commands/account.d.ts +3 -0
  8. package/dist/commands/account.d.ts.map +1 -0
  9. package/dist/commands/account.js +133 -0
  10. package/dist/commands/account.js.map +1 -0
  11. package/dist/commands/admin.d.ts +3 -0
  12. package/dist/commands/admin.d.ts.map +1 -0
  13. package/dist/commands/admin.js +233 -0
  14. package/dist/commands/admin.js.map +1 -0
  15. package/dist/commands/analytics.d.ts +3 -0
  16. package/dist/commands/analytics.d.ts.map +1 -0
  17. package/dist/commands/analytics.js +122 -0
  18. package/dist/commands/analytics.js.map +1 -0
  19. package/dist/commands/api-keys.d.ts +3 -0
  20. package/dist/commands/api-keys.d.ts.map +1 -0
  21. package/dist/commands/api-keys.js +240 -0
  22. package/dist/commands/api-keys.js.map +1 -0
  23. package/dist/commands/auth.d.ts +3 -0
  24. package/dist/commands/auth.d.ts.map +1 -0
  25. package/dist/commands/auth.js +384 -0
  26. package/dist/commands/auth.js.map +1 -0
  27. package/dist/commands/babels.d.ts +3 -0
  28. package/dist/commands/babels.d.ts.map +1 -0
  29. package/dist/commands/babels.js +119 -0
  30. package/dist/commands/babels.js.map +1 -0
  31. package/dist/commands/billing.d.ts +3 -0
  32. package/dist/commands/billing.d.ts.map +1 -0
  33. package/dist/commands/billing.js +125 -0
  34. package/dist/commands/billing.js.map +1 -0
  35. package/dist/commands/checkout.d.ts +3 -0
  36. package/dist/commands/checkout.d.ts.map +1 -0
  37. package/dist/commands/checkout.js +64 -0
  38. package/dist/commands/checkout.js.map +1 -0
  39. package/dist/commands/comments.d.ts +3 -0
  40. package/dist/commands/comments.d.ts.map +1 -0
  41. package/dist/commands/comments.js +219 -0
  42. package/dist/commands/comments.js.map +1 -0
  43. package/dist/commands/glossary.d.ts +3 -0
  44. package/dist/commands/glossary.d.ts.map +1 -0
  45. package/dist/commands/glossary.js +189 -0
  46. package/dist/commands/glossary.js.map +1 -0
  47. package/dist/commands/init.d.ts +3 -0
  48. package/dist/commands/init.d.ts.map +1 -0
  49. package/dist/commands/init.js +210 -0
  50. package/dist/commands/init.js.map +1 -0
  51. package/dist/commands/invitations.d.ts +3 -0
  52. package/dist/commands/invitations.d.ts.map +1 -0
  53. package/dist/commands/invitations.js +177 -0
  54. package/dist/commands/invitations.js.map +1 -0
  55. package/dist/commands/languages.d.ts +3 -0
  56. package/dist/commands/languages.d.ts.map +1 -0
  57. package/dist/commands/languages.js +128 -0
  58. package/dist/commands/languages.js.map +1 -0
  59. package/dist/commands/members.d.ts +3 -0
  60. package/dist/commands/members.d.ts.map +1 -0
  61. package/dist/commands/members.js +156 -0
  62. package/dist/commands/members.js.map +1 -0
  63. package/dist/commands/notifications.d.ts +3 -0
  64. package/dist/commands/notifications.d.ts.map +1 -0
  65. package/dist/commands/notifications.js +114 -0
  66. package/dist/commands/notifications.js.map +1 -0
  67. package/dist/commands/pr.d.ts +3 -0
  68. package/dist/commands/pr.d.ts.map +1 -0
  69. package/dist/commands/pr.js +111 -0
  70. package/dist/commands/pr.js.map +1 -0
  71. package/dist/commands/privacy.d.ts +3 -0
  72. package/dist/commands/privacy.d.ts.map +1 -0
  73. package/dist/commands/privacy.js +62 -0
  74. package/dist/commands/privacy.js.map +1 -0
  75. package/dist/commands/projects.d.ts +3 -0
  76. package/dist/commands/projects.d.ts.map +1 -0
  77. package/dist/commands/projects.js +444 -0
  78. package/dist/commands/projects.js.map +1 -0
  79. package/dist/commands/roles.d.ts +3 -0
  80. package/dist/commands/roles.d.ts.map +1 -0
  81. package/dist/commands/roles.js +78 -0
  82. package/dist/commands/roles.js.map +1 -0
  83. package/dist/commands/run.d.ts +3 -0
  84. package/dist/commands/run.d.ts.map +1 -0
  85. package/dist/commands/run.js +345 -0
  86. package/dist/commands/run.js.map +1 -0
  87. package/dist/commands/status.d.ts +3 -0
  88. package/dist/commands/status.d.ts.map +1 -0
  89. package/dist/commands/status.js +126 -0
  90. package/dist/commands/status.js.map +1 -0
  91. package/dist/commands/subscriptions.d.ts +3 -0
  92. package/dist/commands/subscriptions.d.ts.map +1 -0
  93. package/dist/commands/subscriptions.js +141 -0
  94. package/dist/commands/subscriptions.js.map +1 -0
  95. package/dist/commands/tm.d.ts +3 -0
  96. package/dist/commands/tm.d.ts.map +1 -0
  97. package/dist/commands/tm.js +114 -0
  98. package/dist/commands/tm.js.map +1 -0
  99. package/dist/commands/users.d.ts +3 -0
  100. package/dist/commands/users.d.ts.map +1 -0
  101. package/dist/commands/users.js +122 -0
  102. package/dist/commands/users.js.map +1 -0
  103. package/dist/completion.d.ts +4 -0
  104. package/dist/completion.d.ts.map +1 -0
  105. package/dist/completion.js +135 -0
  106. package/dist/completion.js.map +1 -0
  107. package/dist/config.d.ts +25 -0
  108. package/dist/config.d.ts.map +1 -0
  109. package/dist/config.js +47 -0
  110. package/dist/config.js.map +1 -0
  111. package/dist/exit-codes.d.ts +11 -0
  112. package/dist/exit-codes.d.ts.map +1 -0
  113. package/dist/exit-codes.js +11 -0
  114. package/dist/exit-codes.js.map +1 -0
  115. package/dist/formatters.d.ts +3 -0
  116. package/dist/formatters.d.ts.map +1 -0
  117. package/dist/formatters.js +5 -0
  118. package/dist/formatters.js.map +1 -0
  119. package/dist/global-options.d.ts +9 -0
  120. package/dist/global-options.d.ts.map +1 -0
  121. package/dist/global-options.js +15 -0
  122. package/dist/global-options.js.map +1 -0
  123. package/dist/index.d.ts +3 -0
  124. package/dist/index.d.ts.map +1 -0
  125. package/dist/index.js +5 -0
  126. package/dist/index.js.map +1 -0
  127. package/dist/oauth.d.ts +13 -0
  128. package/dist/oauth.d.ts.map +1 -0
  129. package/dist/oauth.js +187 -0
  130. package/dist/oauth.js.map +1 -0
  131. package/dist/program.d.ts +7 -0
  132. package/dist/program.d.ts.map +1 -0
  133. package/dist/program.js +165 -0
  134. package/dist/program.js.map +1 -0
  135. package/dist/tui/brand.d.ts +3 -0
  136. package/dist/tui/brand.d.ts.map +1 -0
  137. package/dist/tui/brand.js +14 -0
  138. package/dist/tui/brand.js.map +1 -0
  139. package/dist/tui/display.d.ts +19 -0
  140. package/dist/tui/display.d.ts.map +1 -0
  141. package/dist/tui/display.js +57 -0
  142. package/dist/tui/display.js.map +1 -0
  143. package/dist/tui/help.d.ts +27 -0
  144. package/dist/tui/help.d.ts.map +1 -0
  145. package/dist/tui/help.js +84 -0
  146. package/dist/tui/help.js.map +1 -0
  147. package/dist/tui/home.d.ts +15 -0
  148. package/dist/tui/home.d.ts.map +1 -0
  149. package/dist/tui/home.js +130 -0
  150. package/dist/tui/home.js.map +1 -0
  151. package/dist/tui/index.d.ts +11 -0
  152. package/dist/tui/index.d.ts.map +1 -0
  153. package/dist/tui/index.js +11 -0
  154. package/dist/tui/index.js.map +1 -0
  155. package/dist/tui/prompt.d.ts +15 -0
  156. package/dist/tui/prompt.d.ts.map +1 -0
  157. package/dist/tui/prompt.js +45 -0
  158. package/dist/tui/prompt.js.map +1 -0
  159. package/dist/tui/repl.d.ts +23 -0
  160. package/dist/tui/repl.d.ts.map +1 -0
  161. package/dist/tui/repl.js +265 -0
  162. package/dist/tui/repl.js.map +1 -0
  163. package/dist/tui/table.d.ts +16 -0
  164. package/dist/tui/table.d.ts.map +1 -0
  165. package/dist/tui/table.js +68 -0
  166. package/dist/tui/table.js.map +1 -0
  167. package/dist/tui/task-list.d.ts +20 -0
  168. package/dist/tui/task-list.d.ts.map +1 -0
  169. package/dist/tui/task-list.js +31 -0
  170. package/dist/tui/task-list.js.map +1 -0
  171. package/dist/tui/theme.d.ts +26 -0
  172. package/dist/tui/theme.d.ts.map +1 -0
  173. package/dist/tui/theme.js +54 -0
  174. package/dist/tui/theme.js.map +1 -0
  175. package/dist/update-notifier.d.ts +2 -0
  176. package/dist/update-notifier.d.ts.map +1 -0
  177. package/dist/update-notifier.js +28 -0
  178. package/dist/update-notifier.js.map +1 -0
  179. package/package.json +61 -0
@@ -0,0 +1,13 @@
1
+ export interface OAuthResult {
2
+ accessToken: string;
3
+ refreshToken?: string;
4
+ userId: string;
5
+ email: string;
6
+ }
7
+ /**
8
+ * Performs a browser-based OAuth flow for the CLI.
9
+ * Starts a local HTTP server, opens the browser to the backend authorizer,
10
+ * and waits for the tokens to be redirected back to the local server.
11
+ */
12
+ export declare function performOAuthFlow(apiUrlBase: string, provider: 'github' | 'google' | 'gitlab'): Promise<OAuthResult>;
13
+ //# sourceMappingURL=oauth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.d.ts","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAqCA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,CAAC,WAAW,CAAC,CA6EzH"}
package/dist/oauth.js ADDED
@@ -0,0 +1,187 @@
1
+ import http from 'http';
2
+ import open from 'open';
3
+ import chalk from 'chalk';
4
+ import * as clack from '@clack/prompts';
5
+ import { muted } from './tui/theme.js';
6
+ /**
7
+ * Parse URL-encoded form body from an IncomingMessage.
8
+ */
9
+ function parseFormBody(req) {
10
+ return new Promise((resolve, reject) => {
11
+ const chunks = [];
12
+ req.on('data', (chunk) => chunks.push(chunk));
13
+ req.on('end', () => {
14
+ const raw = Buffer.concat(chunks).toString('utf-8');
15
+ const contentType = req.headers['content-type'] || '';
16
+ if (contentType.includes('application/x-www-form-urlencoded')) {
17
+ resolve(new URLSearchParams(raw));
18
+ }
19
+ else {
20
+ // Fallback: try parsing as JSON, then as query-string
21
+ try {
22
+ const json = JSON.parse(raw);
23
+ const params = new URLSearchParams();
24
+ for (const [k, v] of Object.entries(json)) {
25
+ if (typeof v === 'string')
26
+ params.set(k, v);
27
+ }
28
+ resolve(params);
29
+ }
30
+ catch {
31
+ resolve(new URLSearchParams(raw));
32
+ }
33
+ }
34
+ });
35
+ req.on('error', reject);
36
+ });
37
+ }
38
+ /**
39
+ * Performs a browser-based OAuth flow for the CLI.
40
+ * Starts a local HTTP server, opens the browser to the backend authorizer,
41
+ * and waits for the tokens to be redirected back to the local server.
42
+ */
43
+ export async function performOAuthFlow(apiUrlBase, provider) {
44
+ return new Promise((resolve, reject) => {
45
+ // 1. Create a temporary server to receive the callback from the backend
46
+ const server = http.createServer(async (req, res) => {
47
+ const url = new URL(req.url || '', `http://${req.headers.host}`);
48
+ if (url.pathname === '/callback') {
49
+ // Support both GET (error params) and POST (token body — secure)
50
+ const params = req.method === 'POST' ? await parseFormBody(req) : url.searchParams;
51
+ const error = params.get('error');
52
+ if (error) {
53
+ res.writeHead(400, { 'Content-Type': 'text/html' });
54
+ res.end(renderErrorPage(error));
55
+ server.close();
56
+ reject(new Error(error));
57
+ return;
58
+ }
59
+ const accessToken = params.get('access_token');
60
+ const refreshToken = params.get('refresh_token') || undefined;
61
+ const userId = params.get('user_id');
62
+ const email = params.get('email');
63
+ if (accessToken && userId && email) {
64
+ res.writeHead(200, { 'Content-Type': 'text/html' });
65
+ res.end(renderSuccessPage(email));
66
+ server.close();
67
+ resolve({ accessToken, refreshToken, userId, email });
68
+ }
69
+ else {
70
+ const missing = [];
71
+ if (!accessToken)
72
+ missing.push('access_token');
73
+ if (!userId)
74
+ missing.push('user_id');
75
+ if (!email)
76
+ missing.push('email');
77
+ res.writeHead(400, { 'Content-Type': 'text/html' });
78
+ res.end(renderErrorPage(`Missing tokens: ${missing.join(', ')}`));
79
+ server.close();
80
+ reject(new Error(`Missing tokens in callback: ${missing.join(', ')}`));
81
+ }
82
+ }
83
+ else {
84
+ res.writeHead(404);
85
+ res.end();
86
+ }
87
+ });
88
+ // 2. Listen on a random available port
89
+ server.listen(0, '0.0.0.0', async () => {
90
+ const port = server.address().port;
91
+ const spinner = clack.spinner();
92
+ spinner.start(`Opening browser for ${chalk.bold(provider)} login…`);
93
+ try {
94
+ // 3. Construct the backend authorization URL
95
+ // We trim trailing slash if present to avoid //auth
96
+ const baseUrl = apiUrlBase.endsWith('/') ? apiUrlBase.slice(0, -1) : apiUrlBase;
97
+ const authorizeUrl = `${baseUrl}/auth/cli/authorize/${provider}?port=${port}`;
98
+ const opened = await open(authorizeUrl).then(() => true).catch(() => false);
99
+ if (opened) {
100
+ spinner.stop(muted(`Waiting for authentication...\nIf the browser didn't open, visit: ${authorizeUrl}`));
101
+ }
102
+ else {
103
+ spinner.stop(muted(`Open this URL to authenticate:\n${authorizeUrl}`));
104
+ }
105
+ }
106
+ catch (err) {
107
+ spinner.stop('Failed to open browser.');
108
+ server.close();
109
+ reject(err);
110
+ }
111
+ });
112
+ server.on('error', (err) => {
113
+ reject(err);
114
+ });
115
+ });
116
+ }
117
+ function renderSuccessPage(email) {
118
+ return `<!DOCTYPE html>
119
+ <html>
120
+ <head><title>Babelize CLI - Success</title>
121
+ <meta name="viewport" content="width=device-width, initial-scale=1">
122
+ <style>
123
+ body{margin:0;background:#000;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh}
124
+ .wrapper{text-align:center;max-width:440px;width:90%;animation:fadeIn .5s ease-out}
125
+ .logo-area{margin-bottom:40px;display:flex;align-items:center;justify-content:center;gap:12px}
126
+ .logo-area span{font-size:24px;font-weight:700;letter-spacing:-.5px}
127
+ .card{background:#0a0a0a;border:1px solid #1a1a1a;padding:48px 32px;border-radius:16px;box-shadow:0 24px 48px rgba(0,0,0,.5)}
128
+ h1{font-size:24px;font-weight:600;margin-bottom:12px;color:#fff}
129
+ p{color:#666;font-size:14px;margin-bottom:32px}
130
+ .badge{background:#111;color:#10b981;padding:16px;border-radius:8px;display:flex;align-items:center;justify-content:center;gap:8px;font-weight:600}
131
+ .note{margin-top:32px;color:#666;font-size:13px}
132
+ .footer{margin-top:40px;color:#444;font-size:12px;letter-spacing:.5px;text-transform:uppercase}
133
+ @keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
134
+ </style></head>
135
+ <body>
136
+ <div class="wrapper">
137
+ <div class="logo-area">
138
+ <img src="https://babelize.co/dark_logo.svg" alt="" width="32" height="32">
139
+ <span>Babelize</span>
140
+ </div>
141
+ <div class="card">
142
+ <h1>Welcome back</h1>
143
+ <p>Logged in as <strong>${email.replace(/</g, '&lt;')}</strong></p>
144
+ <div class="badge">
145
+ <svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"></polyline></svg>
146
+ Authentication Successful
147
+ </div>
148
+ <p class="note">You can now close this tab and return to your terminal.</p>
149
+ </div>
150
+ <p class="footer">Automated i18n for modern web projects</p>
151
+ </div>
152
+ </body>
153
+ </html>`;
154
+ }
155
+ function renderErrorPage(error) {
156
+ const safe = error.replace(/</g, '&lt;');
157
+ return `<!DOCTYPE html>
158
+ <html>
159
+ <head><title>Babelize CLI - Authentication Error</title>
160
+ <meta name="viewport" content="width=device-width, initial-scale=1">
161
+ <style>
162
+ body{margin:0;background:#000;color:#fff;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;display:flex;align-items:center;justify-content:center;height:100vh}
163
+ .wrapper{text-align:center;max-width:440px;width:90%;animation:fadeIn .5s ease-out}
164
+ .logo-area{margin-bottom:40px;display:flex;align-items:center;justify-content:center;gap:12px}
165
+ .logo-area span{font-size:24px;font-weight:700;letter-spacing:-.5px}
166
+ .card{background:#0a0a0a;border:1px solid #1a1a1a;padding:48px 32px;border-radius:16px;box-shadow:0 24px 48px rgba(0,0,0,.5)}
167
+ h1{color:#ef4444;font-size:24px;font-weight:600;margin-bottom:12px}
168
+ p{color:#666;font-size:14px;margin-bottom:32px}
169
+ .note{color:#444;font-size:13px}
170
+ @keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
171
+ </style></head>
172
+ <body>
173
+ <div class="wrapper">
174
+ <div class="logo-area">
175
+ <img src="https://babelize.co/dark_logo.svg" alt="" width="32" height="32">
176
+ <span>Babelize</span>
177
+ </div>
178
+ <div class="card">
179
+ <h1>Authentication Failed</h1>
180
+ <p>${safe}</p>
181
+ <p class="note">You can close this window and try the login command again.</p>
182
+ </div>
183
+ </div>
184
+ </body>
185
+ </html>`;
186
+ }
187
+ //# sourceMappingURL=oauth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oauth.js","sourceRoot":"","sources":["../src/oauth.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,KAAK,MAAM,gBAAgB,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAEvC;;GAEG;AACH,SAAS,aAAa,CAAC,GAAyB;IAC9C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,MAAM,GAAa,EAAE,CAAC;QAC5B,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,CAAC,KAAa,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;QACtD,GAAG,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACjB,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;YACpD,MAAM,WAAW,GAAG,G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 +1,7 @@
1
+ export declare class Program {
2
+ private cli;
3
+ constructor();
4
+ private setup;
5
+ run(): void;
6
+ }
7
+ //# sourceMappingURL=program.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.d.ts","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AA2EA,qBAAa,OAAO;IAClB,OAAO,CAAC,GAAG,CAAU;;IAOrB,OAAO,CAAC,KAAK;IA+Db,GAAG;CA6BJ"}
@@ -0,0 +1,165 @@
1
+ import { Command } from 'commander';
2
+ import chalk from 'chalk';
3
+ import { brand, muted, renderHelp } from './tui/index.js';
4
+ import { Repl } from './tui/repl.js';
5
+ import { config } from './config.js';
6
+ import { setGlobalOptions } from './client.js';
7
+ import { ExitCode } from './exit-codes.js';
8
+ import { registerAuthCommands } from './commands/auth.js';
9
+ import { registerProjectCommands } from './commands/projects.js';
10
+ import { registerBabelCommands } from './commands/babels.js';
11
+ import { registerRunCommands } from './commands/run.js';
12
+ import { registerPrCommands } from './commands/pr.js';
13
+ import { registerBillingCommands } from './commands/billing.js';
14
+ import { registerSubscriptionCommands } from './commands/subscriptions.js';
15
+ import { registerLanguageCommands } from './commands/languages.js';
16
+ import { registerMemberCommands } from './commands/members.js';
17
+ import { registerTmCommands } from './commands/tm.js';
18
+ import { registerNotificationCommands } from './commands/notifications.js';
19
+ import { registerCommentCommands } from './commands/comments.js';
20
+ import { registerAnalyticsCommands } from './commands/analytics.js';
21
+ import { registerAccountCommands } from './commands/account.js';
22
+ import { registerPrivacyCommands } from './commands/privacy.js';
23
+ import { registerAdminCommands } from './commands/admin.js';
24
+ import { registerInvitationCommands } from './commands/invitations.js';
25
+ import { registerRoleCommands } from './commands/roles.js';
26
+ import { registerStatusCommands } from './commands/status.js';
27
+ import { registerCheckoutCommands } from './commands/checkout.js';
28
+ import { registerUserCommands } from './commands/users.js';
29
+ import { registerInitCommand } from './commands/init.js';
30
+ import { registerGlossaryCommands } from './commands/glossary.js';
31
+ import { registerApiKeyCommands } from './commands/api-keys.js';
32
+ import { registerCompletionCommand } from './completion.js';
33
+ import { checkForUpdate } from './update-notifier.js';
34
+ import pkg from '../package.json' with { type: 'json' };
35
+ const VERSION = pkg.version;
36
+ const HELP_SECTIONS = [
37
+ {
38
+ title: 'GETTING STARTED',
39
+ items: [
40
+ { cmd: 'init', desc: 'Initialize a new Babelize project', example: 'babelize init' },
41
+ { cmd: 'auth login', desc: 'Log in to your Babelize account', example: 'babelize auth login' },
42
+ { cmd: 'auth signup', desc: 'Create a new account', example: 'babelize auth signup' },
43
+ ],
44
+ },
45
+ {
46
+ title: 'CORE COMMANDS',
47
+ items: [
48
+ { cmd: 'run start', desc: 'Start a translation pipeline run', example: 'babelize run start' },
49
+ { cmd: 'run status', desc: 'Check run status', example: 'babelize run status <id>' },
50
+ { cmd: 'projects list', desc: 'List your projects', example: 'babelize projects list' },
51
+ { cmd: 'status', desc: 'Check API health', example: 'babelize status' },
52
+ ],
53
+ },
54
+ {
55
+ title: 'MANAGEMENT',
56
+ items: [
57
+ { cmd: 'languages', desc: 'Manage project languages' },
58
+ { cmd: 'members', desc: 'Manage project team members' },
59
+ { cmd: 'babels', desc: 'View translation job history' },
60
+ { cmd: 'billing', desc: 'View plans, usage & invoices' },
61
+ ],
62
+ },
63
+ {
64
+ title: 'ADVANCED',
65
+ items: [
66
+ { cmd: 'pr', desc: 'GitHub PR integration' },
67
+ { cmd: 'admin', desc: 'Admin operations (owner only)' },
68
+ { cmd: 'account', desc: 'Account settings & MFA' },
69
+ { cmd: 'notifications', desc: 'Manage notifications' },
70
+ ],
71
+ },
72
+ ];
73
+ export class Program {
74
+ cli;
75
+ constructor() {
76
+ this.cli = new Command();
77
+ this.setup();
78
+ }
79
+ setup() {
80
+ this.cli
81
+ .name('babelize')
82
+ .description(`${brand('Babelize')} ${muted('— AI-powered i18n platform CLI')}`)
83
+ .version(VERSION, '-V, --version', 'Output the current version')
84
+ .option('--api-url <url>', 'Override API URL (auto-detected: localhost in dev, api.babelize.co in prod; or set BABELIZE_API_URL env var)')
85
+ .option('--token <token>', 'Use an explicit auth token (overrides stored credentials)')
86
+ .option('--json', 'Output raw JSON (machine-readable)')
87
+ .option('-v, --verbose', 'Show verbose request/response details')
88
+ .option('--no-color', 'Disable colored output')
89
+ .showHelpAfterError(false);
90
+ this.cli.helpInformation = () => renderHelp(HELP_SECTIONS);
91
+ const helpCmd = this.cli.command('help');
92
+ helpCmd.description('Show command reference').action(() => {
93
+ console.log(renderHelp(HELP_SECTIONS));
94
+ });
95
+ this.cli.hook('preAction', (thisCommand) => {
96
+ const opts = thisCommand.opts();
97
+ setGlobalOptions({
98
+ apiUrl: opts.apiUrl,
99
+ token: opts.token,
100
+ verbose: opts.verbose,
101
+ json: opts.json,
102
+ });
103
+ if (opts.color === false || process.env.NO_COLOR) {
104
+ chalk.level = 0;
105
+ }
106
+ });
107
+ registerInitCommand(this.cli);
108
+ registerAuthCommands(this.cli);
109
+ registerStatusCommands(this.cli);
110
+ registerProjectCommands(this.cli);
111
+ registerBabelCommands(this.cli);
112
+ registerRunCommands(this.cli);
113
+ registerPrCommands(this.cli);
114
+ registerBillingCommands(this.cli);
115
+ registerSubscriptionCommands(this.cli);
116
+ registerCheckoutCommands(this.cli);
117
+ registerLanguageCommands(this.cli);
118
+ registerMemberCommands(this.cli);
119
+ registerTmCommands(this.cli);
120
+ registerNotificationCommands(this.cli);
121
+ registerCommentCommands(this.cli);
122
+ registerAnalyticsCommands(this.cli);
123
+ registerAccountCommands(this.cli);
124
+ registerPrivacyCommands(this.cli);
125
+ registerAdminCommands(this.cli);
126
+ registerInvitationCommands(this.cli);
127
+ registerRoleCommands(this.cli);
128
+ registerUserCommands(this.cli);
129
+ registerGlossaryCommands(this.cli);
130
+ registerApiKeyCommands(this.cli);
131
+ registerCompletionCommand(this.cli);
132
+ this.cli.exitOverride();
133
+ checkForUpdate();
134
+ }
135
+ run() {
136
+ // Bare `babelize` — enter interactive REPL
137
+ if (process.argv.length === 2) {
138
+ const projectConfig = config.getLocalProjectConfig();
139
+ const project = projectConfig
140
+ ? { name: projectConfig.name, languageCount: projectConfig.targetLanguageIds.length }
141
+ : undefined;
142
+ const isLoggedIn = !!config.getCredentials();
143
+ const repl = new Repl(project, [], isLoggedIn);
144
+ repl.start().catch(() => process.exit(ExitCode.SUCCESS));
145
+ return;
146
+ }
147
+ try {
148
+ this.cli.parse(process.argv);
149
+ const opts = this.cli.opts();
150
+ setGlobalOptions({
151
+ apiUrl: opts.apiUrl,
152
+ token: opts.token,
153
+ verbose: opts.verbose,
154
+ json: opts.json,
155
+ });
156
+ }
157
+ catch (err) {
158
+ const cmdErr = err;
159
+ if (cmdErr.code !== 'commander.helpDisplayed' && cmdErr.code !== 'commander.version') {
160
+ process.exit(ExitCode.INTERNAL);
161
+ }
162
+ }
163
+ }
164
+ }
165
+ //# sourceMappingURL=program.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,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;YAC7B,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAC7B,gBAAgB,CAAC;gBACf,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,IAAI,EAAE,IAAI,CAAC,IAAI;aAChB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,MAAM,GAAG,GAAwB,CAAC;YACxC,IAAI,MAAM,CAAC,IAAI,KAAK,yBAAyB,IAAI,MAAM,CAAC,IAAI,KAAK,mBAAmB,EAAE,CAAC;gBACrF,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,3 @@
1
+ export declare const BANNER_LINES: string[];
2
+ export declare function renderLogo(): string;
3
+ //# sourceMappingURL=brand.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.d.ts","sourceRoot":"","sources":["../../src/tui/brand.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY,UAOxB,CAAC;AAEF,wBAAgB,UAAU,IAAI,MAAM,CAGnC"}
@@ -0,0 +1,14 @@
1
+ import { brand, muted } from './theme.js';
2
+ export const BANNER_LINES = [
3
+ ' ██████╗ █████╗ ██████╗ ███████╗██╗ ██╗███████╗███████╗',
4
+ ' ██╔══██╗██╔══██╗██╔══██╗██╔════╝██║ ██║╚══███╔╝██╔════╝',
5
+ ' ██████╔╝███████║██████╔╝█████╗ ██║ ██║ ███╔╝ █████╗ ',
6
+ ' ██╔══██╗██╔══██║██╔══██╗██╔══╝ ██║ ██║ ███╔╝ ██╔══╝ ',
7
+ ' ██████╔╝██║ ██║██████╔╝███████╗███████╗██║███████╗███████╗',
8
+ ' ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚══════╝╚═╝╚══════╝╚══════╝',
9
+ ];
10
+ export function renderLogo() {
11
+ const art = BANNER_LINES.map((line) => `${brand(line)}`).join('\n');
12
+ return `${art}\n${muted(`AI localization Infrastructure`)}`;
13
+ }
14
+ //# sourceMappingURL=brand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand.js","sourceRoot":"","sources":["../../src/tui/brand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAE1C,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;IAC9D,8DAA8D;CAC/D,CAAC;AAEF,MAAM,UAAU,UAAU;IACxB,MAAM,GAAG,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACpE,OAAO,GAAG,GAAG,KAAK,KAAK,CAAC,gCAAgC,CAAC,EAAE,CAAC;AAC9D,CAAC"}
@@ -0,0 +1,19 @@
1
+ export declare function section(title: string): void;
2
+ export declare function label(key: string, value: string, colWidth?: number): void;
3
+ export declare function text(content: string): void;
4
+ export declare function dim(content: string): void;
5
+ export declare function success(content: string): void;
6
+ export declare function error(content: string): void;
7
+ export declare function warning(content: string): void;
8
+ export declare function bulletList(items: {
9
+ label: string;
10
+ hint?: string;
11
+ color?: (s: string) => string;
12
+ }[]): void;
13
+ export declare function box(content: string, opts?: {
14
+ title?: string;
15
+ padding?: number;
16
+ }): void;
17
+ export declare function divider(char?: "─"): void;
18
+ export declare function details(data: Record<string, string>, title?: string): void;
19
+ //# sourceMappingURL=display.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/tui/display.ts"],"names":[],"mappings":"AAGA,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,SAAK,GAAG,IAAI,CAGrE;AAED,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEzC;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,MAAM,CAAA;CAAE,EAAE,GAAG,IAAI,CAMzG;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkBtF;AAED,wBAAgB,OAAO,CAAC,IAAI,MAAW,GAAG,IAAI,CAE7C;AAED,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAI1E"}
@@ -0,0 +1,57 @@
1
+ import chalk from 'chalk';
2
+ import { brand, muted, sym } from './theme.js';
3
+ export function section(title) {
4
+ console.log(`\n ${brand(title)}\n`);
5
+ }
6
+ export function label(key, value, colWidth = 18) {
7
+ const padded = key.padEnd(colWidth);
8
+ console.log(` ${brand(padded)} ${value}`);
9
+ }
10
+ export function text(content) {
11
+ console.log(` ${content}`);
12
+ }
13
+ export function dim(content) {
14
+ console.log(muted(` ${content}`));
15
+ }
16
+ export function success(content) {
17
+ console.log(` ${chalk.hex('#22c55e')(`${sym.check} ${content}`)}`);
18
+ }
19
+ export function error(content) {
20
+ console.error(` ${chalk.hex('#ef4444')(`${sym.cross} ${content}`)}`);
21
+ }
22
+ export function warning(content) {
23
+ console.log(` ${chalk.hex('#eab308')(`${sym.warn} ${content}`)}`);
24
+ }
25
+ export function bulletList(items) {
26
+ for (const item of items) {
27
+ const color = item.color ?? chalk.reset;
28
+ const hint = item.hint ? muted(` ${sym.emDash} ${item.hint}`) : '';
29
+ console.log(` ${brand(sym.pointer)} ${color(item.label)}${hint}`);
30
+ }
31
+ }
32
+ export function box(content, opts) {
33
+ const lines = content.split('\n');
34
+ const maxLen = Math.max(...lines.map((l) => l.length));
35
+ const pad = opts?.padding ?? 1;
36
+ const innerWidth = maxLen + pad * 2;
37
+ const top = opts?.title
38
+ ? `${brand('┌─')} ${brand(opts.title)} ${brand(sym.line.repeat(Math.max(0, innerWidth - opts.title.length - 2)))}${brand('┐')}`
39
+ : `${brand('┌')}${brand(sym.line.repeat(innerWidth))}${brand('┐')}`;
40
+ const bottom = `${brand('└')}${brand(sym.line.repeat(innerWidth))}${brand('┘')}`;
41
+ console.log(` ${top}`);
42
+ for (const line of lines) {
43
+ const padded = line.padEnd(maxLen);
44
+ console.log(` ${brand('│')}${' '.repeat(pad)}${padded}${' '.repeat(pad)}${brand('│')}`);
45
+ }
46
+ console.log(` ${bottom}`);
47
+ }
48
+ export function divider(char = sym.line) {
49
+ console.log(brand(` ${char.repeat(58)}`));
50
+ }
51
+ export function details(data, title) {
52
+ if (title)
53
+ section(title);
54
+ const lines = Object.entries(data).map(([key, value]) => ` ${brand(key.padEnd(20))} ${value}`);
55
+ console.log(`\n${lines.join('\n')}`);
56
+ }
57
+ //# sourceMappingURL=display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"display.js","sourceRoot":"","sources":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,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,CAAC;IAChG,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACvC,CAAC"}
@@ -0,0 +1,27 @@
1
+ interface HelpSection {
2
+ title: string;
3
+ items: {
4
+ cmd: string;
5
+ desc: string;
6
+ example?: string;
7
+ }[];
8
+ }
9
+ export declare function renderHelp(sections: HelpSection[]): string;
10
+ export declare function renderSimpleHelp(cmd: string, description: string, options?: {
11
+ name: string;
12
+ desc: string;
13
+ }[]): string;
14
+ export declare function renderCommandHelp(cmd: string, description: string, subcommands: {
15
+ name: string;
16
+ desc: string;
17
+ opts?: string;
18
+ options?: {
19
+ name: string;
20
+ desc: string;
21
+ }[];
22
+ }[], options?: {
23
+ name: string;
24
+ desc: string;
25
+ }[]): string;
26
+ export {};
27
+ //# sourceMappingURL=help.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/tui/help.ts"],"names":[],"mappings":"AAGA,UAAU,WAAW;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;CAC1D;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAkC1D;AAED,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GACzC,MAAM,CAqBR;AAED,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,EACX,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAA;CAAE,EAAE,EACxG,OAAO,CAAC,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,GACzC,MAAM,CAoCR"}
@@ -0,0 +1,84 @@
1
+ import chalk from 'chalk';
2
+ import { brand, muted, sym } from './theme.js';
3
+ export function renderHelp(sections) {
4
+ const lines = [];
5
+ lines.push('');
6
+ lines.push(` ${chalk.bold('USAGE')}`);
7
+ lines.push(` $ ${chalk.bold('babelize')} ${muted('<command>')} ${muted('[options]')}`);
8
+ lines.push('');
9
+ for (const section of sections) {
10
+ lines.push(` ${brand(section.title)}`);
11
+ for (const item of section.items) {
12
+ const cmd = chalk.bold(item.cmd);
13
+ const desc = muted(item.desc);
14
+ const example = item.example ? muted(` ${sym.emDash} ${chalk.cyan(`$ ${item.example}`)}`) : '';
15
+ lines.push(` ${sym.pointer} ${cmd} ${desc}${example}`);
16
+ }
17
+ lines.push('');
18
+ }
19
+ lines.push(` ${brand('OPTIONS')}`);
20
+ lines.push(` ${chalk.bold('--json')} ${muted('Output raw JSON (machine-readable)')}`);
21
+ lines.push(` ${chalk.bold('--no-color')} ${muted('Disable colored output')}`);
22
+ lines.push(` ${chalk.bold('-v, --verbose')} ${muted('Show verbose request/response details')}`);
23
+ lines.push(` ${chalk.bold('-V, --version')} ${muted('Output the current version')}`);
24
+ lines.push(` ${chalk.bold('-h, --help')} ${muted('Display this help message')}`);
25
+ lines.push('');
26
+ lines.push(` ${brand('EXAMPLES')}`);
27
+ lines.push(` ${sym.pointer} ${chalk.cyan('$ babelize auth login')} ${muted('Interactive login')}`);
28
+ lines.push(` ${sym.pointer} ${chalk.cyan('$ babelize run start')} ${muted('Start a translation run')}`);
29
+ lines.push(` ${sym.pointer} ${chalk.cyan('$ babelize projects list')} ${muted('List all projects')}`);
30
+ lines.push(` ${sym.pointer} ${chalk.cyan('$ babelize init --yes')} ${muted('Quick init with defaults')}`);
31
+ lines.push('');
32
+ return lines.join('\n');
33
+ }
34
+ export function renderSimpleHelp(cmd, description, options) {
35
+ const lines = [];
36
+ lines.push('');
37
+ lines.push(` ${chalk.bold('USAGE')}`);
38
+ lines.push(` $ ${chalk.bold(`babelize ${cmd}`)} ${muted('[options]')}`);
39
+ lines.push('');
40
+ if (options && options.length > 0) {
41
+ lines.push(` ${brand('OPTIONS')}`);
42
+ for (const opt of options) {
43
+ lines.push(` ${chalk.bold(opt.name.padEnd(24))} ${muted(opt.desc)}`);
44
+ }
45
+ lines.push('');
46
+ }
47
+ lines.push(` ${brand('EXAMPLES')}`);
48
+ lines.push(` ${sym.pointer} ${chalk.cyan(`$ babelize ${cmd} --help`)} ${muted('Show this help')}`);
49
+ lines.push('');
50
+ return lines.join('\n');
51
+ }
52
+ export function renderCommandHelp(cmd, description, subcommands, options) {
53
+ const lines = [];
54
+ lines.push('');
55
+ lines.push(` ${brand('USAGE')}`);
56
+ lines.push(` $ ${chalk.bold(`babelize ${cmd}`)} ${muted('<subcommand>')} ${muted('[options]')}`);
57
+ lines.push('');
58
+ if (subcommands.length > 0) {
59
+ lines.push(` ${brand('SUBCOMMANDS')}`);
60
+ for (const sub of subcommands) {
61
+ const name = chalk.bold(sub.name);
62
+ const hint = sub.opts ? muted(` ${sub.opts}`) : '';
63
+ lines.push(` ${sym.pointer} ${name}${' '.repeat(Math.max(1, 24 - sub.name.length))}${muted(sub.desc)}${hint}`);
64
+ if (sub.options?.length) {
65
+ for (const opt of sub.options) {
66
+ lines.push(` ${chalk.bold(opt.name.padEnd(24))} ${muted(opt.desc)}`);
67
+ }
68
+ }
69
+ }
70
+ lines.push('');
71
+ }
72
+ if (options && options.length > 0) {
73
+ lines.push(` ${brand('OPTIONS')}`);
74
+ for (const opt of options) {
75
+ lines.push(` ${chalk.bold(opt.name.padEnd(24))} ${muted(opt.desc)}`);
76
+ }
77
+ lines.push('');
78
+ }
79
+ lines.push(` ${brand('EXAMPLES')}`);
80
+ lines.push(` ${sym.pointer} ${chalk.cyan(`$ babelize ${cmd} --help`)} ${muted('Show this help')}`);
81
+ lines.push('');
82
+ return lines.join('\n');
83
+ }
84
+ //# sourceMappingURL=help.js.map