@veloxts/cli 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 VeloxTS Framework Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,174 @@
1
+ # @veloxts/cli
2
+
3
+ Laravel-inspired command-line interface for the VeloxTS Framework.
4
+
5
+ ## Installation
6
+
7
+ The CLI is installed automatically when you create a new VeloxTS project:
8
+
9
+ ```bash
10
+ npx create-velox-app my-app
11
+ cd my-app
12
+ ```
13
+
14
+ Or add it to an existing project:
15
+
16
+ ```bash
17
+ npm install -D @veloxts/cli
18
+ # or
19
+ pnpm add -D @veloxts/cli
20
+ ```
21
+
22
+ ## Commands
23
+
24
+ ### `velox dev`
25
+
26
+ Start the development server with hot reload.
27
+
28
+ ```bash
29
+ velox dev
30
+ ```
31
+
32
+ **Options:**
33
+
34
+ - `-p, --port <port>` - Port to listen on (default: 3000)
35
+ - `-H, --host <host>` - Host to bind to (default: localhost)
36
+ - `-e, --entry <file>` - Entry point file (auto-detected if not specified)
37
+
38
+ **Examples:**
39
+
40
+ ```bash
41
+ # Start on default port 3000
42
+ velox dev
43
+
44
+ # Start on custom port
45
+ velox dev --port 8080
46
+
47
+ # Specify custom entry point
48
+ velox dev --entry src/main.ts
49
+ ```
50
+
51
+ ### `velox migrate`
52
+
53
+ Run database migrations using Prisma.
54
+
55
+ ```bash
56
+ velox migrate
57
+ ```
58
+
59
+ **Options:**
60
+
61
+ - `--deploy` - Run migrations in production mode (prisma migrate deploy)
62
+ - `--force` - Force push schema without migration (development only)
63
+
64
+ **Examples:**
65
+
66
+ ```bash
67
+ # Development: Sync schema with database
68
+ velox migrate
69
+
70
+ # Production: Apply pending migrations
71
+ velox migrate --deploy
72
+
73
+ # Force push schema changes (dev only)
74
+ velox migrate --force
75
+ ```
76
+
77
+ ## Development
78
+
79
+ ### Building
80
+
81
+ ```bash
82
+ pnpm build
83
+ ```
84
+
85
+ ### Type Checking
86
+
87
+ ```bash
88
+ pnpm type-check
89
+ ```
90
+
91
+ ## Features
92
+
93
+ - Beautiful terminal output with colors and spinners
94
+ - Automatic entry point detection
95
+ - Graceful shutdown handling (Ctrl+C)
96
+ - Helpful error messages with suggestions
97
+ - Laravel-inspired command design
98
+ - Built with Commander.js and Clack
99
+
100
+ ## Architecture
101
+
102
+ The CLI is built with:
103
+
104
+ - **Commander.js** - Command-line parsing and routing
105
+ - **Clack** - Beautiful interactive prompts
106
+ - **picocolors** - Terminal colors without dependencies
107
+ - **tsx** - TypeScript execution with hot reload
108
+
109
+ ## Troubleshooting
110
+
111
+ ### Entry Point Not Found
112
+
113
+ If the CLI can't find your entry point:
114
+
115
+ ```bash
116
+ velox dev --entry src/index.ts
117
+ ```
118
+
119
+ Or ensure your project has one of these files:
120
+ - `src/index.ts`
121
+ - `src/main.ts`
122
+ - `index.ts`
123
+
124
+ ### Port Already in Use
125
+
126
+ ```
127
+ Error: Port 3000 is already in use
128
+ ```
129
+
130
+ **Solution:** Use a different port:
131
+
132
+ ```bash
133
+ velox dev --port 8080
134
+ ```
135
+
136
+ ### Module Resolution Errors
137
+
138
+ Ensure all dependencies are installed:
139
+
140
+ ```bash
141
+ npm install
142
+ ```
143
+
144
+ And that your `tsconfig.json` has correct module resolution settings.
145
+
146
+ ## MVP Limitations
147
+
148
+ The current v0.1.0 release includes:
149
+
150
+ **Included:**
151
+ - `velox dev` - Development server with hot reload
152
+ - `velox migrate` - Database migrations (wraps Prisma)
153
+
154
+ **Deferred to v1.1+:**
155
+ - Code generators (`velox generate controller`, etc.)
156
+ - Database seeding command (`velox db:seed`)
157
+ - Migration rollback command
158
+ - Interactive project scaffolding
159
+ - Custom command plugins
160
+
161
+ ## Related Packages
162
+
163
+ - [@veloxts/core](/packages/core) - Core framework
164
+ - [@veloxts/router](/packages/router) - Procedure-based routing
165
+ - [@veloxts/orm](/packages/orm) - Prisma integration
166
+ - [create-velox-app](/packages/create) - Project scaffolder
167
+
168
+ ## TypeScript Support
169
+
170
+ All exports are fully typed with comprehensive JSDoc documentation. The package includes type definitions and declaration maps for excellent IDE support.
171
+
172
+ ## License
173
+
174
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * VeloxTS CLI - Main entry point
4
+ *
5
+ * A beautiful, Laravel-inspired command-line interface for the VeloxTS Framework
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG"}
package/dist/cli.js ADDED
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * VeloxTS CLI - Main entry point
4
+ *
5
+ * A beautiful, Laravel-inspired command-line interface for the VeloxTS Framework
6
+ */
7
+ import { Command } from 'commander';
8
+ import { createDevCommand } from './commands/dev.js';
9
+ import { createMigrateCommand } from './commands/migrate.js';
10
+ import { CLI_VERSION } from './index.js';
11
+ /**
12
+ * Create the main CLI program
13
+ */
14
+ function createCLI() {
15
+ const program = new Command();
16
+ program
17
+ .name('velox')
18
+ .description('VeloxTS Framework - Laravel-inspired TypeScript full-stack framework')
19
+ .version(CLI_VERSION, '-v, --version', 'Output the current version')
20
+ .helpOption('-h, --help', 'Display help for command');
21
+ // Register commands
22
+ program.addCommand(createDevCommand(CLI_VERSION));
23
+ program.addCommand(createMigrateCommand());
24
+ return program;
25
+ }
26
+ /**
27
+ * Main entry point
28
+ */
29
+ async function main() {
30
+ const program = createCLI();
31
+ try {
32
+ await program.parseAsync(process.argv);
33
+ }
34
+ catch (error) {
35
+ if (error instanceof Error) {
36
+ console.error(`Error: ${error.message}`);
37
+ }
38
+ else {
39
+ console.error('An unknown error occurred');
40
+ }
41
+ process.exit(1);
42
+ }
43
+ }
44
+ // Run the CLI
45
+ main();
46
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,SAAS,SAAS;IAChB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,OAAO,CAAC;SACb,WAAW,CAAC,sEAAsE,CAAC;SACnF,OAAO,CAAC,WAAW,EAAE,eAAe,EAAE,4BAA4B,CAAC;SACnE,UAAU,CAAC,YAAY,EAAE,0BAA0B,CAAC,CAAC;IAExD,oBAAoB;IACpB,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,WAAW,CAAC,CAAC,CAAC;IAClD,OAAO,CAAC,UAAU,CAAC,oBAAoB,EAAE,CAAC,CAAC;IAE3C,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,IAAI;IACjB,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAE5B,IAAI,CAAC;QACH,MAAM,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;QAC3C,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,2BAA2B,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,cAAc;AACd,IAAI,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Dev command - Start development server with hot reload
3
+ *
4
+ * Inspired by Laravel's `php artisan serve` and Vite's dev server
5
+ */
6
+ import { Command } from 'commander';
7
+ /**
8
+ * Create the dev command
9
+ */
10
+ export declare function createDevCommand(version: string): Command;
11
+ //# sourceMappingURL=dev.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.d.ts","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmBpC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CASzD"}
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Dev command - Start development server with hot reload
3
+ *
4
+ * Inspired by Laravel's `php artisan serve` and Vite's dev server
5
+ */
6
+ import { spawn } from 'node:child_process';
7
+ import * as p from '@clack/prompts';
8
+ import { Command } from 'commander';
9
+ import pc from 'picocolors';
10
+ import { error, formatCommand, formatPath, info, instruction, printBanner, } from '../utils/output.js';
11
+ import { findEntryPoint, isVeloxProject } from '../utils/paths.js';
12
+ /**
13
+ * Create the dev command
14
+ */
15
+ export function createDevCommand(version) {
16
+ return new Command('dev')
17
+ .description('Start the development server with hot reload')
18
+ .option('-p, --port <port>', 'Port to listen on', '3000')
19
+ .option('-H, --host <host>', 'Host to bind to', 'localhost')
20
+ .option('-e, --entry <file>', 'Entry point file (auto-detected if not specified)')
21
+ .action(async (options) => {
22
+ await runDevServer(options, version);
23
+ });
24
+ }
25
+ /**
26
+ * Run the development server
27
+ */
28
+ async function runDevServer(options, version) {
29
+ const s = p.spinner();
30
+ try {
31
+ // Check if we're in a VeloxTS project
32
+ s.start('Checking project...');
33
+ const isVelox = await isVeloxProject();
34
+ if (!isVelox) {
35
+ s.stop('Project check failed');
36
+ error('This does not appear to be a VeloxTS project.');
37
+ instruction(`Run ${formatCommand('npx create-velox-app')} to create a new project.`);
38
+ process.exit(1);
39
+ }
40
+ s.stop('Project validated');
41
+ // Find entry point
42
+ let entryPoint = options.entry;
43
+ if (!entryPoint) {
44
+ s.start('Detecting entry point...');
45
+ const detected = findEntryPoint();
46
+ if (!detected) {
47
+ s.stop('Entry point not found');
48
+ error('Could not find application entry point.');
49
+ instruction('Try specifying the entry point with --entry flag:');
50
+ console.log(` ${formatCommand('velox dev --entry src/index.ts')}`);
51
+ process.exit(1);
52
+ }
53
+ entryPoint = detected;
54
+ s.stop(`Entry point: ${formatPath(entryPoint)}`);
55
+ }
56
+ // Print startup banner
57
+ printBanner(version);
58
+ info('Starting development server...');
59
+ console.log('');
60
+ // Start the development server with tsx watch
61
+ const port = options.port || '3000';
62
+ const host = options.host || 'localhost';
63
+ // Set environment variables for the app
64
+ const env = {
65
+ ...process.env,
66
+ PORT: port,
67
+ HOST: host,
68
+ NODE_ENV: 'development',
69
+ };
70
+ // Spawn tsx in watch mode
71
+ const devProcess = spawn('npx', ['tsx', 'watch', entryPoint], {
72
+ stdio: 'inherit',
73
+ env,
74
+ shell: true,
75
+ });
76
+ // Handle process termination
77
+ let isShuttingDown = false;
78
+ const shutdown = (signal) => {
79
+ if (isShuttingDown)
80
+ return;
81
+ isShuttingDown = true;
82
+ console.log(`\n\n${pc.yellow('⚠')} ${pc.dim(`Received ${signal}, shutting down gracefully...`)}`);
83
+ devProcess.kill('SIGTERM');
84
+ // Force kill after 5 seconds if process doesn't exit
85
+ const forceKillTimeout = setTimeout(() => {
86
+ console.log(pc.red('✗ Force killing process...'));
87
+ devProcess.kill('SIGKILL');
88
+ process.exit(1);
89
+ }, 5000);
90
+ devProcess.on('exit', () => {
91
+ clearTimeout(forceKillTimeout);
92
+ console.log(pc.dim('Development server stopped.'));
93
+ process.exit(0);
94
+ });
95
+ };
96
+ // Handle Ctrl+C and other termination signals
97
+ process.on('SIGINT', () => shutdown('SIGINT'));
98
+ process.on('SIGTERM', () => shutdown('SIGTERM'));
99
+ // Handle dev process errors
100
+ devProcess.on('error', (err) => {
101
+ error(`Failed to start development server: ${err.message}`);
102
+ process.exit(1);
103
+ });
104
+ devProcess.on('exit', (code) => {
105
+ if (!isShuttingDown && code !== 0) {
106
+ error(`Development server exited with code ${code}`);
107
+ process.exit(code || 1);
108
+ }
109
+ });
110
+ }
111
+ catch (err) {
112
+ s.stop('Failed to start development server');
113
+ if (err instanceof Error) {
114
+ error(err.message);
115
+ // Provide helpful suggestions based on error
116
+ if (err.message.includes('EADDRINUSE')) {
117
+ instruction(`Port ${options.port} is already in use. Try a different port:`);
118
+ console.log(` ${formatCommand(`velox dev --port ${Number(options.port || 3000) + 1}`)}`);
119
+ }
120
+ else if (err.message.includes('EACCES')) {
121
+ instruction('Permission denied. Try using a port above 1024.');
122
+ }
123
+ }
124
+ else {
125
+ error('An unknown error occurred');
126
+ }
127
+ process.exit(1);
128
+ }
129
+ }
130
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAE3C,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,OAAO,EACL,KAAK,EACL,aAAa,EACb,UAAU,EACV,IAAI,EACJ,WAAW,EACX,WAAW,GACZ,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAQnE;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAe;IAC9C,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC;SACtB,WAAW,CAAC,8CAA8C,CAAC;SAC3D,MAAM,CAAC,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,CAAC;SACxD,MAAM,CAAC,mBAAmB,EAAE,iBAAiB,EAAE,WAAW,CAAC;SAC3D,MAAM,CAAC,oBAAoB,EAAE,mDAAmD,CAAC;SACjF,MAAM,CAAC,KAAK,EAAE,OAAmB,EAAE,EAAE;QACpC,MAAM,YAAY,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACP,CAAC;AAED;;GAEG;AACH,KAAK,UAAU,YAAY,CAAC,OAAmB,EAAE,OAAe;IAC9D,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC;IAEtB,IAAI,CAAC;QACH,sCAAsC;QACtC,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC;QAC/B,MAAM,OAAO,GAAG,MAAM,cAAc,EAAE,CAAC;QAEvC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,CAA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C;gBAC1C,WAAW,CAAC,iDAAiD,CAAC,CAAC;YACjE,CAAC;QACH,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Migrate command - Run database migrations
3
+ *
4
+ * Wrapper around Prisma migrations with beautiful Laravel-inspired output
5
+ */
6
+ import { Command } from 'commander';
7
+ /**
8
+ * Create the migrate command
9
+ */
10
+ export declare function createMigrateCommand(): Command;
11
+ //# sourceMappingURL=migrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.d.ts","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAWpC;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAQ9C"}
@@ -0,0 +1,132 @@
1
+ /**
2
+ * Migrate command - Run database migrations
3
+ *
4
+ * Wrapper around Prisma migrations with beautiful Laravel-inspired output
5
+ */
6
+ import { spawn } from 'node:child_process';
7
+ import path from 'node:path';
8
+ import * as p from '@clack/prompts';
9
+ import { Command } from 'commander';
10
+ import pc from 'picocolors';
11
+ import { error, formatCommand, info, instruction, success } from '../utils/output.js';
12
+ import { fileExists } from '../utils/paths.js';
13
+ /**
14
+ * Create the migrate command
15
+ */
16
+ export function createMigrateCommand() {
17
+ return new Command('migrate')
18
+ .description('Run database migrations')
19
+ .option('--deploy', 'Run migrations in production mode (prisma migrate deploy)')
20
+ .option('--force', 'Force push schema without migration (development only)')
21
+ .action(async (options) => {
22
+ await runMigrations(options);
23
+ });
24
+ }
25
+ /**
26
+ * Run database migrations
27
+ */
28
+ async function runMigrations(options) {
29
+ const s = p.spinner();
30
+ try {
31
+ // Check if Prisma schema exists
32
+ const schemaPath = path.join(process.cwd(), 'prisma', 'schema.prisma');
33
+ if (!fileExists(schemaPath)) {
34
+ error('Prisma schema not found.');
35
+ instruction('Expected to find prisma/schema.prisma in the current directory.');
36
+ instruction(`Initialize Prisma with: ${formatCommand('npx prisma init')}`);
37
+ process.exit(1);
38
+ }
39
+ // Determine which command to run
40
+ let command;
41
+ let description;
42
+ if (options.deploy) {
43
+ // Production: Apply pending migrations
44
+ command = ['prisma', 'migrate', 'deploy'];
45
+ description = 'Applying production migrations';
46
+ }
47
+ else if (options.force) {
48
+ // Development: Force push schema
49
+ command = ['prisma', 'db', 'push', '--skip-generate'];
50
+ description = 'Pushing database schema (development mode)';
51
+ }
52
+ else {
53
+ // Development: Push with generate
54
+ command = ['prisma', 'db', 'push'];
55
+ description = 'Synchronizing database schema';
56
+ }
57
+ info(description);
58
+ console.log('');
59
+ s.start('Running Prisma...');
60
+ // Run the Prisma command
61
+ await new Promise((resolve, reject) => {
62
+ const prismaProcess = spawn('npx', command, {
63
+ stdio: 'inherit',
64
+ shell: true,
65
+ env: process.env,
66
+ });
67
+ prismaProcess.on('error', (err) => {
68
+ reject(new Error(`Failed to run Prisma: ${err.message}`));
69
+ });
70
+ prismaProcess.on('exit', (code) => {
71
+ if (code === 0) {
72
+ resolve();
73
+ }
74
+ else {
75
+ reject(new Error(`Prisma exited with code ${code}`));
76
+ }
77
+ });
78
+ });
79
+ s.stop('Migration completed');
80
+ console.log('');
81
+ success('Database schema synchronized successfully!');
82
+ // Show next steps for production migrations
83
+ if (options.deploy) {
84
+ instruction('Your database is now up to date with the latest migrations.');
85
+ }
86
+ else {
87
+ console.log('');
88
+ info('Development tips:');
89
+ console.log(` ${pc.dim('•')} Use ${formatCommand('velox migrate')} to sync schema changes during development`);
90
+ console.log(` ${pc.dim('•')} Use ${formatCommand('velox migrate --deploy')} in production to apply migrations`);
91
+ console.log(` ${pc.dim('•')} Use ${formatCommand('npx prisma studio')} to explore your database`);
92
+ console.log('');
93
+ }
94
+ }
95
+ catch (err) {
96
+ s.stop('Migration failed');
97
+ console.log('');
98
+ if (err instanceof Error) {
99
+ error(err.message);
100
+ // Provide helpful suggestions based on error
101
+ if (err.message.includes('P1001')) {
102
+ instruction('Cannot reach database server. Check your connection:');
103
+ console.log(` ${pc.dim('1.')} Verify DATABASE_URL in .env file`);
104
+ console.log(` ${pc.dim('2.')} Ensure database server is running`);
105
+ console.log(` ${pc.dim('3.')} Check network connectivity`);
106
+ }
107
+ else if (err.message.includes('P3009')) {
108
+ instruction('Migration failed. Your changes may conflict with existing data.');
109
+ console.log(` ${pc.dim('•')} Review the Prisma error above`);
110
+ console.log(` ${pc.dim('•')} Consider creating a manual migration`);
111
+ }
112
+ else if (err.message.includes('P1003')) {
113
+ instruction('Database does not exist. Create it first:');
114
+ console.log(` ${pc.dim('•')} Check your DATABASE_URL`);
115
+ console.log(` ${pc.dim('•')} Create the database manually if needed`);
116
+ }
117
+ else {
118
+ instruction('Common solutions:');
119
+ console.log(` ${pc.dim('1.')} Check your DATABASE_URL in .env`);
120
+ console.log(` ${pc.dim('2.')} Ensure Prisma schema is valid: ${formatCommand('npx prisma validate')}`);
121
+ console.log(` ${pc.dim('3.')} Review Prisma logs above for specific errors`);
122
+ }
123
+ console.log('');
124
+ instruction(`For more help, see: ${pc.cyan('https://www.prisma.io/docs/reference/api-reference/command-reference')}`);
125
+ }
126
+ else {
127
+ error('An unknown error occurred');
128
+ }
129
+ process.exit(1);
130
+ }
131
+ }
132
+ //# sourceMappingURL=migrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrate.js","sourceRoot":"","sources":["../../src/commands/migrate.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,YAAY,CAAC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CAAC,IAAI,CAAC,sEAAsE,CAAC,EAAE,CACzG,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,2BAA2B,CAAC,CAAC;QACrC,CAAC;QAED,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @veloxts/cli - Developer tooling and command-line interface
3
+ *
4
+ * A beautiful, Laravel-inspired CLI for the VeloxTS Framework that provides
5
+ * commands for development, database migrations, and other developer workflows.
6
+ *
7
+ * @example
8
+ * ```bash
9
+ * # Start development server
10
+ * velox dev
11
+ *
12
+ * # Run database migrations
13
+ * velox migrate
14
+ *
15
+ * # Show help
16
+ * velox --help
17
+ * ```
18
+ */
19
+ /**
20
+ * CLI version (synchronized with package.json)
21
+ */
22
+ export declare const CLI_VERSION = "0.1.0";
23
+ /**
24
+ * Export command functions for programmatic usage
25
+ */
26
+ export { createDevCommand } from './commands/dev.js';
27
+ export { createMigrateCommand } from './commands/migrate.js';
28
+ /**
29
+ * Export utilities for reuse in other packages
30
+ */
31
+ export * from './utils/output.js';
32
+ export * from './utils/paths.js';
33
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AACH,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D;;GAEG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @veloxts/cli - Developer tooling and command-line interface
3
+ *
4
+ * A beautiful, Laravel-inspired CLI for the VeloxTS Framework that provides
5
+ * commands for development, database migrations, and other developer workflows.
6
+ *
7
+ * @example
8
+ * ```bash
9
+ * # Start development server
10
+ * velox dev
11
+ *
12
+ * # Run database migrations
13
+ * velox migrate
14
+ *
15
+ * # Show help
16
+ * velox --help
17
+ * ```
18
+ */
19
+ /**
20
+ * CLI version (synchronized with package.json)
21
+ */
22
+ export const CLI_VERSION = '0.1.0';
23
+ /**
24
+ * Export command functions for programmatic usage
25
+ */
26
+ export { createDevCommand } from './commands/dev.js';
27
+ export { createMigrateCommand } from './commands/migrate.js';
28
+ /**
29
+ * Export utilities for reuse in other packages
30
+ */
31
+ export * from './utils/output.js';
32
+ export * from './utils/paths.js';
33
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC;AAEnC;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D;;GAEG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Terminal output utilities
3
+ *
4
+ * Provides beautiful, Laravel-inspired terminal output formatting
5
+ */
6
+ /**
7
+ * Print a beautiful VeloxTS banner
8
+ */
9
+ export declare function printBanner(version: string): void;
10
+ /**
11
+ * Print server listening information
12
+ */
13
+ export declare function printServerInfo(url: string): void;
14
+ /**
15
+ * Print a success message
16
+ */
17
+ export declare function success(message: string): void;
18
+ /**
19
+ * Print an error message
20
+ */
21
+ export declare function error(message: string): void;
22
+ /**
23
+ * Print a warning message
24
+ */
25
+ export declare function warning(message: string): void;
26
+ /**
27
+ * Print an info message
28
+ */
29
+ export declare function info(message: string): void;
30
+ /**
31
+ * Print a step in a process
32
+ */
33
+ export declare function step(message: string): void;
34
+ /**
35
+ * Print instructions for user
36
+ */
37
+ export declare function instruction(message: string): void;
38
+ /**
39
+ * Format a file path for display
40
+ */
41
+ export declare function formatPath(path: string): string;
42
+ /**
43
+ * Format a command for display
44
+ */
45
+ export declare function formatCommand(command: string): string;
46
+ /**
47
+ * Format a URL for display
48
+ */
49
+ export declare function formatUrl(url: string): string;
50
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAIjD;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE3C;AAED;;GAEG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAE1C;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAErD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE7C"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Terminal output utilities
3
+ *
4
+ * Provides beautiful, Laravel-inspired terminal output formatting
5
+ */
6
+ import pc from 'picocolors';
7
+ /**
8
+ * Print a beautiful VeloxTS banner
9
+ */
10
+ export function printBanner(version) {
11
+ const divider = '═'.repeat(50);
12
+ console.log(`\n${pc.cyan(divider)}`);
13
+ console.log(pc.cyan(` VELOX ${pc.bold(`v${version}`)}`));
14
+ console.log(pc.cyan(divider));
15
+ }
16
+ /**
17
+ * Print server listening information
18
+ */
19
+ export function printServerInfo(url) {
20
+ console.log('');
21
+ console.log(` ${pc.green('➜')} Local: ${pc.cyan(url)}`);
22
+ console.log('');
23
+ }
24
+ /**
25
+ * Print a success message
26
+ */
27
+ export function success(message) {
28
+ console.log(`${pc.green('✓')} ${message}`);
29
+ }
30
+ /**
31
+ * Print an error message
32
+ */
33
+ export function error(message) {
34
+ console.error(`${pc.red('✗')} ${pc.red(message)}`);
35
+ }
36
+ /**
37
+ * Print a warning message
38
+ */
39
+ export function warning(message) {
40
+ console.warn(`${pc.yellow('⚠')} ${pc.yellow(message)}`);
41
+ }
42
+ /**
43
+ * Print an info message
44
+ */
45
+ export function info(message) {
46
+ console.log(`${pc.blue('ℹ')} ${message}`);
47
+ }
48
+ /**
49
+ * Print a step in a process
50
+ */
51
+ export function step(message) {
52
+ console.log(` ${pc.dim('→')} ${message}`);
53
+ }
54
+ /**
55
+ * Print instructions for user
56
+ */
57
+ export function instruction(message) {
58
+ console.log(`\n ${pc.dim(message)}\n`);
59
+ }
60
+ /**
61
+ * Format a file path for display
62
+ */
63
+ export function formatPath(path) {
64
+ return pc.cyan(path);
65
+ }
66
+ /**
67
+ * Format a command for display
68
+ */
69
+ export function formatCommand(command) {
70
+ return pc.cyan(command);
71
+ }
72
+ /**
73
+ * Format a URL for display
74
+ */
75
+ export function formatUrl(url) {
76
+ return pc.cyan(url);
77
+ }
78
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":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GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC5C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,OAAO,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACvB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Path utilities for finding project files
3
+ */
4
+ /**
5
+ * Find the project entry point
6
+ * Looks for common entry points in order of preference
7
+ */
8
+ export declare function findEntryPoint(cwd?: string): string | null;
9
+ /**
10
+ * Check if a file exists at the given path
11
+ */
12
+ export declare function fileExists(filePath: string): boolean;
13
+ /**
14
+ * Get the absolute path from a relative path
15
+ */
16
+ export declare function getAbsolutePath(relativePath: string, cwd?: string): string;
17
+ /**
18
+ * Check if we're in a VeloxTS project
19
+ * Looks for package.json with @veloxts dependencies
20
+ */
21
+ export declare function isVeloxProject(cwd?: string): Promise<boolean>;
22
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AAKH;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAWzE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,GAAE,MAAsB,GAAG,MAAM,CAEzF;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAAC,GAAG,GAAE,MAAsB,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBlF"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Path utilities for finding project files
3
+ */
4
+ import { existsSync } from 'node:fs';
5
+ import path from 'node:path';
6
+ /**
7
+ * Find the project entry point
8
+ * Looks for common entry points in order of preference
9
+ */
10
+ export function findEntryPoint(cwd = process.cwd()) {
11
+ const candidates = ['src/index.ts', 'src/main.ts', 'src/app.ts', 'index.ts', 'main.ts'];
12
+ for (const candidate of candidates) {
13
+ const fullPath = path.join(cwd, candidate);
14
+ if (existsSync(fullPath)) {
15
+ return fullPath;
16
+ }
17
+ }
18
+ return null;
19
+ }
20
+ /**
21
+ * Check if a file exists at the given path
22
+ */
23
+ export function fileExists(filePath) {
24
+ return existsSync(filePath);
25
+ }
26
+ /**
27
+ * Get the absolute path from a relative path
28
+ */
29
+ export function getAbsolutePath(relativePath, cwd = process.cwd()) {
30
+ return path.isAbsolute(relativePath) ? relativePath : path.join(cwd, relativePath);
31
+ }
32
+ /**
33
+ * Check if we're in a VeloxTS project
34
+ * Looks for package.json with @veloxts dependencies
35
+ */
36
+ export async function isVeloxProject(cwd = process.cwd()) {
37
+ const packageJsonPath = path.join(cwd, 'package.json');
38
+ if (!existsSync(packageJsonPath)) {
39
+ return false;
40
+ }
41
+ try {
42
+ const fs = await import('node:fs/promises');
43
+ const content = await fs.readFile(packageJsonPath, 'utf-8');
44
+ const pkg = JSON.parse(content);
45
+ // Check if any @veloxts packages are in dependencies
46
+ const deps = { ...pkg.dependencies, ...pkg.devDependencies };
47
+ return Object.keys(deps).some((dep) => dep.startsWith('@veloxts/'));
48
+ }
49
+ catch {
50
+ return false;
51
+ }
52
+ }
53
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../src/utils/paths.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IACxD,MAAM,UAAU,GAAG,CAAC,cAAc,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;IAExF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QAC3C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,YAAoB,EAAE,MAAc,OAAO,CAAC,GAAG,EAAE;IAC/E,OAAO,IAAI,CAAC,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;AACrF,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAAc,OAAO,CAAC,GAAG,EAAE;IAC9D,MAAM,eAAe,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;IAEvD,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,EAAE,CAAC;QACjC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,CAAC;QACH,MAAM,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,EAAE,CAAC,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;QAC5D,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAEhC,qDAAqD;QACrD,MAAM,IAAI,GAAG,EAAE,GAAG,GAAG,CAAC,YAAY,EAAE,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;QAC7D,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@veloxts/cli",
3
+ "version": "0.1.0",
4
+ "description": "Developer tooling and CLI commands for VeloxTS framework",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "bin": {
15
+ "velox": "dist/cli.js"
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "dependencies": {
22
+ "commander": "14.0.2",
23
+ "@clack/prompts": "0.11.0",
24
+ "picocolors": "1.1.1",
25
+ "tsx": "4.21.0",
26
+ "@veloxts/core": "0.1.0",
27
+ "@veloxts/router": "0.1.0",
28
+ "@veloxts/validation": "0.1.0",
29
+ "@veloxts/orm": "0.1.0",
30
+ "@veloxts/auth": "0.1.0"
31
+ },
32
+ "devDependencies": {
33
+ "@types/node": "24.10.1",
34
+ "typescript": "5.9.3"
35
+ },
36
+ "keywords": [
37
+ "velox",
38
+ "cli",
39
+ "dev",
40
+ "migrate",
41
+ "typescript"
42
+ ],
43
+ "license": "MIT",
44
+ "repository": {
45
+ "type": "git",
46
+ "url": "https://github.com/veloxts/velox-ts-framework",
47
+ "directory": "packages/cli"
48
+ },
49
+ "engines": {
50
+ "node": ">=20.0.0"
51
+ },
52
+ "publishConfig": {
53
+ "access": "public"
54
+ },
55
+ "scripts": {
56
+ "build": "tsc",
57
+ "dev": "tsc --watch",
58
+ "type-check": "tsc --noEmit",
59
+ "clean": "rm -rf dist tsconfig.tsbuildinfo"
60
+ }
61
+ }