From 3f10177a1ff3564e592b09c01c7b3f293f66962f Mon Sep 17 00:00:00 2001 From: raman325 <7243222+raman325@users.noreply.github.com> Date: Fri, 2 Jan 2026 01:30:10 -0500 Subject: [PATCH] Update devcontainer setup and tooling configs --- .devcontainer/devcontainer.json | 10 +++++----- .vscode/launch.json | 2 ++ .vscode/settings.json | 3 ++- .vscode/tasks.json | 21 +++++++++++++++++++++ AGENTS.md | 7 +++++++ scripts/setup | 14 +++++++++++--- 6 files changed, 48 insertions(+), 9 deletions(-) create mode 100644 .vscode/tasks.json diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index af693bbc..02edda10 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,21 +1,21 @@ { "name": "lock_code_manager Dev", - "image": "mcr.microsoft.com/devcontainers/base:ubuntu", + "image": "mcr.microsoft.com/devcontainers/python:1-3.13", "forwardPorts": [8123], "features": { + "ghcr.io/anthropics/devcontainer-features/claude-code:1.0": {}, + "ghcr.io/devcontainers/features/github-cli:1": {}, "ghcr.io/devcontainers/features/node:1": { "version": "lts" }, - "ghcr.io/devcontainers/features/python:1": { - "version": "3.13", - "installTools": false - } + "ghcr.io/devcontainers/features/rust:1": {} }, "containerEnv": { "DEVCONTAINER": "1", "PIP_BREAK_SYSTEM_PACKAGES": "1" }, "postCreateCommand": "scripts/setup-devcontainer", + "postStartCommand": "scripts/setup-devcontainer", "customizations": { "vscode": { "extensions": [ diff --git a/.vscode/launch.json b/.vscode/launch.json index 271e51be..ccfa617b 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,6 +8,8 @@ "module": "homeassistant", "args": ["--debug", "--config", "${workspaceFolder}/.ha"], "cwd": "${workspaceFolder}/.ha", + "python": "${workspaceFolder}/.ha/venv/bin/python", + "pythonPath": "${workspaceFolder}/.ha/venv/bin/python", "subProcess": false, "justMyCode": false } diff --git a/.vscode/settings.json b/.vscode/settings.json index 048ed099..9729f6d8 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,6 @@ }, "eslint.workingDirectories": [ "." - ] + ], + "python.defaultInterpreterPath": "${workspaceFolder}/.ha/venv/bin/python" } diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 00000000..7cb29810 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,21 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "Run Home Assistant (venv)", + "type": "shell", + "command": "${workspaceFolder}/.ha/venv/bin/python", + "args": [ + "-m", + "homeassistant", + "--debug", + "--config", + "${workspaceFolder}/.ha" + ], + "options": { + "cwd": "${workspaceFolder}/.ha" + }, + "problemMatcher": [] + } + ] +} diff --git a/AGENTS.md b/AGENTS.md index fe5299ce..5bf2d829 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -201,6 +201,13 @@ yarn build # Build frontend strategy module yarn watch # Watch mode for development ``` +**Important:** After modifying any TypeScript files in `ts/`, you **must** rebuild +the JavaScript bundle before testing in the browser. The compiled output is +`custom_components/lock_code_manager/www/lock-code-manager-strategy.js`. If you +forget to rebuild, the browser will load stale JavaScript and the Lovelace +strategy will fail with errors like: +`Timeout waiting for strategy element ll-strategy-dashboard-lock-code-manager to be registered` + ## Code Style - Python: Ruff for linting/formatting (line length: 88) diff --git a/scripts/setup b/scripts/setup index b8314930..cd01c626 100755 --- a/scripts/setup +++ b/scripts/setup @@ -57,9 +57,17 @@ uv pip install -r requirements_dev.txt pre-commit install yarn install -# Setup directories for HA and linking -ensure_link "${PWD}/dev/configuration.yaml" "${PWD}/.ha/configuration.yaml" -ensure_link "${PWD}/dev/virtual.yaml" "${PWD}/.ha/virtual.yaml" +# Setup directories for HA config +mkdir -p "${PWD}/.ha/custom_components" + +# Copy yaml config files to .ha (makes .ha self-contained for volume mounting) +for yaml_file in "${PWD}"/dev/*.yaml; do + if [ -f "$yaml_file" ]; then + cp "$yaml_file" "${PWD}/.ha/" + fi +done + +# Link the component being developed ensure_link "${PWD}/custom_components/lock_code_manager" "${PWD}/.ha/custom_components/lock_code_manager" # Download and extract Virtual component if not already present