Skip to content

Development#2

Merged
nam20485 merged 20 commits intomainfrom
development
Jul 31, 2025
Merged

Development#2
nam20485 merged 20 commits intomainfrom
development

Conversation

@nam20485
Copy link
Owner

No description provided.

nam20485 added 20 commits July 30, 2025 02:12
- Add Terraform CLI to GitHub Actions workflow
- Create setup-local-environment.ps1 for local development setup
- Create validate-local-environment.ps1 for environment validation
- Create quick-setup.ps1 for fast environment initialization
- Add comprehensive documentation for all scripts
- Ensure cross-platform compatibility (Windows, Linux, macOS)
- Mirror GitHub Actions workflow for consistency
- Include all tools from AI instruction modules requirements
- Replace cli/gh-extension-manager with direct gh command verification
- Fix PowerShell array counting issues in validation script
- GitHub CLI is pre-installed on GitHub runners
- Ensure the updated workflow without cli/gh-extension-manager is committed
- Only enable npm cache when package-lock.json exists
- Prevents cache failure in repositories without npm dependencies
- Add .devcontainer/devcontainer.json with comprehensive VS Code configuration
- Add .devcontainer/Dockerfile with all development tools pre-installed
- Add .devcontainer/post-create.sh for environment setup
- Add .github/workflows/build-devcontainer.yml for container image builds
- Update copilot-setup-steps.yml to use prebuild image for faster setup

This significantly reduces GitHub Copilot agent startup time by using
a prebuild container image instead of installing tools individually.
- Add Python 3 and pip installation to devcontainer Dockerfile
- Add Gemini CLI download and installation to devcontainer
- Update environment info script to display Python and Gemini versions
- Add Install-AITools function to setup-local-environment.ps1
- Update validation scripts to check Python 3 and Gemini CLI
- Add AI development capabilities to comprehensive dev environment

/Addresses Python and Gemini CLI requirements for AI development workflow
…striction

- Debian containers now have externally-managed-environment restriction
- This prevents pip from installing packages system-wide without the flag
- Required for Python setup in devcontainer environment

/Fixes devcontainer build failure with pip upgrade step
…into development

* 'development' of github.com:nam20485/agent-instructions:
  improvements to create-test-cases assignment
Copilot AI review requested due to automatic review settings July 31, 2025 07:20
@nam20485 nam20485 merged commit 7722e62 into main Jul 31, 2025
1 check failed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request implements a comprehensive development environment setup system for ASP.NET Core + Blazor + Google Cloud development. The PR adds automated scripts for local environment validation and setup, alongside GitHub Actions workflows and devcontainer configurations to ensure consistent development environments across all platforms.

Key Changes:

  • PowerShell-based local environment setup and validation scripts with cross-platform support
  • GitHub Actions workflow for automated environment validation using prebuild devcontainer images
  • Devcontainer configurations for both prebuild image creation and local development
  • AI workflow assignment for test case creation tasks

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
scripts/validate-local-environment.ps1 Environment validation script with multiple output formats and comprehensive tool checking
scripts/setup-local-environment.ps1 Automated setup script for all required development tools across Windows/Linux/macOS
scripts/quick-setup.ps1 Fast-path setup script with intelligent validation and setup decisions
scripts/README.md Comprehensive documentation for all environment scripts and usage patterns
ai_instruction_modules/ai-workflow-assignments/create-test-cases.md New workflow assignment for systematic test case creation
ai_instruction_modules/ai-workflow-assignments.md Updated index to include the new test case creation assignment
.github/workflows/prebuild.yml Workflow for building and publishing prebuild devcontainer images
.github/workflows/copilot-setup-steps.yml GitHub Actions workflow using prebuild images for faster CI/CD
.github/.devcontainer/devcontainer.json Devcontainer configuration for prebuild image creation
.github/.devcontainer/Dockerfile Multi-stage Dockerfile installing all development tools
.devcontainer/devcontainer.json Local devcontainer configuration using prebuild images
Comments suppressed due to low confidence (6)

scripts/validate-local-environment.ps1:35

  • The .NET SDK version 9.0.102 may not exist or be generally available. Consider using a more stable version like 8.0.x LTS or verify this version exists in the Microsoft releases.
$EXPECTED_DOTNET = "9.0.102"

scripts/setup-local-environment.ps1:38

  • The .NET SDK version 9.0.102 may not exist or be generally available. This could cause installation failures across all platforms. Consider using a stable LTS version like 8.0.x.
$DOTNET_VERSION = "9.0.102"

scripts/setup-local-environment.ps1:319

  • Function name 'Install-NodeJs' is inconsistent with the actual function name 'Install-NodeJS' (line 149). This will cause a runtime error.
            Install-NodeJs -Force:$Force

.github/workflows/copilot-setup-steps.yml:23

  • The devcontainer image name format is inconsistent with the actual image name used in the prebuild workflow. The prebuild workflow uses 'nam20485/agent-instructions-prebuild' while this references '${{ github.repository }}-devcontainer'.
  DEVCONTAINER_IMAGE: "ghcr.io/${{ github.repository }}-devcontainer:latest"

.github/workflows/copilot-setup-steps.yml:30

  • Container image reference is inconsistent with the prebuild workflow which creates 'nam20485/agent-instructions-prebuild' image. This mismatch will cause the workflow to fail.
      image: ghcr.io/${{ github.repository }}-devcontainer:latest

.github/.devcontainer/Dockerfile:6

  • The base image version '1.3.7-9.0-bookworm-slim' may not exist. .NET 9.0 was released recently and this specific devcontainer version might not be available. Consider using a stable version like '1-8.0-bookworm-slim'.
FROM mcr.microsoft.com/devcontainers/dotnet:1.3.7-9.0-bookworm-slim

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @nam20485, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the development workflow by establishing a standardized and automated development environment. It provides robust tools for both local machine setup and VS Code Dev Containers, ensuring consistency across different development contexts. Additionally, it introduces a new AI agent assignment aimed at improving code quality through comprehensive automated testing.

Highlights

  • Standardized Development Environment: I've introduced comprehensive Dev Container configurations, including a custom Dockerfile, to provide a consistent, pre-configured development environment. This setup is tailored for .NET, Node.js, Google Cloud, and AI development, integrating a wide array of VS Code extensions and essential tools.
  • Automated Environment Setup & Validation: I've added cross-platform PowerShell scripts to automate the installation, configuration, and validation of the local development environment. These scripts ensure consistency with the Dev Container and GitHub Actions workflows, streamlining developer onboarding and environment maintenance.
  • New AI Agent Assignment for Testing: I've expanded the AI agent instruction modules with a new assignment focused on systematically increasing automated test coverage. This includes detailed guidance for AI agents on planning, obtaining approval, implementing unit and integration tests, and integrating them into CI pipelines.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive development environment setup, including devcontainer configurations, setup scripts, and new AI instruction modules. The changes are extensive and form a solid foundation for standardized development.

My review focuses on improving the correctness and efficiency of the new configurations and scripts. I've identified some critical issues, such as a conflicting Docker setup in the devcontainer.json files and a bug in the PowerShell setup script that could terminate it prematurely. I've also suggested optimizations for the Dockerfile to improve build times and maintainability, along with several corrections for the documentation files.

Addressing these points will significantly improve the robustness and clarity of the development environment. Thank you for this contribution!

}
elseif ($IsLinux) {
curl https://sdk.cloud.google.com | bash
exec -l $SHELL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

Using exec -l $SHELL will replace the current script's process with a new shell, which will prematurely terminate the script at this point. The Google Cloud SDK installer suggests this to refresh the PATH, but it's not safe to use within a script.

A better approach would be to inform the user that they need to restart their shell session after the script completes for the gcloud command to be available in their PATH.

            # The user will need to restart their shell for gcloud to be in the PATH.
            # The installer modifies shell profile files (e.g., .bashrc, .zshrc).

Comment on lines +104 to +106
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This mounts configuration for the Docker socket creates a conflict with the docker-in-docker feature enabled on lines 8-11.

  • The docker-in-docker feature provides an isolated Docker daemon inside the container.
  • Mounting the host's Docker socket (/var/run/docker.sock) provides access to the host's Docker daemon (a pattern known as Docker-out-of-Docker).

Using both at the same time is confusing and can lead to unpredictable behavior. To align with the explicit use of the docker-in-docker feature, I recommend removing this mount. If access to the host's Docker daemon is intended, you should use the docker-from-docker feature instead and remove the docker-in-docker one.

Comment on lines +128 to +130
"mounts": [
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This mounts configuration for the Docker socket creates a conflict with the docker-in-docker feature enabled on lines 18-20.

  • The docker-in-docker feature provides an isolated Docker daemon inside the container.
  • Mounting the host's Docker socket (/var/run/docker.sock) provides access to the host's Docker daemon (a pattern known as Docker-out-of-Docker).

Using both at the same time is confusing and can lead to unpredictable behavior. To align with the explicit use of the docker-in-docker feature, I recommend removing this mount. If access to the host's Docker daemon is intended, you should use the docker-from-docker feature instead and remove the docker-in-docker one.


## Integration with GitHub Actions

These scripts mirror the [copilot-setup-steps.yml](../.github/workflows/copilot-setup-steps.yml) workflow to ensure consistency between local development and CI/CD environments.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

This link to copilot-setup-steps.yml appears to be broken, as the file does not exist in the repository. Please update it to point to the correct file or remove the link if it's no longer relevant.

Comment on lines +53 to +98
RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
&& apt-get install -y nodejs \
&& npm install -g npm@latest \
&& rm -rf /var/lib/apt/lists/*

# =============================================================================
# POWERSHELL CORE INSTALLATION
# =============================================================================

# Install PowerShell Core from Microsoft repository
RUN wget -q "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb" \
&& dpkg -i packages-microsoft-prod.deb \
&& apt-get update \
&& apt-get install -y powershell \
&& rm packages-microsoft-prod.deb \
&& rm -rf /var/lib/apt/lists/*

# =============================================================================
# CLOUD DEVELOPMENT TOOLS
# =============================================================================

# Install Google Cloud CLI
RUN echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee -a /etc/apt/sources.list.d/google-cloud-sdk.list \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \
&& apt-get update \
&& apt-get install -y google-cloud-cli \
&& rm -rf /var/lib/apt/lists/*

# Install GitHub CLI
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
&& chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
&& apt-get update \
&& apt-get install -y gh \
&& rm -rf /var/lib/apt/lists/*

# =============================================================================
# INFRASTRUCTURE TOOLS
# =============================================================================

# Install Terraform
RUN wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg \
&& echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \
&& apt-get update \
&& apt-get install -y terraform \
&& rm -rf /var/lib/apt/lists/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The current approach of installing each tool with separate RUN commands, each containing apt-get update, is inefficient. It increases the Docker image size by creating multiple layers and slows down the build process.

It's a best practice to consolidate these installations. You can add all external package sources first, then run apt-get update once, and finally install all the tools in a single apt-get install command. This will result in a smaller, faster-building, and more maintainable Dockerfile.

RUN curl -fsSL https://deb.nodesource.com/setup_22.x | bash - \
    && wget -q "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb" \
    && dpkg -i packages-microsoft-prod.deb \
    && rm packages-microsoft-prod.deb \
    && echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" | tee /etc/apt/sources.list.d/google-cloud-sdk.list > /dev/null \
    && curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg \
    && curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \
    && chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \
    && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null \
    && wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg \
    && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list > /dev/null \
    && apt-get update \
    && apt-get install -y nodejs powershell google-cloud-cli gh terraform \
    && npm install -g npm@latest \
    && rm -rf /var/lib/apt/lists/*


Ask the stake-holder if they want you to merge the PR or if they would like to do so themselves.
If so, then merge the PR, and close the issue and branch.
Eat a cookie and have an espresso or a milkshake. You can have both if you want.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This sentence is unprofessional and doesn't fit in a technical instruction document. I recommend removing it to maintain a professional tone.

Comment on lines +11 to +16
1. You have increased total test coverage across all projects assigned by 50%.
2. Test Projects for each code project have been created.
6. All projects build and runs successfully.
8. All test cases pass 100%.
7. All acceptance criteria from the template have been satisfied
4. Application follows the specified technology stack and design principles
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The acceptance criteria are not numbered sequentially, which makes them difficult to follow. Please reorder and renumber them for clarity.

Suggested change
1. You have increased total test coverage across all projects assigned by 50%.
2. Test Projects for each code project have been created.
6. All projects build and runs successfully.
8. All test cases pass 100%.
7. All acceptance criteria from the template have been satisfied
4. Application follows the specified technology stack and design principles
1. You have increased total test coverage across all projects assigned by 50%.
2. Test Projects for each code project have been created.
3. Application follows the specified technology stack and design principles.
4. All projects build and run successfully.
5. All test cases pass 100%.
6. All acceptance criteria from the template have been satisfied.

* [perform-task.md](perform-task.md): This assignment involves executing a specific task given to you by an orchestrator or stakeholder, using the task-based workflow process. This includes understanding the task requirements, planning/gaining approval and gathering necessary resources, and delivering the expected outcome.
* [continue-task-work.md](continue-task-work.md): This assignment provides a comprehensive guide on how to complete previously-existing tasks that have already been started but not yet finished. It includes guidance on how to determine which task to start, how to perform tasks within the task-based workflow, including detailed steps and considerations.
* [create-application.md](create-application.md): This assignment involves creating a new application given the description from a new app template that has been filled out, including setting up the project structure, configuring necessary components, and ensuring the application meets specified requirements.
* [create-test-cases.md](create-test-cases.md): This assignment involves creating test cases for the application, ensuring that all critical functionality is covered and that the tests are properly integrated into the build process. You will create a plan, document it in an issue, and once gaining approval, you will implement the plan. You will also create (or upgrade, if necessary) an auomated test pipeline.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There's a typo in the word "automated".

Suggested change
* [create-test-cases.md](create-test-cases.md): This assignment involves creating test cases for the application, ensuring that all critical functionality is covered and that the tests are properly integrated into the build process. You will create a plan, document it in an issue, and once gaining approval, you will implement the plan. You will also create (or upgrade, if necessary) an auomated test pipeline.
* [create-test-cases.md](create-test-cases.md): This assignment involves creating test cases for the application, ensuring that all critical functionality is covered and that the tests are properly integrated into the build process. You will create a plan, document it in an issue, and once gaining approval, you will implement the plan. You will also create (or upgrade, if necessary) an automated test pipeline.

Comment on lines +162 to +181
RUN echo '#!/bin/bash' > /home/vscode/show-env.sh \
&& echo 'echo "=== AI Agent Instructions Development Environment ==="' >> /home/vscode/show-env.sh \
&& echo 'echo "Core Development Stack:"' >> /home/vscode/show-env.sh \
&& echo 'echo "- .NET SDK: $(dotnet --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Node.js: $(node --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- npm: $(npm --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Python: $(python --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- PowerShell: $(pwsh --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo ""' >> /home/vscode/show-env.sh \
&& echo 'echo "Cloud & DevOps Tools:"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Google Cloud CLI: $(gcloud version --format=\"value(Google Cloud SDK)\" 2>/dev/null || echo \"Not authenticated\")"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Firebase CLI: $(firebase --version)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- GitHub CLI: $(gh --version | head -1)"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Terraform: $(terraform --version | head -1)"' >> /home/vscode/show-env.sh \
&& echo 'echo ""' >> /home/vscode/show-env.sh \
&& echo 'echo "AI Development Tools:"' >> /home/vscode/show-env.sh \
&& echo 'echo "- Gemini CLI: $(gemini --version 2>/dev/null || echo \"Available\")"' >> /home/vscode/show-env.sh \
&& echo 'echo ""' >> /home/vscode/show-env.sh \
&& echo 'echo "Ready for ASP.NET Core + Blazor + AI + Google Cloud development!"' >> /home/vscode/show-env.sh \
&& chmod +x /home/vscode/show-env.sh
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using a long chain of echo commands to create a script is hard to read and maintain. A heredoc would be much cleaner and easier to manage.

RUN echo '#!/bin/bash' > /home/vscode/show-env.sh && \
    cat <<'EOF' >> /home/vscode/show-env.sh
echo "=== AI Agent Instructions Development Environment ==="
echo "Core Development Stack:"
echo "- .NET SDK: $(dotnet --version)"
echo "- Node.js: $(node --version)"
echo "- npm: $(npm --version)"
echo "- Python: $(python --version)"
echo "- PowerShell: $(pwsh --version)"
echo ""
echo "Cloud & DevOps Tools:"
echo "- Google Cloud CLI: $(gcloud version --format=\"value(Google Cloud SDK)\" 2>/dev/null || echo \"Not authenticated\")"
echo "- Firebase CLI: $(firebase --version)"
echo "- GitHub CLI: $(gh --version | head -1)"
echo "- Terraform: $(terraform --version | head -1)"
echo ""
echo "AI Development Tools:"
echo "- Gemini CLI: $(gemini --version 2>/dev/null || echo \"Available\")"
echo ""
echo "Ready for ASP.NET Core + Blazor + AI + Google Cloud development!"
EOF
RUN chmod +x /home/vscode/show-env.sh

Comment on lines +131 to +138
RUN npm install -g firebase-tools
# and other global npm packages
RUN npm install -g \
@angular/cli \
create-react-app \
typescript \
eslint \
prettier
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To optimize the Docker image and reduce the number of layers, you can combine these npm install -g commands into a single RUN instruction.

RUN npm install -g \
    firebase-tools \
    @angular/cli \
    create-react-app \
    typescript \
    eslint \
    prettier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants