or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

build-system.mdcli-commands.mdconfiguration.mddevelopment-server.mdindex.mdroute-management.mdvite-integration.md

cli-commands.mddocs/

0

# CLI Commands

1

2

Complete command-line interface for Remix project management including project initialization, development server, build system, and route inspection.

3

4

## Capabilities

5

6

### CLI Runner

7

8

Main CLI entry point that processes command-line arguments and executes appropriate commands.

9

10

```typescript { .api }

11

/**

12

* Main CLI runner function that processes command-line arguments

13

* Access via: import * as cli from "@remix-run/dev"

14

* @returns Promise that resolves when CLI execution completes

15

*/

16

function run(): Promise<void>;

17

```

18

19

### Project Initialization

20

21

Initialize a new Remix project by running the `remix.init` script if present.

22

23

```typescript { .api }

24

/**

25

* Initialize Remix project with remix.init script

26

* @param projectDir - Directory containing the project

27

* @param options - Initialization options

28

* @returns Promise that resolves when initialization completes

29

*/

30

function init(projectDir: string, options?: InitFlags): Promise<void>;

31

32

interface InitFlags {

33

/** Whether to delete the remix.init script after execution */

34

deleteScript?: boolean;

35

}

36

```

37

38

**Usage Example:**

39

40

```bash

41

# Initialize project in current directory

42

npx remix init

43

44

# Initialize project in specific directory

45

npx remix init ./my-project

46

47

# Initialize without deleting remix.init script

48

npx remix init --no-delete

49

```

50

51

### Route Information

52

53

Display route information in various formats for debugging and documentation.

54

55

```typescript { .api }

56

/**

57

* Display route information for the Remix project

58

* @param remixRoot - Root directory of Remix project

59

* @param flags - Route display options

60

* @returns Promise that resolves when route information is displayed

61

*/

62

function routes(remixRoot?: string, flags?: RoutesFlags): Promise<void>;

63

64

interface RoutesFlags {

65

/** Path to configuration file */

66

config?: string;

67

/** Output routes as JSON */

68

json?: boolean;

69

}

70

```

71

72

**Usage Examples:**

73

74

```bash

75

# Display routes as tree structure

76

npx remix routes

77

78

# Output routes as JSON

79

npx remix routes --json

80

81

# Use specific config file

82

npx remix routes --config vite.config.dev.ts

83

```

84

85

### Development Commands

86

87

Start development server and build processes for local development.

88

89

```bash

90

# Modern Vite-based development (recommended)

91

npx remix vite:dev [projectDir]

92

93

# Modern Vite-based build (recommended)

94

npx remix vite:build [projectDir]

95

96

# Legacy development server

97

npx remix dev [projectDir]

98

99

# Legacy build system

100

npx remix build [projectDir]

101

102

# Watch mode for development

103

npx remix watch [projectDir]

104

```

105

106

### Build Commands

107

108

Production build commands for creating optimized bundles.

109

110

```typescript { .api }

111

/**

112

* Build production bundles using the compiler

113

* @param remixRoot - Root directory of Remix project

114

* @param mode - Build mode (development/production)

115

* @param sourcemap - Generate source maps

116

* @returns Promise that resolves when build completes

117

*/

118

function build(remixRoot: string, mode?: string, sourcemap?: boolean): Promise<void>;

119

120

/**

121

* Build production bundles using Vite

122

* @param root - Root directory of project

123

* @param options - Vite build options

124

* @returns Promise that resolves when build completes

125

*/

126

function viteBuild(root?: string, options?: ViteBuildOptions): Promise<void>;

127

128

interface ViteBuildOptions {

129

assetsInlineLimit?: number;

130

clearScreen?: boolean;

131

config?: string;

132

emptyOutDir?: boolean;

133

logLevel?: "info" | "warn" | "error" | "silent";

134

minify?: boolean | "terser" | "esbuild";

135

mode?: string;

136

profile?: boolean;

137

sourcemap?: boolean | "inline" | "hidden";

138

target?: string | string[];

139

watch?: object;

140

}

141

```

142

143

### Development Server Commands

144

145

Start development servers with live reload and HMR capabilities.

146

147

```typescript { .api }

148

/**

149

* Start development server

150

* @param remixRoot - Root directory of Remix project

151

* @param flags - Development server options

152

* @returns Promise that resolves when server stops

153

*/

154

function dev(remixRoot: string, flags?: DevFlags): Promise<void>;

155

156

/**

157

* Start Vite development server

158

* @param root - Root directory of project

159

* @param options - Vite development options

160

* @returns Promise that resolves when server stops

161

*/

162

function viteDev(root: string, options?: ViteDevOptions): Promise<void>;

163

164

/**

165

* Watch for changes and rebuild

166

* @param remixRootOrConfig - Root directory or config object

167

* @param mode - Build mode

168

* @returns Promise that resolves when watch stops

169

*/

170

function watch(remixRootOrConfig: string | RemixConfig, mode?: string): Promise<void>;

171

172

interface DevFlags {

173

/** Custom command to run */

174

command?: string;

175

/** Manual mode - don't auto-restart on changes */

176

manual?: boolean;

177

/** Development server port */

178

port?: number;

179

/** Path to TLS key file */

180

tlsKey?: string;

181

/** Path to TLS certificate file */

182

tlsCert?: string;

183

}

184

185

interface ViteDevOptions {

186

clearScreen?: boolean;

187

config?: string;

188

cors?: boolean;

189

force?: boolean;

190

host?: string | boolean;

191

logLevel?: "info" | "warn" | "error" | "silent";

192

mode?: string;

193

open?: boolean | string;

194

port?: number;

195

profile?: boolean;

196

strictPort?: boolean;

197

}

198

```

199

200

### Watch Mode

201

202

Continuous compilation during development with file watching. The watch function is already defined above in the Development Server Commands section.

203

204

### Entry File Generation

205

206

Generate entry files for client and server sides of Remix applications.

207

208

```typescript { .api }

209

/**

210

* Generate entry files for Remix applications

211

* @param entry - Entry type ("entry.client" | "entry.server" | "" for both)

212

* @param remixRoot - Root directory of Remix project

213

* @param flags - Generation options

214

* @returns Promise that resolves when generation completes

215

*/

216

function generateEntry(entry: string, remixRoot: string, flags?: GenerateEntryFlags): Promise<void>;

217

218

interface GenerateEntryFlags {

219

/** Generate TypeScript files */

220

typescript?: boolean;

221

/** Path to configuration file */

222

config?: string;

223

}

224

```

225

226

### Utility Commands

227

228

Additional CLI utilities for project management.

229

230

```typescript { .api }

231

/**

232

* Setup command (deprecated in v2, no-op)

233

* @deprecated No longer necessary as of v2

234

*/

235

function setup(): void;

236

```

237

238

## CLI Options

239

240

Global CLI options available across all commands:

241

242

- `--help, -h` - Print help message and exit

243

- `--version, -v` - Print CLI version and exit

244

- `--no-color` - Disable ANSI colors in console output

245

246

### Vite Build Options

247

248

Options passed through to Vite for `vite:build` command:

249

250

- `--assetsInlineLimit` - Static asset base64 inline threshold (default: 4096)

251

- `--clearScreen` - Allow/disable clear screen when logging

252

- `--config, -c` - Use specified config file

253

- `--emptyOutDir` - Force empty outDir when outside of root

254

- `--logLevel, -l` - Log level: info | warn | error | silent

255

- `--minify` - Enable/disable minification (default: "esbuild")

256

- `--mode, -m` - Set env mode

257

- `--profile` - Start built-in Node.js inspector

258

- `--sourcemapClient` - Output source maps for client build

259

- `--sourcemapServer` - Output source maps for server build

260

261

### Vite Dev Options

262

263

Options passed through to Vite for `vite:dev` command:

264

265

- `--clearScreen` - Allow/disable clear screen when logging

266

- `--config, -c` - Use specified config file

267

- `--cors` - Enable CORS

268

- `--force` - Force optimizer to ignore cache

269

- `--host` - Specify hostname

270

- `--logLevel, -l` - Log level: info | warn | error | silent

271

- `--mode, -m` - Set env mode

272

- `--open` - Open browser on startup

273

- `--port` - Specify port

274

- `--profile` - Start built-in Node.js inspector

275

- `--strictPort` - Exit if specified port is in use

276

277

**Usage Examples:**

278

279

```bash

280

# Development with custom port and host

281

npx remix vite:dev --port 4000 --host 0.0.0.0

282

283

# Production build with source maps

284

npx remix vite:build --sourcemapClient --sourcemapServer

285

286

# Build with custom config

287

npx remix vite:build --config vite.config.prod.ts

288

289

# Development with debugging

290

npx remix dev --port 3001 --debug

291

292

# Watch mode with specific server mode

293

npx remix watch --mode production

294

```