@hatchway/cli 0.50.53

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 (80) hide show
  1. package/README.md +274 -0
  2. package/bin/hatchway.js +31 -0
  3. package/dist/chunks/Banner-DL1Fpz_g.js +115 -0
  4. package/dist/chunks/Banner-DL1Fpz_g.js.map +1 -0
  5. package/dist/chunks/auto-update-Ddo5Ntt7.js +264 -0
  6. package/dist/chunks/auto-update-Ddo5Ntt7.js.map +1 -0
  7. package/dist/chunks/build-V8_D-JHF.js +116 -0
  8. package/dist/chunks/build-V8_D-JHF.js.map +1 -0
  9. package/dist/chunks/cleanup-BNuJNSve.js +141 -0
  10. package/dist/chunks/cleanup-BNuJNSve.js.map +1 -0
  11. package/dist/chunks/cli-auth-B4Do-N8Y.js +340 -0
  12. package/dist/chunks/cli-auth-B4Do-N8Y.js.map +1 -0
  13. package/dist/chunks/cli-error-1drkrXNn.js +140 -0
  14. package/dist/chunks/cli-error-1drkrXNn.js.map +1 -0
  15. package/dist/chunks/config-hFJA7z5y.js +167 -0
  16. package/dist/chunks/config-hFJA7z5y.js.map +1 -0
  17. package/dist/chunks/config-manager-DST6RbP8.js +133 -0
  18. package/dist/chunks/config-manager-DST6RbP8.js.map +1 -0
  19. package/dist/chunks/database-YGb1Lzim.js +68 -0
  20. package/dist/chunks/database-YGb1Lzim.js.map +1 -0
  21. package/dist/chunks/database-setup-U31oEs90.js +253 -0
  22. package/dist/chunks/database-setup-U31oEs90.js.map +1 -0
  23. package/dist/chunks/devtools-CPruVlOo.js +75 -0
  24. package/dist/chunks/devtools-CPruVlOo.js.map +1 -0
  25. package/dist/chunks/index-DCC6HGdr.js +119 -0
  26. package/dist/chunks/index-DCC6HGdr.js.map +1 -0
  27. package/dist/chunks/init-DkXJVFFx.js +472 -0
  28. package/dist/chunks/init-DkXJVFFx.js.map +1 -0
  29. package/dist/chunks/init-tui-D2VOVdeK.js +1131 -0
  30. package/dist/chunks/init-tui-D2VOVdeK.js.map +1 -0
  31. package/dist/chunks/logger-6V5cBxba.js +38 -0
  32. package/dist/chunks/logger-6V5cBxba.js.map +1 -0
  33. package/dist/chunks/login-CA1XWUEM.js +63 -0
  34. package/dist/chunks/login-CA1XWUEM.js.map +1 -0
  35. package/dist/chunks/logout-BC4VFt8f.js +40 -0
  36. package/dist/chunks/logout-BC4VFt8f.js.map +1 -0
  37. package/dist/chunks/main-tui-D8KkJRd_.js +648 -0
  38. package/dist/chunks/main-tui-D8KkJRd_.js.map +1 -0
  39. package/dist/chunks/manager-DjVI7erc.js +1161 -0
  40. package/dist/chunks/manager-DjVI7erc.js.map +1 -0
  41. package/dist/chunks/port-allocator-BENntRMG.js +864 -0
  42. package/dist/chunks/port-allocator-BENntRMG.js.map +1 -0
  43. package/dist/chunks/process-killer-ChXAqhfm.js +87 -0
  44. package/dist/chunks/process-killer-ChXAqhfm.js.map +1 -0
  45. package/dist/chunks/prompts-Beijr8dm.js +128 -0
  46. package/dist/chunks/prompts-Beijr8dm.js.map +1 -0
  47. package/dist/chunks/repo-cloner-UY3L2X7h.js +219 -0
  48. package/dist/chunks/repo-cloner-UY3L2X7h.js.map +1 -0
  49. package/dist/chunks/repo-detector-36VydrlB.js +66 -0
  50. package/dist/chunks/repo-detector-36VydrlB.js.map +1 -0
  51. package/dist/chunks/run-Du6dvTJL.js +697 -0
  52. package/dist/chunks/run-Du6dvTJL.js.map +1 -0
  53. package/dist/chunks/runner-logger-instance-Dj_JMznn.js +899 -0
  54. package/dist/chunks/runner-logger-instance-Dj_JMznn.js.map +1 -0
  55. package/dist/chunks/spinner-DTH0QZQw.js +53 -0
  56. package/dist/chunks/spinner-DTH0QZQw.js.map +1 -0
  57. package/dist/chunks/start-Dkuro1jp.js +1713 -0
  58. package/dist/chunks/start-Dkuro1jp.js.map +1 -0
  59. package/dist/chunks/start-traditional-7wlD2f2H.js +255 -0
  60. package/dist/chunks/start-traditional-7wlD2f2H.js.map +1 -0
  61. package/dist/chunks/status-BU3cFJm1.js +97 -0
  62. package/dist/chunks/status-BU3cFJm1.js.map +1 -0
  63. package/dist/chunks/theme-NAQBkisB.js +40222 -0
  64. package/dist/chunks/theme-NAQBkisB.js.map +1 -0
  65. package/dist/chunks/upgrade-BBpJirEu.js +455 -0
  66. package/dist/chunks/upgrade-BBpJirEu.js.map +1 -0
  67. package/dist/chunks/use-app-Ct3w2jLI.js +10 -0
  68. package/dist/chunks/use-app-Ct3w2jLI.js.map +1 -0
  69. package/dist/chunks/useBuildState-Dy7pRR8Z.js +330 -0
  70. package/dist/chunks/useBuildState-Dy7pRR8Z.js.map +1 -0
  71. package/dist/cli/index.js +712 -0
  72. package/dist/cli/index.js.map +1 -0
  73. package/dist/index.js +13625 -0
  74. package/dist/index.js.map +1 -0
  75. package/dist/instrument.js +45 -0
  76. package/dist/instrument.js.map +1 -0
  77. package/dist/templates.json +295 -0
  78. package/package.json +87 -0
  79. package/templates/config.template.json +18 -0
  80. package/templates.json +295 -0
@@ -0,0 +1,455 @@
1
+ // Hatchway CLI - Built with Rollup
2
+ import { existsSync, readFileSync, rmSync, writeFileSync, renameSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { execSync } from 'node:child_process';
5
+ import * as p from '@clack/prompts';
6
+ import pc from 'picocolors';
7
+ import { C as CLIError } from './cli-error-1drkrXNn.js';
8
+ import { i as isInsideMonorepo } from './repo-detector-36VydrlB.js';
9
+ import { c as configManager } from './config-manager-DST6RbP8.js';
10
+ import 'node:fs/promises';
11
+ import 'conf';
12
+ import 'node:os';
13
+
14
+ /**
15
+ * Upgrade command - In-place upgrade to latest version
16
+ *
17
+ * This command upgrades both:
18
+ * 1. The CLI itself (globally installed npm package)
19
+ * 2. The app/monorepo (local installation that runs the web app)
20
+ */
21
+ // GitHub API endpoint for releases
22
+ const GITHUB_RELEASES_URL = 'https://api.github.com/repos/codyde/hatchway/releases/latest';
23
+ // Install command for CLI
24
+ const INSTALL_COMMAND = 'curl -fsSL https://hatchway.sh/install | bash';
25
+ /**
26
+ * Fetch the latest release version from GitHub
27
+ */
28
+ async function fetchLatestVersion() {
29
+ try {
30
+ const controller = new AbortController();
31
+ const timeout = setTimeout(() => controller.abort(), 5000);
32
+ const response = await fetch(GITHUB_RELEASES_URL, {
33
+ headers: {
34
+ 'Accept': 'application/vnd.github.v3+json',
35
+ 'User-Agent': 'Hatchway-CLI-Upgrade',
36
+ },
37
+ signal: controller.signal,
38
+ });
39
+ clearTimeout(timeout);
40
+ if (!response.ok) {
41
+ return null;
42
+ }
43
+ const data = await response.json();
44
+ return data.tag_name.replace(/^v/, '');
45
+ }
46
+ catch {
47
+ return null;
48
+ }
49
+ }
50
+ /**
51
+ * Compare two semver versions
52
+ * Returns true if version1 < version2 (i.e., version2 is newer)
53
+ */
54
+ function isNewerVersion(current, latest) {
55
+ const parseVersion = (v) => {
56
+ const parts = v.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);
57
+ return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };
58
+ };
59
+ const c = parseVersion(current);
60
+ const l = parseVersion(latest);
61
+ if (l.major > c.major)
62
+ return true;
63
+ if (l.major < c.major)
64
+ return false;
65
+ if (l.minor > c.minor)
66
+ return true;
67
+ if (l.minor < c.minor)
68
+ return false;
69
+ return l.patch > c.patch;
70
+ }
71
+ /**
72
+ * Perform the CLI update by running the install script
73
+ */
74
+ function performCLIUpdate() {
75
+ try {
76
+ execSync(INSTALL_COMMAND, {
77
+ stdio: 'inherit',
78
+ shell: '/bin/bash',
79
+ env: {
80
+ ...process.env,
81
+ HATCHWAY_QUIET_INSTALL: '1',
82
+ },
83
+ });
84
+ return true;
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
90
+ async function upgradeCommand(options) {
91
+ const s = p.spinner();
92
+ // Get current CLI version
93
+ let currentVersion = '0.0.0';
94
+ try {
95
+ // Try to find package.json by traversing up
96
+ let searchDir = dirname(new URL(import.meta.url).pathname);
97
+ for (let i = 0; i < 5; i++) {
98
+ const pkgPath = join(searchDir, 'package.json');
99
+ if (existsSync(pkgPath)) {
100
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
101
+ currentVersion = pkg.version || '0.0.0';
102
+ break;
103
+ }
104
+ searchDir = dirname(searchDir);
105
+ }
106
+ }
107
+ catch {
108
+ // Ignore errors reading package.json
109
+ }
110
+ // ========================================
111
+ // STEP 1: Always update CLI automatically
112
+ // ========================================
113
+ s.start('Checking for CLI updates');
114
+ const latestVersion = await fetchLatestVersion();
115
+ if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {
116
+ s.stop(pc.cyan('⬆') + ` CLI update available: ${pc.dim(currentVersion)} → ${pc.green(latestVersion)}`);
117
+ console.log();
118
+ console.log(` ${pc.dim('Updating CLI...')}`);
119
+ const cliSuccess = performCLIUpdate();
120
+ if (cliSuccess) {
121
+ console.log(` ${pc.green('✓')} CLI updated to ${pc.green(latestVersion)}`);
122
+ console.log();
123
+ }
124
+ else {
125
+ console.log(` ${pc.yellow('⚠')} CLI update failed`);
126
+ console.log(` ${pc.dim('Run manually:')} ${pc.cyan(INSTALL_COMMAND)}`);
127
+ console.log();
128
+ }
129
+ }
130
+ else if (latestVersion) {
131
+ s.stop(pc.green('✓') + ` CLI is up to date (${currentVersion})`);
132
+ }
133
+ else {
134
+ s.stop(pc.yellow('⚠') + ' Could not check for CLI updates');
135
+ }
136
+ // ========================================
137
+ // STEP 2: Find app installation and prompt
138
+ // ========================================
139
+ s.start('Locating Hatchway app installation');
140
+ let monorepoRoot;
141
+ const config = configManager.get();
142
+ // Try config first
143
+ if (config.monorepoPath && existsSync(config.monorepoPath)) {
144
+ monorepoRoot = config.monorepoPath;
145
+ }
146
+ // Try detection if not in config
147
+ if (!monorepoRoot) {
148
+ const repoCheck = await isInsideMonorepo();
149
+ if (repoCheck.inside && repoCheck.root) {
150
+ monorepoRoot = repoCheck.root;
151
+ }
152
+ }
153
+ if (!monorepoRoot) {
154
+ s.stop(pc.dim('ℹ') + ' No Hatchway app installation found');
155
+ console.log();
156
+ console.log(pc.dim(' The CLI has been updated. No local app installation to upgrade.'));
157
+ console.log(pc.dim(' Run ') + pc.cyan('hatchway init') + pc.dim(' to set up a local installation.'));
158
+ console.log();
159
+ return;
160
+ }
161
+ s.stop(pc.green('✓') + ` Found app installation`);
162
+ // Prompt user about upgrading the app
163
+ console.log();
164
+ console.log(` ${pc.bold('App installation found:')}`);
165
+ console.log(` ${pc.cyan(monorepoRoot)}`);
166
+ console.log();
167
+ // Skip prompt if --force is used
168
+ if (!options.force) {
169
+ const shouldUpgradeApp = await p.confirm({
170
+ message: 'Would you like to upgrade the app installation as well?',
171
+ initialValue: true,
172
+ });
173
+ if (p.isCancel(shouldUpgradeApp) || !shouldUpgradeApp) {
174
+ console.log();
175
+ console.log(pc.dim(' Skipping app upgrade. CLI has been updated.'));
176
+ console.log();
177
+ return;
178
+ }
179
+ }
180
+ console.log();
181
+ // Check git status before upgrading
182
+ if (!options.force) {
183
+ s.start('Checking for uncommitted changes');
184
+ try {
185
+ const gitStatus = execSync('git status --porcelain', {
186
+ cwd: monorepoRoot,
187
+ encoding: 'utf-8',
188
+ }).trim();
189
+ if (gitStatus.length > 0) {
190
+ s.stop(pc.yellow('⚠') + ' Uncommitted changes detected');
191
+ const changes = gitStatus.split('\n').slice(0, 5);
192
+ console.log(pc.dim(' Modified files:'));
193
+ changes.forEach(line => console.log(pc.dim(` ${line}`)));
194
+ if (!options.force) {
195
+ const confirm = await p.confirm({
196
+ message: 'Continue upgrade? This will discard local changes.',
197
+ initialValue: false,
198
+ });
199
+ if (!confirm || p.isCancel(confirm)) {
200
+ console.log(pc.dim('\nUpgrade cancelled'));
201
+ process.exit(0);
202
+ }
203
+ }
204
+ }
205
+ else {
206
+ s.stop(pc.green('✓') + ' No uncommitted changes');
207
+ }
208
+ }
209
+ catch (error) {
210
+ s.stop(pc.yellow('⚠') + ' Not a git repository');
211
+ // Continue anyway - user might have extracted from tarball
212
+ }
213
+ }
214
+ // Backup configuration files
215
+ s.start('Backing up configuration files');
216
+ const envBackup = {
217
+ runner: {},
218
+ hatchway: {},
219
+ };
220
+ // Define paths to check
221
+ const envPaths = [
222
+ { app: 'runner', path: join(monorepoRoot, 'apps/runner/.env') },
223
+ { app: 'runner', pathLocal: join(monorepoRoot, 'apps/runner/.env.local') },
224
+ { app: 'hatchway', path: join(monorepoRoot, 'apps/hatchway/.env') },
225
+ { app: 'hatchway', pathLocal: join(monorepoRoot, 'apps/hatchway/.env.local') },
226
+ ];
227
+ let backedUpCount = 0;
228
+ for (const item of envPaths) {
229
+ const app = item.app;
230
+ const filePath = item.path || item.pathLocal;
231
+ const isLocal = !!item.pathLocal;
232
+ if (existsSync(filePath)) {
233
+ const content = readFileSync(filePath, 'utf-8');
234
+ if (isLocal) {
235
+ envBackup[app].envLocal = content;
236
+ }
237
+ else {
238
+ envBackup[app].env = content;
239
+ }
240
+ backedUpCount++;
241
+ }
242
+ }
243
+ s.stop(pc.green('✓') + ` Backed up ${backedUpCount} configuration file(s)`);
244
+ // Determine branch and clone
245
+ const branch = options.branch || 'main';
246
+ s.start(`Cloning fresh copy from ${pc.cyan(branch)}`);
247
+ const parentDir = dirname(monorepoRoot);
248
+ const repoName = monorepoRoot.split('/').pop();
249
+ const tempDir = join(parentDir, `${repoName}-upgrade-temp`);
250
+ // Remove temp directory if it exists from failed previous upgrade
251
+ if (existsSync(tempDir)) {
252
+ rmSync(tempDir, { recursive: true, force: true });
253
+ }
254
+ try {
255
+ execSync(`git clone --branch ${branch} --depth 1 https://github.com/codyde/hatchway.git "${tempDir}"`, {
256
+ cwd: parentDir,
257
+ stdio: 'pipe', // Silent
258
+ });
259
+ s.stop(pc.green('✓') + ' Cloned successfully');
260
+ }
261
+ catch (error) {
262
+ s.stop(pc.red('✗') + ' Clone failed');
263
+ // Cleanup temp dir
264
+ if (existsSync(tempDir)) {
265
+ rmSync(tempDir, { recursive: true, force: true });
266
+ }
267
+ throw new CLIError({
268
+ code: 'UPGRADE_CLONE_FAILED',
269
+ message: `Failed to clone branch "${branch}"`,
270
+ suggestions: [
271
+ 'Check your internet connection',
272
+ 'Verify the branch exists: https://github.com/codyde/hatchway/tree/' + branch,
273
+ 'Try upgrading to main: hatchway upgrade',
274
+ ],
275
+ });
276
+ }
277
+ // Restore configuration files
278
+ s.start('Restoring configuration files');
279
+ let restoredCount = 0;
280
+ const restorePaths = [
281
+ { app: 'runner', file: '.env', dir: join(tempDir, 'apps/runner') },
282
+ { app: 'runner', file: '.env.local', dir: join(tempDir, 'apps/runner') },
283
+ { app: 'hatchway', file: '.env', dir: join(tempDir, 'apps/hatchway') },
284
+ { app: 'hatchway', file: '.env.local', dir: join(tempDir, 'apps/hatchway') },
285
+ ];
286
+ for (const item of restorePaths) {
287
+ const isLocal = item.file === '.env.local';
288
+ const backupContent = isLocal ? envBackup[item.app].envLocal : envBackup[item.app].env;
289
+ if (backupContent) {
290
+ const targetPath = join(item.dir, item.file);
291
+ writeFileSync(targetPath, backupContent, 'utf-8');
292
+ restoredCount++;
293
+ }
294
+ }
295
+ s.stop(pc.green('✓') + ` Restored ${restoredCount} configuration file(s)`);
296
+ // Install dependencies
297
+ s.start('Installing dependencies');
298
+ try {
299
+ execSync('pnpm install', {
300
+ cwd: tempDir,
301
+ stdio: 'pipe',
302
+ env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },
303
+ });
304
+ s.stop(pc.green('✓') + ' Dependencies installed');
305
+ }
306
+ catch (error) {
307
+ s.stop(pc.red('✗') + ' Dependency installation failed');
308
+ // Cleanup
309
+ rmSync(tempDir, { recursive: true, force: true });
310
+ throw new CLIError({
311
+ code: 'UPGRADE_INSTALL_FAILED',
312
+ message: 'Failed to install dependencies in new version',
313
+ suggestions: [
314
+ 'Check if the branch is stable',
315
+ 'Try upgrading to main instead',
316
+ 'Check disk space',
317
+ ],
318
+ });
319
+ }
320
+ // Build services
321
+ s.start('Building services (this may take a moment)');
322
+ try {
323
+ execSync('pnpm turbo build', {
324
+ cwd: tempDir,
325
+ stdio: 'pipe',
326
+ env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },
327
+ });
328
+ s.stop(pc.green('✓') + ' Build successful');
329
+ }
330
+ catch (error) {
331
+ s.stop(pc.red('✗') + ' Build failed');
332
+ // Try to extract error message from execSync error
333
+ let errorOutput = '';
334
+ if (error && typeof error === 'object' && 'stderr' in error) {
335
+ errorOutput = String(error.stderr || '');
336
+ }
337
+ if (!errorOutput && error && typeof error === 'object' && 'stdout' in error) {
338
+ errorOutput = String(error.stdout || '');
339
+ }
340
+ // Show error details if available
341
+ if (errorOutput) {
342
+ console.log(pc.red('\nBuild errors:'));
343
+ console.log(pc.gray('─'.repeat(60)));
344
+ const lines = errorOutput.split('\n').slice(-20);
345
+ lines.forEach(line => console.log(pc.red(` ${line}`)));
346
+ console.log(pc.gray('─'.repeat(60)));
347
+ console.log('');
348
+ }
349
+ // Cleanup
350
+ rmSync(tempDir, { recursive: true, force: true });
351
+ throw new CLIError({
352
+ code: 'UPGRADE_BUILD_FAILED',
353
+ message: 'Failed to build new version',
354
+ suggestions: [
355
+ 'The branch may have build errors',
356
+ 'Try upgrading to a stable release tag',
357
+ 'Check build logs for errors',
358
+ ],
359
+ });
360
+ }
361
+ // Apply database migrations (if DATABASE_URL exists)
362
+ const databaseUrl = envBackup.hatchway.env?.match(/DATABASE_URL=["']?([^"'\n]+)["']?/)?.[1] ||
363
+ envBackup.hatchway.envLocal?.match(/DATABASE_URL=["']?([^"'\n]+)["']?/)?.[1] ||
364
+ process.env.DATABASE_URL;
365
+ if (databaseUrl) {
366
+ s.start('Applying database migrations');
367
+ try {
368
+ execSync('npx drizzle-kit push --config=drizzle.config.ts', {
369
+ cwd: join(tempDir, 'apps/hatchway'),
370
+ stdio: 'pipe',
371
+ env: {
372
+ ...process.env,
373
+ DATABASE_URL: databaseUrl,
374
+ },
375
+ });
376
+ s.stop(pc.green('✓') + ' Database schema updated');
377
+ }
378
+ catch (error) {
379
+ s.stop(pc.yellow('⚠') + ' Migration failed');
380
+ console.log(pc.dim(' You may need to run: hatchway database'));
381
+ console.log(pc.dim(' This won\'t prevent the upgrade from completing'));
382
+ }
383
+ }
384
+ else {
385
+ s.start('Skipping database migrations (no DATABASE_URL found)');
386
+ s.stop(pc.yellow('⚠') + ' No database configured');
387
+ }
388
+ // Swap directories (atomic operation)
389
+ s.start('Finalizing upgrade');
390
+ const backupDir = join(parentDir, `${repoName}-backup-${Date.now()}`);
391
+ try {
392
+ // Rename current installation to backup
393
+ renameSync(monorepoRoot, backupDir);
394
+ // Rename new installation to production
395
+ renameSync(tempDir, monorepoRoot);
396
+ s.stop(pc.green('✓') + ' Upgrade finalized');
397
+ }
398
+ catch (error) {
399
+ s.stop(pc.red('✗') + ' Failed to swap directories');
400
+ // Attempt recovery
401
+ try {
402
+ if (existsSync(backupDir)) {
403
+ renameSync(backupDir, monorepoRoot);
404
+ console.log(pc.yellow('⚠') + ' Restored original installation');
405
+ }
406
+ if (existsSync(tempDir)) {
407
+ rmSync(tempDir, { recursive: true, force: true });
408
+ }
409
+ }
410
+ catch (recoveryError) {
411
+ console.error(pc.red('❌') + ' Failed to recover. Manual intervention required.');
412
+ console.error(pc.dim(` Backup location: ${backupDir}`));
413
+ }
414
+ throw error;
415
+ }
416
+ // Cleanup backup
417
+ s.start('Cleaning up');
418
+ try {
419
+ rmSync(backupDir, { recursive: true, force: true });
420
+ s.stop(pc.green('✓') + ' Cleanup complete');
421
+ }
422
+ catch (error) {
423
+ s.stop(pc.yellow('⚠') + ' Could not remove backup');
424
+ console.log(pc.dim(` You can manually delete: ${backupDir}`));
425
+ }
426
+ // Success!
427
+ console.log();
428
+ console.log(pc.green('✓') + pc.bold(' Upgrade complete!'));
429
+ console.log();
430
+ // Check if user is currently inside the monorepo directory
431
+ const currentDir = process.cwd();
432
+ const isCurrentlyInMonorepo = currentDir.startsWith(monorepoRoot);
433
+ if (isCurrentlyInMonorepo) {
434
+ console.log(pc.yellow('⚠') + pc.bold(' IMPORTANT: Your shell directory is stale'));
435
+ console.log();
436
+ console.log(pc.dim(' The upgrade renamed directories while you were inside them.'));
437
+ console.log(pc.dim(' You need to refresh your shell location:'));
438
+ console.log();
439
+ console.log(pc.cyan(' cd .. && cd ' + monorepoRoot.split('/').pop()));
440
+ console.log();
441
+ console.log(pc.dim(' Or simply close and reopen your terminal.'));
442
+ console.log();
443
+ }
444
+ console.log(pc.dim(' Note: Restart your terminal to use the updated CLI'));
445
+ console.log(pc.dim(' Or run: hash -r'));
446
+ console.log();
447
+ if (branch !== 'main') {
448
+ console.log(pc.yellow('⚠') + ` You upgraded to branch: ${pc.cyan(branch)}`);
449
+ console.log(pc.dim(' To return to main: hatchway upgrade'));
450
+ console.log();
451
+ }
452
+ }
453
+
454
+ export { upgradeCommand };
455
+ //# sourceMappingURL=upgrade-BBpJirEu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade-BBpJirEu.js","sources":["../../src/cli/commands/upgrade.ts"],"sourcesContent":["/**\n * Upgrade command - In-place upgrade to latest version\n * \n * This command upgrades both:\n * 1. The CLI itself (globally installed npm package)\n * 2. The app/monorepo (local installation that runs the web app)\n */\n\nimport { existsSync, readFileSync, writeFileSync, mkdirSync, rmSync, renameSync, copyFileSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { execSync } from 'node:child_process';\nimport * as p from '@clack/prompts';\nimport pc from 'picocolors';\nimport { CLIError, errors } from '../utils/cli-error.js';\nimport { isInsideMonorepo } from '../utils/repo-detector.js';\nimport { configManager } from '../utils/config-manager.js';\n\n// GitHub API endpoint for releases\nconst GITHUB_RELEASES_URL = 'https://api.github.com/repos/codyde/hatchway/releases/latest';\n\n// Install command for CLI\nconst INSTALL_COMMAND = 'curl -fsSL https://hatchway.sh/install | bash';\n\ninterface UpgradeOptions {\n branch?: string;\n force?: boolean;\n}\n\ninterface EnvBackup {\n runner: { env?: string; envLocal?: string };\n hatchway: { env?: string; envLocal?: string };\n}\n\n/**\n * Fetch the latest release version from GitHub\n */\nasync function fetchLatestVersion(): Promise<string | null> {\n try {\n const controller = new AbortController();\n const timeout = setTimeout(() => controller.abort(), 5000);\n\n const response = await fetch(GITHUB_RELEASES_URL, {\n headers: {\n 'Accept': 'application/vnd.github.v3+json',\n 'User-Agent': 'Hatchway-CLI-Upgrade',\n },\n signal: controller.signal,\n });\n\n clearTimeout(timeout);\n\n if (!response.ok) {\n return null;\n }\n\n const data = await response.json() as { tag_name: string };\n return data.tag_name.replace(/^v/, '');\n } catch {\n return null;\n }\n}\n\n/**\n * Compare two semver versions\n * Returns true if version1 < version2 (i.e., version2 is newer)\n */\nfunction isNewerVersion(current: string, latest: string): boolean {\n const parseVersion = (v: string) => {\n const parts = v.replace(/^v/, '').split('.').map(n => parseInt(n, 10) || 0);\n return { major: parts[0] || 0, minor: parts[1] || 0, patch: parts[2] || 0 };\n };\n\n const c = parseVersion(current);\n const l = parseVersion(latest);\n\n if (l.major > c.major) return true;\n if (l.major < c.major) return false;\n if (l.minor > c.minor) return true;\n if (l.minor < c.minor) return false;\n return l.patch > c.patch;\n}\n\n/**\n * Perform the CLI update by running the install script\n */\nfunction performCLIUpdate(): boolean {\n try {\n execSync(INSTALL_COMMAND, {\n stdio: 'inherit',\n shell: '/bin/bash',\n env: {\n ...process.env,\n HATCHWAY_QUIET_INSTALL: '1',\n },\n });\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function upgradeCommand(options: UpgradeOptions) {\n const s = p.spinner();\n \n // Get current CLI version\n let currentVersion = '0.0.0';\n try {\n // Try to find package.json by traversing up\n let searchDir = dirname(new URL(import.meta.url).pathname);\n for (let i = 0; i < 5; i++) {\n const pkgPath = join(searchDir, 'package.json');\n if (existsSync(pkgPath)) {\n const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));\n currentVersion = pkg.version || '0.0.0';\n break;\n }\n searchDir = dirname(searchDir);\n }\n } catch {\n // Ignore errors reading package.json\n }\n \n // ========================================\n // STEP 1: Always update CLI automatically\n // ========================================\n s.start('Checking for CLI updates');\n\n const latestVersion = await fetchLatestVersion();\n\n if (latestVersion && isNewerVersion(currentVersion, latestVersion)) {\n s.stop(pc.cyan('⬆') + ` CLI update available: ${pc.dim(currentVersion)} → ${pc.green(latestVersion)}`);\n\n console.log();\n console.log(` ${pc.dim('Updating CLI...')}`);\n\n const cliSuccess = performCLIUpdate();\n\n if (cliSuccess) {\n console.log(` ${pc.green('✓')} CLI updated to ${pc.green(latestVersion)}`);\n console.log();\n } else {\n console.log(` ${pc.yellow('⚠')} CLI update failed`);\n console.log(` ${pc.dim('Run manually:')} ${pc.cyan(INSTALL_COMMAND)}`);\n console.log();\n }\n } else if (latestVersion) {\n s.stop(pc.green('✓') + ` CLI is up to date (${currentVersion})`);\n } else {\n s.stop(pc.yellow('⚠') + ' Could not check for CLI updates');\n }\n\n // ========================================\n // STEP 2: Find app installation and prompt\n // ========================================\n s.start('Locating Hatchway app installation');\n\n let monorepoRoot: string | undefined;\n const config = configManager.get();\n\n // Try config first\n if (config.monorepoPath && existsSync(config.monorepoPath)) {\n monorepoRoot = config.monorepoPath;\n }\n\n // Try detection if not in config\n if (!monorepoRoot) {\n const repoCheck = await isInsideMonorepo();\n if (repoCheck.inside && repoCheck.root) {\n monorepoRoot = repoCheck.root;\n }\n }\n\n if (!monorepoRoot) {\n s.stop(pc.dim('ℹ') + ' No Hatchway app installation found');\n console.log();\n console.log(pc.dim(' The CLI has been updated. No local app installation to upgrade.'));\n console.log(pc.dim(' Run ') + pc.cyan('hatchway init') + pc.dim(' to set up a local installation.'));\n console.log();\n return;\n }\n\n s.stop(pc.green('✓') + ` Found app installation`);\n\n // Prompt user about upgrading the app\n console.log();\n console.log(` ${pc.bold('App installation found:')}`);\n console.log(` ${pc.cyan(monorepoRoot)}`);\n console.log();\n\n // Skip prompt if --force is used\n if (!options.force) {\n const shouldUpgradeApp = await p.confirm({\n message: 'Would you like to upgrade the app installation as well?',\n initialValue: true,\n });\n\n if (p.isCancel(shouldUpgradeApp) || !shouldUpgradeApp) {\n console.log();\n console.log(pc.dim(' Skipping app upgrade. CLI has been updated.'));\n console.log();\n return;\n }\n }\n\n console.log();\n\n // Check git status before upgrading\n if (!options.force) {\n s.start('Checking for uncommitted changes');\n\n try {\n const gitStatus = execSync('git status --porcelain', {\n cwd: monorepoRoot,\n encoding: 'utf-8',\n }).trim();\n\n if (gitStatus.length > 0) {\n s.stop(pc.yellow('⚠') + ' Uncommitted changes detected');\n\n const changes = gitStatus.split('\\n').slice(0, 5);\n console.log(pc.dim(' Modified files:'));\n changes.forEach(line => console.log(pc.dim(` ${line}`)));\n\n if (!options.force) {\n const confirm = await p.confirm({\n message: 'Continue upgrade? This will discard local changes.',\n initialValue: false,\n });\n\n if (!confirm || p.isCancel(confirm)) {\n console.log(pc.dim('\\nUpgrade cancelled'));\n process.exit(0);\n }\n }\n } else {\n s.stop(pc.green('✓') + ' No uncommitted changes');\n }\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Not a git repository');\n // Continue anyway - user might have extracted from tarball\n }\n }\n\n // Backup configuration files\n s.start('Backing up configuration files');\n\n const envBackup: EnvBackup = {\n runner: {},\n hatchway: {},\n };\n\n // Define paths to check\n const envPaths = [\n { app: 'runner', path: join(monorepoRoot, 'apps/runner/.env') },\n { app: 'runner', pathLocal: join(monorepoRoot, 'apps/runner/.env.local') },\n { app: 'hatchway', path: join(monorepoRoot, 'apps/hatchway/.env') },\n { app: 'hatchway', pathLocal: join(monorepoRoot, 'apps/hatchway/.env.local') },\n ];\n\n let backedUpCount = 0;\n\n for (const item of envPaths) {\n const app = item.app as keyof EnvBackup;\n const filePath = item.path || item.pathLocal!;\n const isLocal = !!item.pathLocal;\n\n if (existsSync(filePath)) {\n const content = readFileSync(filePath, 'utf-8');\n if (isLocal) {\n envBackup[app].envLocal = content;\n } else {\n envBackup[app].env = content;\n }\n backedUpCount++;\n }\n }\n\n s.stop(pc.green('✓') + ` Backed up ${backedUpCount} configuration file(s)`);\n\n // Determine branch and clone\n const branch = options.branch || 'main';\n\n s.start(`Cloning fresh copy from ${pc.cyan(branch)}`);\n\n const parentDir = dirname(monorepoRoot);\n const repoName = monorepoRoot.split('/').pop();\n const tempDir = join(parentDir, `${repoName}-upgrade-temp`);\n\n // Remove temp directory if it exists from failed previous upgrade\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n\n try {\n execSync(\n `git clone --branch ${branch} --depth 1 https://github.com/codyde/hatchway.git \"${tempDir}\"`,\n {\n cwd: parentDir,\n stdio: 'pipe', // Silent\n }\n );\n\n s.stop(pc.green('✓') + ' Cloned successfully');\n } catch (error) {\n s.stop(pc.red('✗') + ' Clone failed');\n\n // Cleanup temp dir\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n\n throw new CLIError({\n code: 'UPGRADE_CLONE_FAILED',\n message: `Failed to clone branch \"${branch}\"`,\n suggestions: [\n 'Check your internet connection',\n 'Verify the branch exists: https://github.com/codyde/hatchway/tree/' + branch,\n 'Try upgrading to main: hatchway upgrade',\n ],\n });\n }\n\n // Restore configuration files\n s.start('Restoring configuration files');\n\n let restoredCount = 0;\n\n const restorePaths = [\n { app: 'runner' as const, file: '.env', dir: join(tempDir, 'apps/runner') },\n { app: 'runner' as const, file: '.env.local', dir: join(tempDir, 'apps/runner') },\n { app: 'hatchway' as const, file: '.env', dir: join(tempDir, 'apps/hatchway') },\n { app: 'hatchway' as const, file: '.env.local', dir: join(tempDir, 'apps/hatchway') },\n ];\n\n for (const item of restorePaths) {\n const isLocal = item.file === '.env.local';\n const backupContent = isLocal ? envBackup[item.app].envLocal : envBackup[item.app].env;\n\n if (backupContent) {\n const targetPath = join(item.dir, item.file);\n writeFileSync(targetPath, backupContent, 'utf-8');\n restoredCount++;\n }\n }\n\n s.stop(pc.green('✓') + ` Restored ${restoredCount} configuration file(s)`);\n\n // Install dependencies\n s.start('Installing dependencies');\n\n try {\n execSync('pnpm install', {\n cwd: tempDir,\n stdio: 'pipe',\n env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },\n });\n\n s.stop(pc.green('✓') + ' Dependencies installed');\n } catch (error) {\n s.stop(pc.red('✗') + ' Dependency installation failed');\n\n // Cleanup\n rmSync(tempDir, { recursive: true, force: true });\n\n throw new CLIError({\n code: 'UPGRADE_INSTALL_FAILED',\n message: 'Failed to install dependencies in new version',\n suggestions: [\n 'Check if the branch is stable',\n 'Try upgrading to main instead',\n 'Check disk space',\n ],\n });\n }\n\n // Build services\n s.start('Building services (this may take a moment)');\n\n try {\n execSync('pnpm turbo build', {\n cwd: tempDir,\n stdio: 'pipe',\n env: { ...process.env, TURBO_TELEMETRY_DISABLED: '1' },\n });\n\n s.stop(pc.green('✓') + ' Build successful');\n } catch (error) {\n s.stop(pc.red('✗') + ' Build failed');\n\n // Try to extract error message from execSync error\n let errorOutput = '';\n if (error && typeof error === 'object' && 'stderr' in error) {\n errorOutput = String((error as { stderr?: unknown }).stderr || '');\n }\n if (!errorOutput && error && typeof error === 'object' && 'stdout' in error) {\n errorOutput = String((error as { stdout?: unknown }).stdout || '');\n }\n\n // Show error details if available\n if (errorOutput) {\n console.log(pc.red('\\nBuild errors:'));\n console.log(pc.gray('─'.repeat(60)));\n const lines = errorOutput.split('\\n').slice(-20);\n lines.forEach(line => console.log(pc.red(` ${line}`)));\n console.log(pc.gray('─'.repeat(60)));\n console.log('');\n }\n\n // Cleanup\n rmSync(tempDir, { recursive: true, force: true });\n\n throw new CLIError({\n code: 'UPGRADE_BUILD_FAILED',\n message: 'Failed to build new version',\n suggestions: [\n 'The branch may have build errors',\n 'Try upgrading to a stable release tag',\n 'Check build logs for errors',\n ],\n });\n }\n\n // Apply database migrations (if DATABASE_URL exists)\n const databaseUrl =\n envBackup.hatchway.env?.match(/DATABASE_URL=[\"']?([^\"'\\n]+)[\"']?/)?.[1] ||\n envBackup.hatchway.envLocal?.match(/DATABASE_URL=[\"']?([^\"'\\n]+)[\"']?/)?.[1] ||\n process.env.DATABASE_URL;\n\n if (databaseUrl) {\n s.start('Applying database migrations');\n\n try {\n execSync('npx drizzle-kit push --config=drizzle.config.ts', {\n cwd: join(tempDir, 'apps/hatchway'),\n stdio: 'pipe',\n env: {\n ...process.env,\n DATABASE_URL: databaseUrl,\n },\n });\n\n s.stop(pc.green('✓') + ' Database schema updated');\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Migration failed');\n console.log(pc.dim(' You may need to run: hatchway database'));\n console.log(pc.dim(' This won\\'t prevent the upgrade from completing'));\n }\n } else {\n s.start('Skipping database migrations (no DATABASE_URL found)');\n s.stop(pc.yellow('⚠') + ' No database configured');\n }\n\n // Swap directories (atomic operation)\n s.start('Finalizing upgrade');\n\n const backupDir = join(parentDir, `${repoName}-backup-${Date.now()}`);\n\n try {\n // Rename current installation to backup\n renameSync(monorepoRoot, backupDir);\n\n // Rename new installation to production\n renameSync(tempDir, monorepoRoot);\n\n s.stop(pc.green('✓') + ' Upgrade finalized');\n } catch (error) {\n s.stop(pc.red('✗') + ' Failed to swap directories');\n\n // Attempt recovery\n try {\n if (existsSync(backupDir)) {\n renameSync(backupDir, monorepoRoot);\n console.log(pc.yellow('⚠') + ' Restored original installation');\n }\n if (existsSync(tempDir)) {\n rmSync(tempDir, { recursive: true, force: true });\n }\n } catch (recoveryError) {\n console.error(pc.red('❌') + ' Failed to recover. Manual intervention required.');\n console.error(pc.dim(` Backup location: ${backupDir}`));\n }\n\n throw error;\n }\n\n // Cleanup backup\n s.start('Cleaning up');\n\n try {\n rmSync(backupDir, { recursive: true, force: true });\n s.stop(pc.green('✓') + ' Cleanup complete');\n } catch (error) {\n s.stop(pc.yellow('⚠') + ' Could not remove backup');\n console.log(pc.dim(` You can manually delete: ${backupDir}`));\n }\n\n // Success!\n console.log();\n console.log(pc.green('✓') + pc.bold(' Upgrade complete!'));\n console.log();\n\n // Check if user is currently inside the monorepo directory\n const currentDir = process.cwd();\n const isCurrentlyInMonorepo = currentDir.startsWith(monorepoRoot);\n\n if (isCurrentlyInMonorepo) {\n console.log(pc.yellow('⚠') + pc.bold(' IMPORTANT: Your shell directory is stale'));\n console.log();\n console.log(pc.dim(' The upgrade renamed directories while you were inside them.'));\n console.log(pc.dim(' You need to refresh your shell location:'));\n console.log();\n console.log(pc.cyan(' cd .. && cd ' + monorepoRoot.split('/').pop()));\n console.log();\n console.log(pc.dim(' Or simply close and reopen your terminal.'));\n console.log();\n }\n\n console.log(pc.dim(' Note: Restart your terminal to use the updated CLI'));\n console.log(pc.dim(' Or run: hash -r'));\n console.log();\n\n if (branch !== 'main') {\n console.log(pc.yellow('⚠') + ` You upgraded to branch: ${pc.cyan(branch)}`);\n console.log(pc.dim(' To return to main: hatchway upgrade'));\n console.log();\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;AAMG;AAWH;AACA,MAAM,mBAAmB,GAAG,8DAA8D;AAE1F;AACA,MAAM,eAAe,GAAG,+CAA+C;AAYvE;;AAEG;AACH,eAAe,kBAAkB,GAAA;AAC/B,IAAA,IAAI;AACF,QAAA,MAAM,UAAU,GAAG,IAAI,eAAe,EAAE;AACxC,QAAA,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM,UAAU,CAAC,KAAK,EAAE,EAAE,IAAI,CAAC;AAE1D,QAAA,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,mBAAmB,EAAE;AAChD,YAAA,OAAO,EAAE;AACP,gBAAA,QAAQ,EAAE,gCAAgC;AAC1C,gBAAA,YAAY,EAAE,sBAAsB;AACrC,aAAA;YACD,MAAM,EAAE,UAAU,CAAC,MAAM;AAC1B,SAAA,CAAC;QAEF,YAAY,CAAC,OAAO,CAAC;AAErB,QAAA,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE;AAChB,YAAA,OAAO,IAAI;QACb;AAEA,QAAA,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAA0B;QAC1D,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC;IACxC;AAAE,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+ /**
5
+ `useApp` is a React hook that exposes a method to manually exit the app (unmount).
6
+ */
7
+ const useApp = () => reactExports.useContext(AppContext);
8
+
9
+ export { useApp as u };
10
+ //# sourceMappingURL=use-app-Ct3w2jLI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-app-Ct3w2jLI.js","sources":["../../../../node_modules/.pnpm/ink@6.5.1_@types+react@19.2.7_react@19.1.0/node_modules/ink/build/hooks/use-app.js"],"sourcesContent":["import { useContext } from 'react';\nimport AppContext from '../components/AppContext.js';\n/**\n`useApp` is a React hook that exposes a method to manually exit the app (unmount).\n*/\nconst useApp = () => useContext(AppContext);\nexport default useApp;\n//# sourceMappingURL=use-app.js.map"],"names":["useContext"],"mappings":";;;AAEA;AACA;AACA;AACK,MAAC,MAAM,GAAG,MAAMA,uBAAU,CAAC,UAAU;;;;","x_google_ignoreList":[0]}