fix: update 'cwd' to 'working_dir' in run specifications for consistency

This commit is contained in:
2026-02-21 01:34:56 -08:00
parent bb367ab632
commit bb9fbd8ca4
7 changed files with 18 additions and 16 deletions

View File

@@ -14,7 +14,7 @@ def _get_project_dir(config: CastleConfig, project_name: str) -> Path:
if project_name not in config.components:
raise ValueError(f"Unknown component: {project_name}")
manifest = config.components[project_name]
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
working_dir = cwd or project_name
return config.root / working_dir
@@ -59,7 +59,7 @@ def run_test(args: argparse.Namespace) -> int:
# Run all
all_passed = True
for name, manifest in config.components.items():
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
working_dir = cwd or name
project_dir = config.root / working_dir
tests_dir = project_dir / "tests"
@@ -98,7 +98,7 @@ def run_lint(args: argparse.Namespace) -> int:
# Run all
all_passed = True
for name, manifest in config.components.items():
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
working_dir = cwd or name
project_dir = config.root / working_dir
if not _has_pyproject(project_dir):

View File

@@ -29,7 +29,7 @@ def run_info(args: argparse.Namespace) -> int:
if getattr(args, "json", False):
data = manifest.model_dump(exclude_none=True)
# Include CLAUDE.md content if it exists
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
claude_md = _find_claude_md(config.root, cwd or name)
if claude_md:
data["claude_md"] = claude_md
@@ -46,8 +46,8 @@ def run_info(args: argparse.Namespace) -> int:
# Run spec
if manifest.run:
print(f" {BOLD}runner{RESET}: {manifest.run.runner}")
if manifest.run.cwd:
print(f" {BOLD}cwd{RESET}: {manifest.run.cwd}")
if manifest.run.working_dir:
print(f" {BOLD}working_dir{RESET}: {manifest.run.working_dir}")
if hasattr(manifest.run, "tool"):
print(f" {BOLD}tool{RESET}: {manifest.run.tool}")
elif hasattr(manifest.run, "argv"):
@@ -105,7 +105,7 @@ def run_info(args: argparse.Namespace) -> int:
print(f" - {cap.type}" + (f" ({cap.name})" if cap.name else ""))
# Show CLAUDE.md if it exists
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
claude_md = _find_claude_md(config.root, cwd or name)
if claude_md:
print(f"\n{BOLD}{CYAN}CLAUDE.md{RESET}")

View File

@@ -35,7 +35,7 @@ def run_run(args: argparse.Namespace) -> int:
return 1
# Working directory
cwd = config.root / (run.cwd or name)
cwd = config.root / (run.working_dir or name)
if not cwd.exists():
print(f"Error: working directory '{cwd}' does not exist")
return 1

View File

@@ -144,7 +144,7 @@ def _generate_unit(config: CastleConfig, name: str, manifest: ComponentManifest)
if run is None:
raise ValueError(f"Component '{name}' has no run spec")
working_dir = config.root / (run.cwd or name)
working_dir = config.root / (run.working_dir or name)
exec_start = _manifest_to_exec_start(manifest, config.root)
resolved_env = resolve_env_vars(run.env, manifest)

View File

@@ -28,7 +28,7 @@ def run_sync(args: argparse.Namespace) -> int:
all_ok = True
synced_dirs: set[Path] = set()
for name, manifest in config.components.items():
cwd = manifest.run.cwd if manifest.run else None
cwd = manifest.run.working_dir if manifest.run else None
working_dir = cwd or name
project_dir = config.root / working_dir
pyproject = project_dir / "pyproject.toml"

View File

@@ -39,7 +39,7 @@ class Role(str, Enum):
class RunBase(BaseModel):
runner: str
cwd: str | None = None
working_dir: str | None = None
env: EnvMap = Field(default_factory=dict)