From f90d547c0ff03f0d6c257274ad1fa35988c6264b Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 23 Nov 2025 11:27:48 +0000 Subject: [PATCH 1/4] devcontainer improvements --- .devcontainer/Dockerfile | 7 +++++++ .devcontainer/devcontainer.json | 6 +++--- .devcontainer/post-attach.sh | 15 ++++++++++++++ .devcontainer/post-create.sh | 36 +++++++++------------------------ 4 files changed, 35 insertions(+), 29 deletions(-) create mode 100644 .devcontainer/post-attach.sh diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index fa30c2e..c3ebe87 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -9,6 +9,13 @@ RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* +# Install CodeQL CLI +RUN curl -Ls -o /tmp/codeql.zip https://github.com/github/codeql-cli-binaries/releases/latest/download/codeql-linux64.zip \ + && unzip /tmp/codeql.zip -d /opt \ + && mv /opt/codeql /opt/codeql-cli \ + && ln -s /opt/codeql-cli/codeql /usr/local/bin/codeql \ + && rm /tmp/codeql.zip + # Set working directory WORKDIR /workspaces/seclab-taskflow-agent diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 93c128f..009235e 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -23,14 +23,14 @@ "extensions": [ "ms-python.python", "ms-python.vscode-pylance", + "ms-python.vscode-python-envs", "redhat.vscode-yaml", "GitHub.copilot", "GitHub.copilot-chat", "ms-azuretools.vscode-docker" ], "settings": { - "python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python", - "python.terminal.activateEnvironment": true + "python.useEnvironmentsExtension": true } } }, @@ -39,7 +39,7 @@ // Use 'postCreateCommand' to run commands after the container is created "postCreateCommand": "bash .devcontainer/post-create.sh", // Use 'postStartCommand' to run commands when the container starts - // "postStartCommand": "", + "postAttachCommand": "bash .devcontainer/post-attach.sh", // Environment variables "containerEnv": { "PYTHONUNBUFFERED": "1" diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh new file mode 100644 index 0000000..68c47bf --- /dev/null +++ b/.devcontainer/post-attach.sh @@ -0,0 +1,15 @@ +#!/bin/bash +set -e + +# If running in Codespaces, check for necessary secrets and print error if missing +if [ -v CODESPACES ]; then + echo "🔐 Running in Codespaces - injecting secrets from Codespaces settings..." + if [ ! -v COPILOT_TOKEN ]; then + echo "Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets" + fi + if [ ! -v GITHUB_PERSONAL_ACCESS_TOKEN ]; then + echo "Running in Codespaces - please add GITHUB_PERSONAL_ACCESS_TOKEN to your Codespaces secrets" + fi +fi + +echo "💡 Remember to activate the virtual environment: source .venv/bin/activate" diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index bf65374..9bb45b4 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -14,37 +14,21 @@ python -m pip install --upgrade pip python -m pip install hatch hatch build -# If running in Codespaces, check for necessary secrets and print error if missing -if [ -n "$CODESPACES" ]; then - echo "🔐 Running in Codespaces - injecting secrets from Codespaces settings..." - if [ -n "$COPILOT_TOKEN" ]; then - echo "Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets" - fi - if [ -n "$GITHUB_AUTH_HEADER" ]; then - echo "Running in Codespaces - please add GITHUB_AUTH_HEADER to your Codespaces secrets" - fi -fi +# Install this package from local directory. +pip install -e . + +# Create logs directory if it doesn't exist +mkdir -p logs + +# Create optional data directories +mkdir -p data # Create .env file if it doesn't exist if [ ! -f .env ]; then echo "📝 Creating .env template..." - cat > .env << 'EOF' - -# Optional: CodeQL database base path -CODEQL_DBS_BASE_PATH=/workspaces/seclab-taskflow-agent/my_data - -EOF + echo "# Optional: CodeQL database base path" >> .env + echo "CODEQL_DBS_BASE_PATH=$(realpath data)" >> .env echo "⚠️ Please configure the enviroment or your .env file with required tokens!" fi -# Create logs directory if it doesn't exist -mkdir -p logs - -# Create optional data directories -mkdir -p my_data - echo "✅ Development environment setup complete!" -echo "" -echo "📋 Next steps:" -echo "Configure your environment with COPILOT_TOKEN and GITHUB_AUTH_HEADER as needed." -echo "💡 Remember to activate the virtual environment: source .venv/bin/activate" From 30da15f47fd82ebf156e65963f4fc2347bf1a069 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 23 Nov 2025 11:50:57 +0000 Subject: [PATCH 2/4] Update .devcontainer/post-attach.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .devcontainer/post-attach.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh index 68c47bf..eb6f365 100644 --- a/.devcontainer/post-attach.sh +++ b/.devcontainer/post-attach.sh @@ -8,7 +8,7 @@ if [ -v CODESPACES ]; then echo "Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets" fi if [ ! -v GITHUB_PERSONAL_ACCESS_TOKEN ]; then - echo "Running in Codespaces - please add GITHUB_PERSONAL_ACCESS_TOKEN to your Codespaces secrets" + echo "⚠️ Running in Codespaces - please add GITHUB_PERSONAL_ACCESS_TOKEN to your Codespaces secrets" fi fi From 558eed7e05ad379c50ee519042b7e687556e9caa Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 23 Nov 2025 15:31:49 +0000 Subject: [PATCH 3/4] Update .devcontainer/post-attach.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .devcontainer/post-attach.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/post-attach.sh b/.devcontainer/post-attach.sh index eb6f365..0fd307a 100644 --- a/.devcontainer/post-attach.sh +++ b/.devcontainer/post-attach.sh @@ -5,7 +5,7 @@ set -e if [ -v CODESPACES ]; then echo "🔐 Running in Codespaces - injecting secrets from Codespaces settings..." if [ ! -v COPILOT_TOKEN ]; then - echo "Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets" + echo "⚠️ Running in Codespaces - please add COPILOT_TOKEN to your Codespaces secrets" fi if [ ! -v GITHUB_PERSONAL_ACCESS_TOKEN ]; then echo "⚠️ Running in Codespaces - please add GITHUB_PERSONAL_ACCESS_TOKEN to your Codespaces secrets" From 7d9eef0aa90761873ad9a8df0e3ba6e5c1f4a8ba Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 23 Nov 2025 15:41:43 +0000 Subject: [PATCH 4/4] Update .devcontainer/post-create.sh Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .devcontainer/post-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/post-create.sh b/.devcontainer/post-create.sh index 9bb45b4..1519242 100644 --- a/.devcontainer/post-create.sh +++ b/.devcontainer/post-create.sh @@ -28,7 +28,7 @@ if [ ! -f .env ]; then echo "📝 Creating .env template..." echo "# Optional: CodeQL database base path" >> .env echo "CODEQL_DBS_BASE_PATH=$(realpath data)" >> .env - echo "⚠️ Please configure the enviroment or your .env file with required tokens!" + echo "⚠️ Please configure the environment or your .env file with required tokens!" fi echo "✅ Development environment setup complete!"