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

@@ -5,7 +5,7 @@ components:
description: Caddy reverse proxy gateway
run:
runner: command
cwd: .
working_dir: .
argv:
- caddy
- run
@@ -26,7 +26,7 @@ components:
description: Content storage API
run:
runner: python_uv_tool
cwd: central-context
working_dir: central-context
env:
CENTRAL_CONTEXT_DATA_DIR: /data/castle/central-context
CENTRAL_CONTEXT_PORT: '9001'
@@ -47,7 +47,7 @@ components:
server.
run:
runner: python_uv_tool
cwd: notification-bridge
working_dir: notification-bridge
env:
CENTRAL_CONTEXT_URL: http://localhost:9001
BUCKET_NAME: notifications
@@ -67,7 +67,7 @@ components:
description: Castle API
run:
runner: python_uv_tool
cwd: castle-api
working_dir: castle-api
env:
CASTLE_API_CASTLE_ROOT: /data/repos/castle
tool: castle-api
@@ -85,7 +85,7 @@ components:
description: ProtonMail email sync via Bridge
run:
runner: command
cwd: protonmail
working_dir: protonmail
env:
PROTONMAIL_USERNAME: paul@payne.io
PROTONMAIL_API_KEY: ${secret:PROTONMAIL_API_KEY}
@@ -107,6 +107,7 @@ components:
description: Collect files from various sources into backup directory
run:
runner: command
working_dir: .
env:
DBACKUP: /data/backup
argv:
@@ -125,6 +126,7 @@ components:
description: Nightly restic backup of /data to /storage
run:
runner: command
working_dir: .
env:
RESTIC_REPOSITORY: /storage/restic-data
RESTIC_PASSWORD_FILE: /home/payne/.config/restic-password

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)