ReMe/reme/steps/index/_watch_rules.py
jinliyl 54fa3381d7
Some checks failed
CI and Release / Docker / Build and test / amd64 (push) Has been cancelled
CI and Release / Docker / Build and test / arm64 (push) Has been cancelled
Security / CodeQL / Analyze python (push) Has been cancelled
CI / Python quality / Pre-commit (push) Has been cancelled
CI / Python tests / Unit Tests - py3.12 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.13 (push) Has been cancelled
CI / Python tests / Unit Tests - py3.14 (push) Has been cancelled
CI / Python packages / Build and verify distributions (push) Has been cancelled
CI / Python quality / GitHub Actions (push) Has been cancelled
CI / Python tests / Hermes embedded - ubuntu-latest (push) Has been cancelled
CI / Python tests / Hermes embedded - windows-latest (push) Has been cancelled
CI / Python tests / Unit Tests - py3.11 (push) Has been cancelled
CI / ReMe Studio / Studio checks (push) Has been cancelled
Deploy / Documentation / Build documentation (push) Has been cancelled
CI / Windows / CLI smoke - py3.11 (push) Has been cancelled
Security / CodeQL / Analyze javascript-typescript (push) Has been cancelled
CI and Release / Docker / Publish multi-platform tags (push) Has been cancelled
Deploy / Documentation / deploy (push) Has been cancelled
refactor(core): reorganize the ReMe runtime and shared helpers (#769)
* refactor(core): reorganize the ReMe runtime and shared helpers

* test(status): import the base component from its canonical module

* test: remove redundant unit checks

* refactor(core): use canonical runtime imports and shared CLI discovery

Restore evolve behavior to the base branch and update its imports. Use Application as the runtime entry point and encode SSE in the HTTP service.

* fix(cli): honor caller config when service replay is incomplete

Use partial startup overrides for port probes and resolve named configs before requesting the service process working directory.
2026-11-20 22:06:46 +08:00

36 lines
1.2 KiB
Python

"""Resolve watch rules from Job inputs or the selected catalog."""
from pathlib import Path
from typing import TYPE_CHECKING
from ...utils.files.file_watch import WatchRule, build_watch_rules
if TYPE_CHECKING:
from ...schema import ApplicationConfig
from ...components.file_catalog import BaseFileCatalog
from ...core.context import RuntimeContext
def build_context_watch_rules(
app_config: "ApplicationConfig | None",
workspace_path: Path,
context: "RuntimeContext",
catalog: "BaseFileCatalog | None" = None,
) -> list[WatchRule]:
"""Keep explicit Job rules; otherwise use the selected catalog's shared scope."""
if "watch_dirs" not in context and catalog is not None:
return catalog.watch_rules
if app_config is None:
return []
watch_dirs: list[str] = context.get("watch_dirs", [])
watch_suffixes: list[str] = context.get("watch_suffixes", [])
watch_filenames: list[str] = context.get("watch_filenames", [])
if not watch_dirs:
return []
return build_watch_rules(
app_config,
workspace_path,
watch_dirs=watch_dirs,
watch_suffixes=watch_suffixes,
watch_filenames=watch_filenames,
)