tilt-dev / tilt-dev/tilt

running a script via `local` and also watching that script for changes should be the standard

Open
#2,963 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
10.1k
Forks
413
Avg merge
1d 10h
Merged PRs (30d)
6

Description

Problem

Many users run a script via local, but then don't call watch_file on that script, which means the Tiltfile doesn't execute when the script changes, which makes iterating on it rather less pleasant (and is then exacerbated by #2957) (let's call these "unaware" users...no judgement!)

Or, even if they do call watch_file on the script, they have to write, e.g.:

local('./myscript.sh)
watch_file('myscript.sh')

which just feels silly. (let's call these "aware" users)

Potential solution:
add a "watch_first_arg" arg to local, where if True, we split the command by space and watch the first string we get back.
If we default it to False, it only helps the aware user above. Defaulting it to True seems relatively risk-free and helps the unaware user above.
(maybe we only do this if the command exists? so we don't end up watching shell builtins or things on the path, which would still be harmless, but might be annoying if we expose watchlists elsewhere - or we just keep this option in mind for when we do expose watchlists)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and tests for the local and watch_file Tiltfile functions, then trace how file watches are registered. Define the behavior for the proposed first-argument watching, including commands that do not name an existing file, and add tests showing when the Tiltfile re-executes after the script changes.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.