-
Notifications
You must be signed in to change notification settings - Fork 0
Copier init #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Copier init #1
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json | ||
| reviews: | ||
| profile: assertive | ||
| path_instructions: | ||
| - path: "**/vendor_files/**" | ||
| instructions: "These files came from a vendor and we're not allowed to change them. Refer to it if you need to understand how the main code interacts with it, but do not make comments about it." | ||
| tools: | ||
| eslint: # when the code contains typescript, eslint will be run by pre-commit, and coderabbit often generates false positives | ||
| enabled: false | ||
| ruff: # when the code contains python, ruff will be run by pre-commit, and coderabbit often generates false positives | ||
| enabled: false | ||
| pylint: # when the code contains python, pylint will be run by pre-commit, and coderabbit often generates false positives | ||
| enabled: false | ||
| flake8: # we use ruff instead (when we use Python) | ||
| enabled: false | ||
| poem: false | ||
| # the commit status is driven by our repository config and required checks, we don't want CodeRabbit messing with it | ||
| commit_status: false | ||
| auto_review: | ||
| # a main purpose of opening a draft PR might be to get CodeRabbit feedback early | ||
| drafts: true | ||
| finishing_touches: | ||
| docstrings: | ||
| enabled: false # if we wanted AI to generate docstrings, it would be via CLI, not in the GitHub interface | ||
| unit_tests: | ||
| enabled: false # Quis custodiet ipsos custodes? not something we want AI doing, especially not via the GitHub interface |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| # Changes here will be overwritten by Copier | ||
| _commit: v0.0.91 | ||
| _src_path: gh:LabAutomationAndScreening/copier-base-template.git | ||
| description: Creating libraries in the VueJS ecosystem | ||
| install_claude_cli: false | ||
| python_ci_versions: | ||
| - 3.13.2 | ||
| python_version: 3.13.2 | ||
| repo_name: copier-vue-package-template | ||
| repo_org_name: LabAutomationAndScreening | ||
| repo_org_name_for_copyright: LabAutomationAndScreening | ||
| ssh_port_number: 51211 | ||
| template_might_want_to_install_aws_ssm_port_forwarding_plugin: false | ||
| template_uses_javascript: true | ||
| template_uses_pulumi: false | ||
| template_uses_python: false | ||
| template_uses_vuejs: true | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||||||||||||||
| # base image tags available at https://mcr.microsoft.com/v2/devcontainers/universal/tags/list | ||||||||||||||||||
| # added the platform flag to override any local settings since this image is only compatible with linux/amd64. since this image is only x64 compatible, suppressing the hadolint rule | ||||||||||||||||||
| # hadolint ignore=DL3029 | ||||||||||||||||||
| FROM --platform=linux/amd64 mcr.microsoft.com/devcontainers/universal:2.13.1-focal | ||||||||||||||||||
|
|
||||||||||||||||||
| SHELL ["/bin/bash", "-o", "pipefail", "-c"] | ||||||||||||||||||
|
|
||||||||||||||||||
| RUN apt-get update -y && apt-get install -y \ | ||||||||||||||||||
| "bash-completion=$(apt-cache madison bash-completion | awk '{print $3}' | grep '^1:2.10' | head -n 1)" --no-install-recommends \ | ||||||||||||||||||
| && apt-get clean \ | ||||||||||||||||||
| && rm -rf /var/lib/apt/lists/* | ||||||||||||||||||
|
|
||||||||||||||||||
| # Create the venv folder and set permissions for anyone to modify---this is necessary to be able to break out the venv folder as a separate docker volume for better performance on Windows hosts | ||||||||||||||||||
| ARG REPO_NAME=copier-base-template | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
# Check if REPO_NAME is used as a template variable in copier configuration
rg -n "REPO_NAME|repo_name" --type=yaml --type=jinja -C3Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 1259 🏁 Script executed: #!/bin/bash
# Also check for copier config files directly
fd -type f -name "copier.yml" -o -name "copier.yaml" -o -name ".copier*" | head -20Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 267 🏁 Script executed: #!/bin/bash
# Check the repository name from git or README
git config --get remote.origin.url 2>/dev/null || echo "No git origin found"
if [ -f README.md ]; then head -20 README.md; fiRepository: LabAutomationAndScreening/copier-vue-package-template Length of output: 2437 🏁 Script executed: #!/bin/bash
# Check the full Dockerfile to see how REPO_NAME is used
cat -n .devcontainer/Dockerfile | head -40Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 1358 🏁 Script executed: #!/bin/bash
# Search for all REPO_NAME usage in the codebase
rg -n "REPO_NAME" -C2Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 79 🏁 Script executed: #!/bin/bash
# Check if there's a reference to copier-base-template anywhere
rg -n "copier-base-template|base-template" -C2Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 1714 🏁 Script executed: #!/bin/bash
# Check if devcontainer.json or other configs pass REPO_NAME as build arg
fd -type f -name "devcontainer.json" | xargs cat 2>/dev/nullRepository: LabAutomationAndScreening/copier-vue-package-template Length of output: 267 🏁 Script executed: #!/bin/bash
# Check git history to see if this Dockerfile was copied from base-template
git log --oneline .devcontainer/Dockerfile | head -10Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 109 🏁 Script executed: #!/bin/bash
# Find and check devcontainer.json files for build args
find . -name "devcontainer.json" -type f -exec cat {} \;Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 2732 🏁 Script executed: #!/bin/bash
# Check if REPO_NAME is referenced in any build context or docker compose
rg "build.*args|ARG REPO_NAME|REPO_NAME" --type json -C3Repository: LabAutomationAndScreening/copier-vue-package-template Length of output: 79 Update REPO_NAME default to match the template variable or use Jinja substitution. The default 🤖 Prompt for AI Agents |
||||||||||||||||||
| ENV VENV_PATH=/workspaces/${REPO_NAME}/.venv | ||||||||||||||||||
| RUN mkdir -p /workspace && \ | ||||||||||||||||||
| mkdir -p ${VENV_PATH} && \ | ||||||||||||||||||
| chmod -R 777 /workspaces ${VENV_PATH} && \ | ||||||||||||||||||
| chgrp -R 0 /workspaces ${VENV_PATH} | ||||||||||||||||||
|
Comment on lines
+16
to
+19
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix path inconsistency: /workspace vs /workspaces. Line 16 creates 🔎 Proposed fix-RUN mkdir -p /workspace && \
+RUN mkdir -p /workspaces && \
mkdir -p ${VENV_PATH} && \
chmod -R 777 /workspaces ${VENV_PATH} && \
chgrp -R 0 /workspaces ${VENV_PATH}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||
|
|
||||||||||||||||||
| # SSH | ||||||||||||||||||
| EXPOSE 2222 | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| #!/usr/bin/env sh | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| set -ex | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| mkdir -p ~/.aws | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "$GITHUB_ACTIONS" = "true" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOCALSTACK_ENDPOINT_URL="http://localhost:4566" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| else | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LOCALSTACK_ENDPOINT_URL="http://localstack:4566" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat >> ~/.aws/config <<EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+14
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Optional: Remove unnecessary blank lines in heredoc. Lines 14-16 contain several blank lines before the profile configuration. While not breaking functionality, they add unnecessary whitespace to the AWS config file. 🔎 Proposed cleanup cat >> ~/.aws/config <<EOF
-
-
-
-
[profile localstack]
region=us-east-1
output=json
endpoint_url = $LOCALSTACK_ENDPOINT_URL
-
-
EOF📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [profile localstack] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| region=us-east-1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| output=json | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| endpoint_url = $LOCALSTACK_ENDPOINT_URL | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cat >> ~/.aws/credentials <<EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| [localstack] | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aws_access_key_id=test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aws_secret_access_key=test | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| EOF | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+28
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider making the script idempotent. The script uses 🔎 Proposed fix for idempotency mkdir -p ~/.aws
if [ "$GITHUB_ACTIONS" = "true" ]; then
LOCALSTACK_ENDPOINT_URL="http://localhost:4566"
else
LOCALSTACK_ENDPOINT_URL="http://localstack:4566"
fi
+# Remove existing localstack profile if present
+if [ -f ~/.aws/config ]; then
+ sed -i '/\[profile localstack\]/,/^$/d' ~/.aws/config
+fi
+if [ -f ~/.aws/credentials ]; then
+ sed -i '/\[localstack\]/,/^$/d' ~/.aws/credentials
+fi
+
cat >> ~/.aws/config <<EOF
[profile localstack]
region=us-east-1
output=json
endpoint_url = $LOCALSTACK_ENDPOINT_URL
EOF
cat >> ~/.aws/credentials <<EOF
[localstack]
aws_access_key_id=test
aws_secret_access_key=test
EOF📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,62 @@ | ||||||
| { | ||||||
| "dockerComposeFile": "docker-compose.yml", | ||||||
| "service": "devcontainer", | ||||||
| "workspaceFolder": "/workspaces/${localWorkspaceFolderBasename}", | ||||||
| "features": { | ||||||
| "ghcr.io/devcontainers/features/python:1.7.1": { | ||||||
| // https://github.com/devcontainers/features/blob/main/src/python/devcontainer-feature.json | ||||||
| "version": "3.13.2", | ||||||
| "installTools": false, | ||||||
| "optimize": true | ||||||
| } | ||||||
| }, | ||||||
| "customizations": { | ||||||
| "vscode": { | ||||||
| // Add the IDs of extensions you want installed when the container is created. | ||||||
| "extensions": [ | ||||||
| // basic tooling | ||||||
| // "eamodio.gitlens@15.5.1", | ||||||
| "coderabbit.coderabbit-vscode@0.16.1", | ||||||
| "ms-vscode.live-server@0.5.2025051301", | ||||||
| "MS-vsliveshare.vsliveshare@1.0.5905", | ||||||
| "github.copilot@1.388.0", | ||||||
| "github.copilot-chat@0.34.2025112401", | ||||||
|
|
||||||
| // Python | ||||||
| "ms-python.python@2025.17.2025100201", | ||||||
| "ms-python.vscode-pylance@2025.8.3", | ||||||
| "ms-vscode-remote.remote-containers@0.414.0", | ||||||
| "charliermarsh.ruff@2025.28.0", | ||||||
|
|
||||||
| // Misc file formats | ||||||
| "bierner.markdown-mermaid@1.28.0", | ||||||
| "samuelcolvin.jinjahtml@0.20.0", | ||||||
| "tamasfe.even-better-toml@0.19.2", | ||||||
| "emilast.LogFileHighlighter@3.3.3", | ||||||
| "esbenp.prettier-vscode@11.0.0" | ||||||
| ], | ||||||
| "settings": { | ||||||
| "editor.accessibilitySupport": "off", // turn off sounds | ||||||
| "extensions.autoUpdate": false, | ||||||
| "extensions.autoCheckUpdates": false, | ||||||
| "livePreview.portNumber": 3025, // arbitrary not to conflict with default 3000 Nuxt port number | ||||||
| "github.copilot.nextEditSuggestions.allowWhitespaceOnlyChanges": false, | ||||||
| "[python]": { | ||||||
| "editor.formatOnSave": true, | ||||||
| "editor.defaultFormatter": "charliermarsh.ruff" | ||||||
| }, | ||||||
| "ruff.nativeServer": "on", | ||||||
| // TODO: see if there's a way to specify different configurations for different folders | ||||||
| "ruff.configuration": "/workspaces/copier-vue-package-template/ruff-test.toml", // use the test configuration since it's less restrictive and won't show false positives and underline things | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded workspace path will break in instantiated templates. The Consider using a dynamic path or the 🔎 Proposed fix- "ruff.configuration": "/workspaces/copier-vue-package-template/ruff-test.toml", // use the test configuration since it's less restrictive and won't show false positives and underline things
+ "ruff.configuration": "${workspaceFolder}/ruff-test.toml", // use the test configuration since it's less restrictive and won't show false positives and underline things📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| "[jsonc][json][javascript][typescript][graphql][css][scss][html][vue]": { | ||||||
| "editor.defaultFormatter": "esbenp.prettier-vscode", | ||||||
| "editor.formatOnSave": true | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| }, | ||||||
| "initializeCommand": "sh .devcontainer/initialize-command.sh", | ||||||
| "onCreateCommand": "sh .devcontainer/on-create-command.sh", | ||||||
| "postStartCommand": "sh .devcontainer/post-start-command.sh" | ||||||
| // Devcontainer context hash (do not manually edit this, it's managed by a pre-commit hook): 1ac9e66a # spellchecker:disable-line | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| services: | ||
| devcontainer: | ||
| # added the platform flag to override any local settings since this image is only compatible with linux/amd64. | ||
| platform: linux/amd64 | ||
| build: | ||
| context: . | ||
| args: | ||
| REPO_NAME: copier-vue-package-template | ||
| # You can run `devcontainer-info content-url` in codespaces to see what image base is | ||
| volumes: | ||
| - ..:/workspaces/copier-vue-package-template:cached | ||
| # Break out the venv folder as a separate docker volume for better performance on Windows hosts | ||
| - python_venv:/workspaces/copier-vue-package-template/.venv | ||
| command: sleep infinity | ||
| ports: | ||
| - "51211:2222" | ||
| environment: | ||
| - AWS_PROFILE=localstack | ||
| - AWS_DEFAULT_REGION=us-east-1 | ||
|
|
||
|
|
||
| volumes: | ||
| python_venv: {} |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| [ | ||
| { | ||
| "description": "main", | ||
| "relative_directory": ".", | ||
| "package_manager": "uv" | ||
| } | ||
| ] |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,8 @@ | ||||||||||||||||||||||||||||||||||||
| # CodeSpaces build environments get cluttered and need to be pruned https://github.com/orgs/community/discussions/50403 | ||||||||||||||||||||||||||||||||||||
| # There was an error encountered during the codespace build using `docker system prune`, so switched to `docker image prune`: Error: The expected container does not exist. | ||||||||||||||||||||||||||||||||||||
| set -ex | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| printenv | ||||||||||||||||||||||||||||||||||||
| if [ -n "$CODESPACES" ] && [ "$CODESPACES" = "true" ]; then | ||||||||||||||||||||||||||||||||||||
| docker image prune --all --force | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+1
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add shebang to declare the shell interpreter. The script uses 🔎 Proposed fix+#!/bin/bash
# CodeSpaces build environments get cluttered and need to be pruned https://github.com/orgs/community/discussions/50403
# There was an error encountered during the codespace build using `docker system prune`, so switched to `docker image prune`: Error: The expected container does not exist.
set -ex📝 Committable suggestion
Suggested change
🧰 Tools🪛 Shellcheck (0.11.0)[error] 1-1: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive. (SC2148) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,164 @@ | ||
| import argparse | ||
| import os | ||
| import platform | ||
| import shutil | ||
| import subprocess | ||
| import sys | ||
| import tempfile | ||
| from pathlib import Path | ||
|
|
||
| UV_VERSION = "0.9.18" | ||
| PNPM_VERSION = "10.25.0" | ||
| COPIER_VERSION = "==9.11.0" | ||
| COPIER_TEMPLATE_EXTENSIONS_VERSION = "==0.3.3" | ||
| PRE_COMMIT_VERSION = "4.5.0" | ||
| GITHUB_WINDOWS_RUNNER_BIN_PATH = r"C:\Users\runneradmin\.local\bin" | ||
| INSTALL_SSM_PLUGIN_BY_DEFAULT = False | ||
| parser = argparse.ArgumentParser(description="Install CI tooling for the repo") | ||
| _ = parser.add_argument( | ||
| "--no-python", | ||
| default=False, | ||
| action="store_true", | ||
| help="Do not process any environments using python package managers", | ||
| ) | ||
| _ = parser.add_argument( | ||
| "--python-version", | ||
| default=f"{sys.version_info.major}.{sys.version_info.minor}.{sys.version_info.micro}", | ||
| type=str, | ||
| help="What version to install.", | ||
| ) | ||
| _ = parser.add_argument( | ||
| "--no-node", action="store_true", default=False, help="Do not process any environments using node package managers" | ||
| ) | ||
| _ = parser.add_argument( | ||
| "--skip-installing-ssm-plugin", | ||
| action="store_true", | ||
| default=False, | ||
| help="Skip installing the SSM plugin for AWS CLI", | ||
| ) | ||
|
|
||
|
|
||
| def main(): | ||
| args = parser.parse_args(sys.argv[1:]) | ||
| is_windows = platform.system() == "Windows" | ||
| uv_env = dict(os.environ) | ||
| uv_env.update({"UV_PYTHON": args.python_version, "UV_PYTHON_PREFERENCE": "only-system"}) | ||
| uv_path = ((GITHUB_WINDOWS_RUNNER_BIN_PATH + "\\") if is_windows else "") + "uv" | ||
| if is_windows: | ||
| pwsh = shutil.which("pwsh") or shutil.which("powershell") | ||
| if not pwsh: | ||
| raise FileNotFoundError("Neither 'pwsh' nor 'powershell' found on PATH") | ||
| if not args.no_python: | ||
| if is_windows: | ||
| uv_env.update({"PATH": rf"{GITHUB_WINDOWS_RUNNER_BIN_PATH};{uv_env['PATH']}"}) | ||
| # invoke installer in a pwsh process | ||
| _ = subprocess.run( | ||
| [ | ||
| pwsh, # type: ignore[reportPossiblyUnboundVariable] # this matches the conditional above that defines pwsh | ||
| "-NoProfile", | ||
| "-NonInteractive", | ||
| "-Command", | ||
| f"irm https://astral.sh/uv/{UV_VERSION}/install.ps1 | iex", | ||
| ], | ||
| check=True, | ||
| env=uv_env, | ||
| ) | ||
| else: | ||
| _ = subprocess.run( | ||
| f"curl -fsSL --connect-timeout 20 --max-time 40 --retry 3 --retry-delay 5 --retry-connrefused --proto '=https' https://astral.sh/uv/{UV_VERSION}/install.sh | sh", | ||
| check=True, | ||
| shell=True, | ||
| env=uv_env, | ||
| ) | ||
|
Comment on lines
+66
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider security implications of piping curl to shell. While common, 🤖 Prompt for AI Agents |
||
| # TODO: add uv autocompletion to the shell https://docs.astral.sh/uv/getting-started/installation/#shell-autocompletion | ||
| _ = subprocess.run( | ||
| [ | ||
| uv_path, | ||
| "tool", | ||
| "install", | ||
| f"copier{COPIER_VERSION}", | ||
| "--with", | ||
| f"copier-template-extensions{COPIER_TEMPLATE_EXTENSIONS_VERSION}", | ||
| ], | ||
| check=True, | ||
| env=uv_env, | ||
| ) | ||
| _ = subprocess.run( | ||
| [ | ||
| uv_path, | ||
| "tool", | ||
| "install", | ||
| f"pre-commit=={PRE_COMMIT_VERSION}", | ||
| ], | ||
| check=True, | ||
| env=uv_env, | ||
| ) | ||
| _ = subprocess.run( | ||
| [ | ||
| uv_path, | ||
| "tool", | ||
| "list", | ||
| ], | ||
| check=True, | ||
| env=uv_env, | ||
| ) | ||
| if not args.no_node: | ||
| pnpm_install_sequence = ["npm -v", f"npm install -g pnpm@{PNPM_VERSION}", "pnpm -v"] | ||
| for cmd in pnpm_install_sequence: | ||
| cmd = ( | ||
| [ | ||
| pwsh, # type: ignore[reportPossiblyUnboundVariable] # this matches the conditional above that defines pwsh | ||
| "-NoProfile", | ||
| "-NonInteractive", | ||
| "-Command", | ||
| cmd, | ||
| ] | ||
| if is_windows | ||
| else [cmd] | ||
| ) | ||
| _ = subprocess.run(cmd, shell=True, check=True) | ||
|
Comment on lines
+105
to
+119
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Clarify When On non-Windows, the code should either use 🔎 Proposed fix if not args.no_node:
pnpm_install_sequence = ["npm -v", f"npm install -g pnpm@{PNPM_VERSION}", "pnpm -v"]
for cmd in pnpm_install_sequence:
- cmd = (
+ run_cmd: list[str] | str = (
[
pwsh, # type: ignore[reportPossiblyUnboundVariable] # this matches the conditional above that defines pwsh
"-NoProfile",
"-NonInteractive",
"-Command",
cmd,
]
if is_windows
- else [cmd]
+ else cmd # Keep as string for shell=True on non-Windows
)
- _ = subprocess.run(cmd, shell=True, check=True)
+ _ = subprocess.run(run_cmd, shell=not is_windows, check=True)🤖 Prompt for AI Agents |
||
| if INSTALL_SSM_PLUGIN_BY_DEFAULT and not args.skip_installing_ssm_plugin: | ||
| with tempfile.TemporaryDirectory() as tmp_dir: | ||
| if is_windows: | ||
| local_package_path = Path(tmp_dir) / "SessionManagerPluginSetup.exe" | ||
| # Based on https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-windows.html | ||
| # no specific reason for that version, just pinning it for best practice | ||
| _ = subprocess.run( | ||
| [ | ||
| "curl", | ||
| "https://s3.amazonaws.com/session-manager-downloads/plugin/1.2.707.0/windows/SessionManagerPluginSetup.exe", | ||
| "-o", | ||
| f"{local_package_path}", | ||
| ], | ||
| check=True, | ||
| ) | ||
| _ = subprocess.run( | ||
| [str(local_package_path), "/quiet"], | ||
| check=True, | ||
| ) | ||
| else: | ||
| local_package_path = Path(tmp_dir) / "session-manager-plugin.deb" | ||
| # Based on https://docs.aws.amazon.com/systems-manager/latest/userguide/install-plugin-debian-and-ubuntu.html | ||
| # no specific reason for that version, just pinning it for best practice | ||
| _ = subprocess.run( | ||
| [ | ||
| "curl", | ||
| "https://s3.amazonaws.com/session-manager-downloads/plugin/1.2.707.0/ubuntu_64bit/session-manager-plugin.deb", | ||
| "-o", | ||
| f"{local_package_path}", | ||
| ], | ||
| check=True, | ||
| ) | ||
| _ = subprocess.run( | ||
| ["sudo", "dpkg", "-i", str(local_package_path)], | ||
| check=True, | ||
| ) | ||
| print("SSM Plugin Manager Version: ") | ||
| _ = subprocess.run( | ||
| ["session-manager-plugin", "--version"], | ||
| check=True, | ||
| ) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Trailing blank line violates YAMLlint configuration.
Static analysis flags an extra blank line at the end of the file. Remove the trailing blank line to comply with the linting rules.
🔎 Proposed fix
template_uses_vuejs: true -📝 Committable suggestion
🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 18-18: too many blank lines (1 > 0)
(empty-lines)
🤖 Prompt for AI Agents