fix: update 'cwd' to 'working_dir' in run specifications for consistency
This commit is contained in:
12
castle.yaml
12
castle.yaml
@@ -5,7 +5,7 @@ components:
|
|||||||
description: Caddy reverse proxy gateway
|
description: Caddy reverse proxy gateway
|
||||||
run:
|
run:
|
||||||
runner: command
|
runner: command
|
||||||
cwd: .
|
working_dir: .
|
||||||
argv:
|
argv:
|
||||||
- caddy
|
- caddy
|
||||||
- run
|
- run
|
||||||
@@ -26,7 +26,7 @@ components:
|
|||||||
description: Content storage API
|
description: Content storage API
|
||||||
run:
|
run:
|
||||||
runner: python_uv_tool
|
runner: python_uv_tool
|
||||||
cwd: central-context
|
working_dir: central-context
|
||||||
env:
|
env:
|
||||||
CENTRAL_CONTEXT_DATA_DIR: /data/castle/central-context
|
CENTRAL_CONTEXT_DATA_DIR: /data/castle/central-context
|
||||||
CENTRAL_CONTEXT_PORT: '9001'
|
CENTRAL_CONTEXT_PORT: '9001'
|
||||||
@@ -47,7 +47,7 @@ components:
|
|||||||
server.
|
server.
|
||||||
run:
|
run:
|
||||||
runner: python_uv_tool
|
runner: python_uv_tool
|
||||||
cwd: notification-bridge
|
working_dir: notification-bridge
|
||||||
env:
|
env:
|
||||||
CENTRAL_CONTEXT_URL: http://localhost:9001
|
CENTRAL_CONTEXT_URL: http://localhost:9001
|
||||||
BUCKET_NAME: notifications
|
BUCKET_NAME: notifications
|
||||||
@@ -67,7 +67,7 @@ components:
|
|||||||
description: Castle API
|
description: Castle API
|
||||||
run:
|
run:
|
||||||
runner: python_uv_tool
|
runner: python_uv_tool
|
||||||
cwd: castle-api
|
working_dir: castle-api
|
||||||
env:
|
env:
|
||||||
CASTLE_API_CASTLE_ROOT: /data/repos/castle
|
CASTLE_API_CASTLE_ROOT: /data/repos/castle
|
||||||
tool: castle-api
|
tool: castle-api
|
||||||
@@ -85,7 +85,7 @@ components:
|
|||||||
description: ProtonMail email sync via Bridge
|
description: ProtonMail email sync via Bridge
|
||||||
run:
|
run:
|
||||||
runner: command
|
runner: command
|
||||||
cwd: protonmail
|
working_dir: protonmail
|
||||||
env:
|
env:
|
||||||
PROTONMAIL_USERNAME: paul@payne.io
|
PROTONMAIL_USERNAME: paul@payne.io
|
||||||
PROTONMAIL_API_KEY: ${secret:PROTONMAIL_API_KEY}
|
PROTONMAIL_API_KEY: ${secret:PROTONMAIL_API_KEY}
|
||||||
@@ -107,6 +107,7 @@ components:
|
|||||||
description: Collect files from various sources into backup directory
|
description: Collect files from various sources into backup directory
|
||||||
run:
|
run:
|
||||||
runner: command
|
runner: command
|
||||||
|
working_dir: .
|
||||||
env:
|
env:
|
||||||
DBACKUP: /data/backup
|
DBACKUP: /data/backup
|
||||||
argv:
|
argv:
|
||||||
@@ -125,6 +126,7 @@ components:
|
|||||||
description: Nightly restic backup of /data to /storage
|
description: Nightly restic backup of /data to /storage
|
||||||
run:
|
run:
|
||||||
runner: command
|
runner: command
|
||||||
|
working_dir: .
|
||||||
env:
|
env:
|
||||||
RESTIC_REPOSITORY: /storage/restic-data
|
RESTIC_REPOSITORY: /storage/restic-data
|
||||||
RESTIC_PASSWORD_FILE: /home/payne/.config/restic-password
|
RESTIC_PASSWORD_FILE: /home/payne/.config/restic-password
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ def _get_project_dir(config: CastleConfig, project_name: str) -> Path:
|
|||||||
if project_name not in config.components:
|
if project_name not in config.components:
|
||||||
raise ValueError(f"Unknown component: {project_name}")
|
raise ValueError(f"Unknown component: {project_name}")
|
||||||
manifest = config.components[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
|
working_dir = cwd or project_name
|
||||||
return config.root / working_dir
|
return config.root / working_dir
|
||||||
|
|
||||||
@@ -59,7 +59,7 @@ def run_test(args: argparse.Namespace) -> int:
|
|||||||
# Run all
|
# Run all
|
||||||
all_passed = True
|
all_passed = True
|
||||||
for name, manifest in config.components.items():
|
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
|
working_dir = cwd or name
|
||||||
project_dir = config.root / working_dir
|
project_dir = config.root / working_dir
|
||||||
tests_dir = project_dir / "tests"
|
tests_dir = project_dir / "tests"
|
||||||
@@ -98,7 +98,7 @@ def run_lint(args: argparse.Namespace) -> int:
|
|||||||
# Run all
|
# Run all
|
||||||
all_passed = True
|
all_passed = True
|
||||||
for name, manifest in config.components.items():
|
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
|
working_dir = cwd or name
|
||||||
project_dir = config.root / working_dir
|
project_dir = config.root / working_dir
|
||||||
if not _has_pyproject(project_dir):
|
if not _has_pyproject(project_dir):
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ def run_info(args: argparse.Namespace) -> int:
|
|||||||
if getattr(args, "json", False):
|
if getattr(args, "json", False):
|
||||||
data = manifest.model_dump(exclude_none=True)
|
data = manifest.model_dump(exclude_none=True)
|
||||||
# Include CLAUDE.md content if it exists
|
# 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)
|
claude_md = _find_claude_md(config.root, cwd or name)
|
||||||
if claude_md:
|
if claude_md:
|
||||||
data["claude_md"] = claude_md
|
data["claude_md"] = claude_md
|
||||||
@@ -46,8 +46,8 @@ def run_info(args: argparse.Namespace) -> int:
|
|||||||
# Run spec
|
# Run spec
|
||||||
if manifest.run:
|
if manifest.run:
|
||||||
print(f" {BOLD}runner{RESET}: {manifest.run.runner}")
|
print(f" {BOLD}runner{RESET}: {manifest.run.runner}")
|
||||||
if manifest.run.cwd:
|
if manifest.run.working_dir:
|
||||||
print(f" {BOLD}cwd{RESET}: {manifest.run.cwd}")
|
print(f" {BOLD}working_dir{RESET}: {manifest.run.working_dir}")
|
||||||
if hasattr(manifest.run, "tool"):
|
if hasattr(manifest.run, "tool"):
|
||||||
print(f" {BOLD}tool{RESET}: {manifest.run.tool}")
|
print(f" {BOLD}tool{RESET}: {manifest.run.tool}")
|
||||||
elif hasattr(manifest.run, "argv"):
|
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 ""))
|
print(f" - {cap.type}" + (f" ({cap.name})" if cap.name else ""))
|
||||||
|
|
||||||
# Show CLAUDE.md if it exists
|
# 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)
|
claude_md = _find_claude_md(config.root, cwd or name)
|
||||||
if claude_md:
|
if claude_md:
|
||||||
print(f"\n{BOLD}{CYAN}CLAUDE.md{RESET}")
|
print(f"\n{BOLD}{CYAN}CLAUDE.md{RESET}")
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ def run_run(args: argparse.Namespace) -> int:
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
# Working directory
|
# Working directory
|
||||||
cwd = config.root / (run.cwd or name)
|
cwd = config.root / (run.working_dir or name)
|
||||||
if not cwd.exists():
|
if not cwd.exists():
|
||||||
print(f"Error: working directory '{cwd}' does not exist")
|
print(f"Error: working directory '{cwd}' does not exist")
|
||||||
return 1
|
return 1
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ def _generate_unit(config: CastleConfig, name: str, manifest: ComponentManifest)
|
|||||||
if run is None:
|
if run is None:
|
||||||
raise ValueError(f"Component '{name}' has no run spec")
|
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)
|
exec_start = _manifest_to_exec_start(manifest, config.root)
|
||||||
|
|
||||||
resolved_env = resolve_env_vars(run.env, manifest)
|
resolved_env = resolve_env_vars(run.env, manifest)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ def run_sync(args: argparse.Namespace) -> int:
|
|||||||
all_ok = True
|
all_ok = True
|
||||||
synced_dirs: set[Path] = set()
|
synced_dirs: set[Path] = set()
|
||||||
for name, manifest in config.components.items():
|
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
|
working_dir = cwd or name
|
||||||
project_dir = config.root / working_dir
|
project_dir = config.root / working_dir
|
||||||
pyproject = project_dir / "pyproject.toml"
|
pyproject = project_dir / "pyproject.toml"
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ class Role(str, Enum):
|
|||||||
|
|
||||||
class RunBase(BaseModel):
|
class RunBase(BaseModel):
|
||||||
runner: str
|
runner: str
|
||||||
cwd: str | None = None
|
working_dir: str | None = None
|
||||||
env: EnvMap = Field(default_factory=dict)
|
env: EnvMap = Field(default_factory=dict)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user