Skip to content

feat: watch sources of dependencies#9437

Merged
jdx merged 3 commits intojdx:mainfrom
43081j:watch-deps
Apr 29, 2026
Merged

feat: watch sources of dependencies#9437
jdx merged 3 commits intojdx:mainfrom
43081j:watch-deps

Conversation

@43081j
Copy link
Copy Markdown

@43081j 43081j commented Apr 27, 2026

This changes the watch logic to watch sources of the chosen task's dependencies as well as its own sources.

If you set skip_deps, we follow the old behaviour and only watch the task's own sources.

If you want this implemented some other way, let me know as i'm happy to rework as needed. The lack of this currently means the watch task is often too "dumb" (unaware of the graph) to be useful. If we can give it context, it means dev servers and other long running tasks become a lot more useful.

If you're not interested, let me know and we can close 👍

This changes the watch logic to watch sources of the chosen task's
dependencies as well as its own sources.

If you set `skip_deps`, we follow the old behaviour and only watch the
task's own sources.
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the watch command to include task dependencies when determining which files to monitor. It introduces a skip_deps check and uses the Deps utility to aggregate sources from all relevant tasks. Feedback suggests optimizing the glob collection by deduplicating source patterns and using more efficient iterator patterns to avoid unnecessary allocations.

Comment thread src/cli/watch.rs
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 27, 2026

Greptile Summary

This PR extends mise watch to watch the source files of all transitive dependencies (not just the root task's sources) when --skip-deps is not set. It achieves this by calling Deps::new() to build the full dependency graph and collecting .sources globs from every node via deps.all(). The old behavior (only root task sources) is preserved when --skip-deps is explicitly provided, and explicit --glob flags still take top priority.

Confidence Score: 5/5

Safe to merge — the change is additive, backward-compatible, and follows existing patterns.

No P0 or P1 issues found. The logic inversion (!self.glob.is_empty()) is correct, skip_deps correctly preserves prior behaviour, Deps::new is an existing constructor already used for the same task graph resolution elsewhere, and .unique() is a harmless deduplication improvement. tasks.clone() ensures the owned tasks vec is still available for the later task_args construction.

No files require special attention.

Important Files Changed

Filename Overview
src/cli/watch.rs Refactors globs selection to support three cases: explicit --glob override, --skip-deps (root-task sources only), and the new default (all transitive-dependency sources via Deps::new); also adds .unique() deduplication to the skip_deps branch.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[mise watch starts] --> B{--glob provided?}
    B -- Yes --> C[Use --glob patterns directly]
    B -- No --> D{--skip-deps set?}
    D -- Yes --> E[Collect sources from root tasks only]
    D -- No --> F[Deps::new - build full dependency graph]
    F --> G[deps.all - iterate all nodes including transitive deps]
    G --> H[Collect and deduplicate all sources]
    E --> I[unique deduplicate]
    C --> J[Pass -f globs to watchexec]
    I --> J
    H --> J
    J --> K[watchexec watches files and re-runs mise run on change]
Loading

Reviews (3): Last reviewed commit: "Merge branch 'main' into watch-deps" | Re-trigger Greptile

Comment thread src/cli/watch.rs
@jdx jdx enabled auto-merge (squash) April 29, 2026 14:49
@jdx jdx merged commit c23fb12 into jdx:main Apr 29, 2026
34 checks passed
@43081j 43081j deleted the watch-deps branch April 29, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants