Skip to content

feat(studio): add --watch mode for studio sync target#161

Draft
revvy02 wants to merge 2 commits into
jackTabsCode:mainfrom
revvy02:feat-studio-watch
Draft

feat(studio): add --watch mode for studio sync target#161
revvy02 wants to merge 2 commits into
jackTabsCode:mainfrom
revvy02:feat-studio-watch

Conversation

@revvy02
Copy link
Copy Markdown
Contributor

@revvy02 revvy02 commented Apr 27, 2026

Note

This PR depends on #160 (the rbxasset prefix fix). Marked draft until that lands; will rebase onto main once it does. The first commit in this branch is identical to #160.

Summary

Adds a --watch flag to asphalt sync studio that performs an initial sync, then polls the input directories for added/modified/deleted files and re-syncs incrementally without restarting the process.

Motivation: when iterating on assets in Roblox Studio, re-running asphalt sync studio after every change is friction. Watch mode keeps codegen output and synced files up-to-date as you save.

Changes

  • cli: SyncTarget::Studio gains a watch: bool field; --watch flag exposed only on the studio subcommand.
  • sync: backend wrapped in Arc<Option<TargetBackend>> so the watch loop can share it across iterations.
  • studio backend: new ref_for_hash and clean_orphans helpers let the watch loop maintain state without re-running the full pipeline.
  • tests: studio_watch_detects_new_file integration test that spawns watch mode, adds a file, and verifies codegen picks it up.

Usage

asphalt sync studio --watch

Polls every 500ms (matching the existing notify defaults). Ctrl+C to stop.

Test plan

  • cargo build clean
  • cargo test — 12/12 integration pass (including the new watch test)
  • Manually exercised on a local project: edit a .png, codegen output and synced file update within ~1s

revvy02 added 2 commits April 27, 2026 02:16
The Display impl for AssetRef already prepends "rbxasset://" for Studio
and "rbxassetid://" for Cloud variants. The studio backend was packing
those prefixes inside the inner string, causing codegen to emit doubled
URLs like:

  ["test1.png"] = "rbxasset://rbxasset://.asphalt-name/<hash>.png"

For cloud-uploaded models/animations, return AssetRef::Cloud(id) so the
correct "rbxassetid://{id}" is produced. For locally synced files, drop
the "rbxasset://" prefix from the inner string so Display adds it once.

Also adds an ASPHALT_TEST env var that routes the sync folder to the
project directory instead of the Roblox Studio content path. This is
test-only plumbing that lets the integration test exercise sync studio
without requiring a Roblox Studio install. The common test harness
already sets this env var in Project::run().

Includes a regression test (studio_sync_emits_single_rbxasset_prefix)
that fails on the previous behavior.
Adds a `--watch` flag to `asphalt sync studio` that performs an initial
sync, then polls the input directories for added/modified/deleted files
and re-syncs incrementally without restarting the process.

- cli: SyncTarget::Studio gains a `watch: bool` field
- sync: backend wrapped in Arc so the watch loop can share it across
  iterations
- studio backend: new ASPHALT_TEST env var routes the sync folder to
  the project dir for integration tests; ref_for_hash and clean_orphans
  helpers let the watch loop maintain state without re-running the full
  pipeline
- tests: studio_watch_detects_new_file integration test
@revvy02 revvy02 force-pushed the feat-studio-watch branch from b3ef85a to 6dd6c62 Compare April 27, 2026 07:17
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.

1 participant