Files
daniel156161 c34dab2cca
Build and Push Docker Container / build-and-push (push) Successful in 4m28s
feat(properties): prepare property commands before execution
- Create missing note files before running property:set.
- Default date-only datetime values to midnight.
- Keep property names out of path authorization checks.
- Split policy, vault, daily note, and command target helpers.
- Split n8n node args, description, output, and API response helpers.
- Split API tests by auth, command, daily note, and property behavior.
- Bump API and n8n node versions.
2026-06-24 14:31:42 +02:00

31 lines
854 B
Python

from pathlib import Path
from app.config import DEFAULT_VAULT_NAME, REGISTERED_VAULTS
from app.command_target import CommandTarget
def vault_for_path(path:Path) -> str|None:
resolved = path.resolve()
best_name:str|None = None
best_len = -1
for name, vault_path in REGISTERED_VAULTS.items():
root = Path(vault_path).resolve()
try:
resolved.relative_to(root)
except ValueError:
continue
root_len = len(str(root))
if root_len > best_len:
best_name = name
best_len = root_len
return best_name
def vault_root_for_target(target:CommandTarget, cwd:Path) -> Path:
if target.vault and target.vault in REGISTERED_VAULTS:
return Path(REGISTERED_VAULTS[target.vault]).resolve()
vault_name = vault_for_path(cwd) or DEFAULT_VAULT_NAME
return Path(REGISTERED_VAULTS.get(vault_name, cwd)).resolve()