or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

advanced.mdci.mdindex.mdprojects.mdsetup.mdtasks.md

tasks.mddocs/

0

# Task Execution

1

2

Comprehensive task execution system with dependency resolution, caching, and advanced filtering capabilities.

3

4

## Capabilities

5

6

### Run Tasks

7

8

Execute tasks across projects with intelligent dependency resolution and caching.

9

10

```bash { .api }

11

/**

12

* Run one or many targets and their dependencies in topological order

13

* Provides intelligent caching and parallel execution

14

*/

15

moon run <...targets> [-- <args>]

16

17

# Aliases:

18

moon r <...targets>

19

moonx <...targets>

20

21

# Target Format Patterns:

22

# project:task Run specific task in specific project

23

# :task Run task in all projects

24

# #tag:task Run task in projects with specified tag

25

# task Run task in closest project (based on current directory)

26

27

# Arguments:

28

# <...targets> One or more target patterns to execute

29

# [-- <args>] Additional arguments passed to underlying command

30

31

# Core Options:

32

-f, --force Force run ignoring touched files and affected status

33

--dependents Run downstream dependent targets as well

34

-i, --interactive Run target in interactive mode

35

--query <statement> Filter projects using query language

36

-s, --summary Display summary and stats of the run

37

-u, --updateCache Bypass cache and force update existing items

38

--no-actions Run task without other pipeline actions

39

-n, --no-bail Continue executing tasks instead of aborting on failure

40

41

# Debugging Options:

42

--profile <type> Record and generate profile (cpu, heap)

43

44

# Affected Options:

45

--affected Only run if affected by changed files

46

--remote Determine affected against remote (default branch)

47

--status <type> Filter affected by change status

48

--stdin Accept touched files from stdin for affected checks

49

```

50

51

**Usage Examples:**

52

53

```bash

54

# Run specific task in specific project

55

moon run app:build

56

57

# Run task across all projects

58

moon run :test

59

60

# Run multiple tasks

61

moon run app:build server:test

62

63

# Run task in projects with tag

64

moon run '#frontend:build'

65

66

# Run with query filtering

67

moon run :build --query "language=javascript"

68

69

# Force run ignoring cache

70

moon run app:build --force

71

72

# Run with summary output

73

moon run :test --summary

74

75

# Continue on failures (useful for pre-commit)

76

moon run :lint --no-bail

77

78

# Run only affected by changes

79

moon run :test --affected

80

81

# Pass additional arguments to underlying command

82

moon run app:serve -- --port 3000 --host 0.0.0.0

83

```

84

85

### Query Language

86

87

Advanced project filtering using query statements.

88

89

```bash { .api }

90

/**

91

* Query language for filtering projects and tasks

92

* Supports logical operators and various criteria

93

*/

94

--query <statement>

95

96

# Query Operators:

97

# && Logical AND

98

# || Logical OR

99

# ! Logical NOT

100

# () Grouping

101

102

# Query Criteria:

103

# language=<lang> Filter by programming language

104

# projectType=<type> Filter by project type (application, library, tool)

105

# tag=<tag> Filter by project tag

106

# project~<pattern> Filter by project name pattern

107

# projectSource~<path> Filter by project source path pattern

108

```

109

110

**Query Examples:**

111

112

```bash

113

# TypeScript applications only

114

moon run :build --query "language=typescript && projectType=application"

115

116

# Projects with React in the name

117

moon run :test --query "project~react-*"

118

119

# Frontend tagged projects or libraries

120

moon run :lint --query "tag=frontend || projectType=library"

121

122

# Projects in packages directory

123

moon run :build --query "projectSource~packages/*"

124

```

125

126

### Task Graph Analysis

127

128

Visualize and analyze task dependencies before execution.

129

130

```bash { .api }

131

/**

132

* Display task dependency graph for analysis

133

* Shows execution order and dependencies

134

*/

135

moon task-graph <...targets>

136

137

# Options:

138

--dot Output in DOT format for Graphviz

139

--json Output in JSON format for programmatic use

140

```

141

142

**Usage Examples:**

143

144

```bash

145

# Show task graph for build

146

moon task-graph app:build

147

148

# Generate DOT format for visualization

149

moon task-graph :test --dot > tasks.dot

150

151

# JSON format for scripting

152

moon task-graph app:build --json | jq '.nodes'

153

```

154

155

### Action Graph Analysis

156

157

View the complete action graph including tasks and other pipeline actions.

158

159

```bash { .api }

160

/**

161

* Display action graph that would be executed

162

* Includes tasks, dependency installations, and other actions

163

*/

164

moon action-graph <...targets>

165

# Alias: moon ag

166

167

# Options:

168

--dot Output in DOT format

169

--json Output in JSON format

170

```

171

172

### Task Information

173

174

Get detailed information about specific tasks.

175

176

```bash { .api }

177

/**

178

* Display detailed information about a specific task

179

* Shows configuration, dependencies, and metadata

180

*/

181

moon task <target>

182

# Alias: moon t

183

184

# Arguments:

185

# <target> Task target in project:task format

186

187

# Options:

188

--json Output in JSON format

189

```

190

191

**Usage Examples:**

192

193

```bash

194

# Get task information

195

moon task app:build

196

197

# JSON output for scripting

198

moon task app:build --json

199

```

200

201

### Affected File Detection

202

203

Determine which projects and tasks are affected by file changes.

204

205

```bash { .api }

206

# Change Status Types:

207

# all All changes (default)

208

# added Newly added files

209

# deleted Deleted files

210

# modified Modified files

211

# staged Files staged for commit

212

# unstaged Unstaged changes

213

# untracked Untracked files

214

215

# Environment Variables:

216

MOON_BASE=<revision> Base revision for comparison (default: main branch)

217

MOON_HEAD=<revision> Head revision for comparison (default: HEAD)

218

```

219

220

**Affected Examples:**

221

222

```bash

223

# Run tests only for affected projects

224

moon run :test --affected

225

226

# Check affected against remote branch

227

moon run :test --affected --remote

228

229

# Filter by specific change types

230

moon run :lint --affected --status modified --status added

231

232

# Custom revision comparison

233

MOON_BASE=develop MOON_HEAD=feature-branch moon run :test --affected

234

```

235

236

### Interactive Mode

237

238

Run tasks with interactive input/output capabilities.

239

240

```bash { .api }

241

/**

242

* Interactive mode for tasks requiring user input

243

* Preserves stdin/stdout for interactive commands

244

*/

245

moon run <target> --interactive

246

247

# Use cases:

248

# - Interactive test runners (Jest watch mode)

249

# - Development servers requiring input

250

# - CLI tools with prompts

251

# - Debugging sessions

252

```

253

254

## Performance and Caching

255

256

### Cache Control

257

258

Fine-grained control over caching behavior.

259

260

```bash { .api }

261

# Cache Modes (via --cache or MOON_CACHE):

262

# off Disable caching entirely

263

# read Read from cache but don't write

264

# read-write Normal caching behavior (default)

265

# write Write to cache but don't read

266

267

# Update cache for specific runs

268

moon run app:build --updateCache

269

270

# Disable caching for debugging

271

moon run app:test --cache off

272

```

273

274

### Concurrency Control

275

276

Control parallel execution and resource usage.

277

278

```bash { .api }

279

# Set maximum concurrent tasks

280

moon run :build --concurrency 4

281

282

# Environment variable

283

MOON_CONCURRENCY=2 moon run :test

284

```

285

286

## Error Handling

287

288

Task execution error handling and recovery:

289

290

- **Task Failures**: By default, moon fails fast on first task failure

291

- **Bail Control**: Use `--no-bail` to continue executing safe tasks after failures

292

- **Dependency Failures**: Downstream tasks are automatically skipped when dependencies fail

293

- **Interactive Tasks**: Some tasks require `--interactive` flag for proper input/output handling

294

- **Cache Issues**: Use `--cache off` or `--updateCache` to bypass cache-related problems