From e04aeff436f9967690a813af1a067478b55ce029 Mon Sep 17 00:00:00 2001 From: Lukas Ciszewski Date: Fri, 19 Dec 2025 01:03:50 +0100 Subject: [PATCH 1/4] Checkpoint from VS Code for coding agent session --- .../themes/lc-magic.zsh-theme | 0 {vscode => .vscode}/keybindings.json | 0 {vscode => .vscode}/mcp.json | 0 {vscode => .vscode}/settings.json | 0 .wslconfig | 56 -- .zshrc | 2 +- Dockerfile | 3 +- GNUmakefile | 198 ++++++ README.md | 584 ------------------ etc/wsl.conf | 10 - github/README.md | 47 -- github/chatmodes/lc-architect.chatmode.md | 37 -- github/chatmodes/reviewer.chatmode.md | 114 ---- github/chatmodes/senior-dev.chatmode.md | 37 -- github/copilot-instructions.md | 116 ---- github/instructions/base.instructions.md | 4 - github/instructions/merge.instructions.md | 99 --- github/instructions/review.instructions.md | 58 -- github/prompts/code-generation.prompt.md | 48 -- github/prompts/debugging.prompt.md | 48 -- github/prompts/refactoring.prompt.md | 48 -- github/prompts/testing.prompt.md | 49 -- templates/.gitlab-ci.yml | 219 ------- templates/.releaserc.json | 60 -- 24 files changed, 201 insertions(+), 1636 deletions(-) rename {oh-my-zsh-custom => .oh-my-zsh-custom}/themes/lc-magic.zsh-theme (100%) rename {vscode => .vscode}/keybindings.json (100%) rename {vscode => .vscode}/mcp.json (100%) rename {vscode => .vscode}/settings.json (100%) delete mode 100644 .wslconfig create mode 100644 GNUmakefile delete mode 100644 etc/wsl.conf delete mode 100644 github/README.md delete mode 100644 github/chatmodes/lc-architect.chatmode.md delete mode 100644 github/chatmodes/reviewer.chatmode.md delete mode 100644 github/chatmodes/senior-dev.chatmode.md delete mode 100644 github/copilot-instructions.md delete mode 100644 github/instructions/base.instructions.md delete mode 100644 github/instructions/merge.instructions.md delete mode 100644 github/instructions/review.instructions.md delete mode 100644 github/prompts/code-generation.prompt.md delete mode 100644 github/prompts/debugging.prompt.md delete mode 100644 github/prompts/refactoring.prompt.md delete mode 100644 github/prompts/testing.prompt.md delete mode 100644 templates/.gitlab-ci.yml delete mode 100644 templates/.releaserc.json diff --git a/oh-my-zsh-custom/themes/lc-magic.zsh-theme b/.oh-my-zsh-custom/themes/lc-magic.zsh-theme similarity index 100% rename from oh-my-zsh-custom/themes/lc-magic.zsh-theme rename to .oh-my-zsh-custom/themes/lc-magic.zsh-theme diff --git a/vscode/keybindings.json b/.vscode/keybindings.json similarity index 100% rename from vscode/keybindings.json rename to .vscode/keybindings.json diff --git a/vscode/mcp.json b/.vscode/mcp.json similarity index 100% rename from vscode/mcp.json rename to .vscode/mcp.json diff --git a/vscode/settings.json b/.vscode/settings.json similarity index 100% rename from vscode/settings.json rename to .vscode/settings.json diff --git a/.wslconfig b/.wslconfig deleted file mode 100644 index 7e58bb8..0000000 --- a/.wslconfig +++ /dev/null @@ -1,56 +0,0 @@ -# Settings apply across all Linux distros running on WSL 2 -[wsl2] - -# Limits VM memory to use no more than 4 GB, this can be set as whole numbers using GB or MB -memory=16GB - -# Sets the VM to use two virtual processors -processors=2 - -# Specify a custom Linux kernel to use with your installed distros. -# The default kernel used can be found at https://github.com/microsoft/WSL2-Linux-Kernel -#kernel=C:\\temp\\myCustomKernel - -# Sets additional kernel parameters, in this case enabling older Linux base images such as Centos 6 -# kernelCommandLine = vsyscall=emulate - -# Sets amount of swap storage space to 8GB, default is 25% of available RAM -swap=8GB - -# Sets swapfile path location, default is %USERPROFILE%\AppData\Local\Temp\swap.vhdx -swapfile=C:\\temp\\wsl-swap.vhdx - -# Disable page reporting so WSL retains all allocated memory claimed from Windows and releases none back when free -pageReporting=false - -# Turn off default connection to bind WSL 2 localhost to Windows localhost -localhostForwarding=true - -# Disables nested virtualization -nestedVirtualization=true - -# Sets the networking mode -#networkingMode=mirrored -networkingMode=NAT - -# Sets dns proxy method -# Only for networkingMode=NAT -dnsProxy=true - -# Sets dns proxy method -dnsTunneling=true - -# Disables gui application support -guiApplications=true - -# Turns on output console showing contents of dmesg when opening a WSL 2 distro for debugging -#debugConsole=true - -[boot] -command = /bin/bash -c 'chown -v root:kvm /dev/kvm && chmod 660 /dev/kvm' - -# Experimental -[experimental] - -# Ignored Ports, only on Linux -ignoredPorts=8080,4180 \ No newline at end of file diff --git a/.zshrc b/.zshrc index 5d247de..0fc685b 100755 --- a/.zshrc +++ b/.zshrc @@ -89,6 +89,7 @@ alias gcc='git checkout -B $(gum input --prompt "branch name: ") && git add . && ### alcoholics # Aliases +alias make=gmake alias pwd="pwd -P" alias wsl="wsl.exe" @@ -99,7 +100,6 @@ alias wsl="wsl.exe" . <(glab completion -s zsh) #. <(operator-sdk completion zsh) #. <(k8sgpt completion zsh) -jira completion zsh > "${fpath[1]}/_jira" [[ "$TERM_PROGRAM" == "vscode" ]] && . "$(code --locate-shell-integration-path zsh)" diff --git a/Dockerfile b/Dockerfile index 30ce75c..7b40bfa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,9 @@ # Complete CLI development environment FROM ubuntu:22.04 -ARG TARGETPLATFORM +ARG TARGETOS ARG TARGETARCH +ARG TARGETPLATFORM ENV DEBIAN_FRONTEND=noninteractive ENV TZ=UTC diff --git a/GNUmakefile b/GNUmakefile new file mode 100644 index 0000000..abfb3f5 --- /dev/null +++ b/GNUmakefile @@ -0,0 +1,198 @@ +#!/usr/bin/env make -f +# ============================================================================ +# Dotfiles - DevOps Workspace Automation Framework +# ============================================================================ +# Production-ready dotfiles management framework for DevOps workspaces. +# Provides tools and scripts to automate setup, configuration, and maintenance +# of development environments. +# +# Repository: +# https://github.com/laidback/dotfiles +# ============================================================================ + +# ============================================================================ +# Global Variables, Constants and Settings +# ============================================================================ +.ONESHELL: +.POSIX: +.DELETE_ON_ERROR: + +# Global Make settings +SHELL := /usr/local/bin/bash +.SHELLFLAGS := -o errexit -o errtrace -o nounset -o pipefail -c +MAKEFLAGS += --warn-undefined-variables +MAKEFLAGS += --no-builtin-rules +#.RECIPEPREFIX := > + +# Logging and Trace mode - Configure Makefile.sh +VERBOSE ?= $(shell echo $${VERBOSE:-info}) +TRACE ?= false + +# Global platform detection and settings +OS ?= $(shell uname -s | tr '[:upper:]' '[:lower:]') +ARCH ?= $(shell uname -m | tr '[:upper:]' '[:lower:]') +PLATFORM := $(OS)/$(ARCH) + +# Script path variables +SCRIPT_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) +SCRIPT_NAME := $(basename $(SCRIPT_PATH)) +SCRIPT_DIR := $(abspath $(dir $(SCRIPT_PATH))) +~ := $(abspath $(SCRIPT_DIR)/~) + +# Project metadata +PROJECT_NAME := dotfiles +GIT_BRANCH := $(shell git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown branch") +GIT_COMMIT := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown commit") +GIT_TAG := $(shell git describe --tags --exact-match 2>/dev/null || echo "unknown tag") +BUILD_DATE := $(shell date -u '+%Y-%m-%d_%H:%M:%S') + +# Set version based on latest tag or default +ifeq ($(GIT_TAG),unknown tag) + VERSION := $(GIT_COMMIT) +else + VERSION := $(GIT_TAG) +endif + +# Project specific directories +TMP_DIR := $(SCRIPT_DIR)/tmp +BUILD_DIR := $(SCRIPT_DIR)/build +SCRIPTS_DIR := $(SCRIPT_DIR)/scripts + +# Tool requirements +BASH := TODO +MBAKE:= $(shell command -v mbake 2>/dev/null || echo "mbake makefile linter") +GUM := $(shell command -v gum 2>/dev/null || echo "/usr/local/bin/gum") +AWK := $(shell command -v awk 2>/dev/null || echo "/usr//bin/awk") +REQUIRED_TOOLS_CORE := bash git jq yq tree curl make gum shfmt shellcheck yamllint prettier +REQUIRED_TOOLS_NODE := node npm +REQUIRED_TOOLS_AGENT := ollama + +# Combined tool lists +REQUIRED_TOOLS := $(REQUIRED_TOOLS_CORE) $(REQUIRED_TOOLS_NODE) $(REQUIRED_TOOLS_AGENT) + +# ============================================================================= +# 🎨 Terminal Colors & Emoji +# ============================================================================= +# Use ANSI escape codes for colored output in terminal +# Colors +#BLUE := \033[34m +#GREEN := \033[32m +#YELLOW := \033[33m +#RED := \033[31m +#MAGENTA := \033[35m +#CYAN := \033[36m +#WHITE := \033[37m +#BOLD := \033[1m +#RESET := \033[0m + +# Color Codes for gum logger +BLUE=4 +GREEN=2 +LIGHT_GREEN=10 +ORANGE=214 +RED=9 +MAGENTA=212 +CYAN=39 +WHITE=15 +GREY=240 +DARK_GREY=8 + +# Status Indicators +INFO := @printf "$(BLUE)â„šī¸ %s$(RESET)\n" +SUCCESS := @printf "$(GREEN)✅ %s$(RESET)\n" +WARN := @printf "$(YELLOW)âš ī¸ %s$(RESET)\n" +ERROR := @printf "$(RED)❌ %s$(RESET)\n" +WORKING := @printf "$(CYAN)🔨 %s$(RESET)\n" +DEBUG := @printf "$(MAGENTA)🔍 %s$(RESET)\n" +ROCKET := @printf "$(GREEN)🚀 %s$(RESET)\n" +PACKAGE := @printf "$(CYAN)đŸ“Ļ %s$(RESET)\n" +TRASH := @printf "$(YELLOW)đŸ—‘ī¸ %s$(RESET)\n" + +# =========================================================================== +# Rule Templates +# =========================================================================== + + +# =========================================================================== +# Project specific Targets +# =========================================================================== +# TODO: Propose how to structure the makefile targets. +# Follow as high level structure the abstract ci/cd steps: +# - .pre, build, test, package, validate, security, release, deploy, .post +# - Separate targets such that ci/cd pipelines can call them individually +# - Create a phony dummy target for each step of the ci/cd process +# Some dotfiles symlinks +~/%: $(~)/% + mkdir -p $(@D) + ln -sfn $< $@ + +ifeq (docker, $(firstword $(MAKECMDGOALS))) + DOCKER_CMD := $(word 2, $(MAKECMDGOALS)) + DOCKER_ARGS := $(wordlist 3, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)) +# $(eval $(DOCKER_CMD)) +# $(eval $(DOCKER_ARGS)) +endif + +docker: + @echo "Docker target - to be implemented" + echo "Docker cmd: $(DOCKER_CMD)" + echo "Docker args: $(DOCKER_ARGS)" + +git: + echo "Git target - to be implemented" + +# =========================================================================== +# Version and Information Targets +# =========================================================================== +version: ## Show version information + @echo "$(PROJECT_NAME) version: $(VERSION)" + echo "Git branch: $(GIT_BRANCH)" + echo "Git commit: $(GIT_COMMIT)" + echo "Build date: $(BUILD_DATE)" + +info: ## Show project information + @echo "$(PROJECT_NAME) Information" + echo + echo "Version: $(VERSION)" + echo "Git branch: $(GIT_BRANCH)" + echo "Git commit: $(GIT_COMMIT)" + echo "Build date: $(BUILD_DATE)" + echo "Platform: $(PLATFORM)" + echo + echo "Required tools:" + @for tool in $(REQUIRED_TOOLS); do \ + if command -v $$tool >/dev/null 2>&1; then \ + echo " - $$tool: installed"; \ + else \ + echo " - $$tool: not installed"; \ + fi \ + done + +log_header = @$(GUM) style --foreground $(2) $(1) +log_body = @$(GUM) style --foreground $(2) " $(1)" + +define help.Targets +BEGIN { \ + FS = ":.*##"; \ + printf "Usage: make [target] [options]\n\n" \ +} \ + "Available targets:\n\n" \ + " %-20s %s\n", "target", "description" \ +} \ +/^[a-zA-Z_-]+:.*?##/ { \ + printf " %-20s %s\n", $$1, $$2 \ +} \ +/^##@/ { \ + printf "\n%s\n", substr($$0, 5) \ +} +endef +export help.Targets + +.PHONY: help +help: ## Show this help message + @$(call log_header,Targets:,$(ORANGE)) + awk """$(help.Targets)""" $(MAKEFILE_LIST) + +.DEFAULT_GOAL := help + +# vim: set ft=make noexpandtab ts=4 sw=4 sts=4 copyindent preserveindent: \ No newline at end of file diff --git a/README.md b/README.md index 05503da..e69de29 100644 --- a/README.md +++ b/README.md @@ -1,584 +0,0 @@ -# Installation Guide - -## VSCode VIM stuff - -````markdown -# Personal Dotfiles - -> Lean CLI development environment - Your personal keychain to productive terminal work - -## What This Is - -Personal dotfiles for cross-platform CLI development (macOS/WSL2/Linux). Foundation for the [DevOps Copilot Framework](https://git.buts.hilti.cloud/ci24/devops-copilot). - -**Core Philosophy**: Everything you need in a container. The Dockerfile is the single source of truth. - -## Quick Start - -```bash -# Clone -export REPOS="${HOME}/repos" -export LAIDBACK="github.com/laidback" -mkdir -p "${REPOS}/${LAIDBACK}" -git clone "https://${LAIDBACK}/dotfiles" "${REPOS}/${LAIDBACK}/dotfiles" -cd "${REPOS}/${LAIDBACK}/dotfiles" - -# Setup (requires root) -sudo ./01-setup_dev_vm.sh # Base: shell, vim, languages -./02-setup_dev_env.sh # DevOps: docker, k8s, cloud tools - -# Or use Docker -docker build -t dotfiles . -docker run -it dotfiles -``` - -## What's Inside - -**Core Files**: -- `.zshrc` - Zsh config with vi-mode, starship, smart completions -- `.vimrc` - Vim config with plugins and GitHub Copilot -- `.wslconfig` - WSL2 tuning (16GB RAM, 2 CPUs) -- `Dockerfile` - Complete dev environment in a container - -**Shell** (Zsh): -- Starship prompt + zoxide + vi-mode (`jk` to escape) -- Auto-suggestions, syntax highlighting -- kubectl, helm, flux completions -- Git aliases: `gap` (add/commit/push), `gcc` (branch/commit), `glog` (pretty log) - -**Vim**: -- Vundle + vim-plug for plugins -- NERDTree, syntastic, vim-fugitive, vim-airline -- GitHub Copilot ready -- Leader key: `` - -**DevOps Stack**: -- Docker, kubectl, helm, krew, flux, kustomize -- kind, stern, glab (GitLab CLI) -- AWS CLI with completions -- Go 1.21.5, Node.js 21, Java 21 LTS, Python 3 - -**AI Tools**: -- Charm: gum, mods, skate, glow -- GitHub Copilot (vim + VS Code) -- Custom chatmodes in `github/` directory## VS Code (Private Config) - -**Note**: VS Code settings in `vscode/` are templates. Keep your personal settings private: - -```bash -# Option 1: Git ignore your personal VS Code config -echo "vscode/settings.local.json" >> .git/info/exclude - -# Option 2: Use a private repo for VS Code settings -# Keep vscode/ templates here, actual config in private repo -``` - -**VS Code Integration**: -- Full `.vimrc` support via vim extension -- GitHub Copilot + MCP (Model Context Protocol) enabled -- Kubernetes tools with macOS ARM64 paths pre-configured -- Terminal auto-approve for git/npm commands - -## Manual Steps (After Automated Setup) - -```bash -# 1. Vim plugins -vim +PlugUpdate +qall && vim +PluginInstall +qall - -# 2. GitHub Copilot (in vim) -# :Copilot setup - -# 3. API keys (using Charm skate) -skate set github.com -skate set openai.com - -# 4. YouCompleteMe (optional) -python3 ~/.vim/bundle/YouCompleteMe/install.py --all -``` - -``` -// Place your key bindings in this file to override the defaults -[{ - "key": "ctrl+l", - "command": "workbench.action.focusActiveEditorGroup", - "when": "explorerViewletFocus" -}, -{ - "key": "ctrl+k", - "command": "workbench.action.focusActiveEditorGroup", -}, -{ - "key": "ctrl+j", - "command": "workbench.action.terminal.focus", - "when": "terminalFocus" -}, -{ - "key": "ctrl+z", - "command": "workbench.action.toggleMaximizedPanel", - "when": "terminalFocus" -}] -``` - -## Step 1 - Setup WSL - -Unregister your current Ubuntu distribution and reinstall Ubuntu on the Windows Subsystem for Linux (WSL): - -```bash -wsl.exe --unregister Ubuntu -wsl.exe --install Ubuntu -``` -## Step2 - Environment Setup - -Set the language locale to en_US.UTF-8, update and upgrade existing packages, add Git and Vim PPAs: - -```bash -locale-gen en_US.UTF-8 -apt update -y && apt upgrade -y -add-apt-repository ppa:git-core/ppa -y -add-apt-repository ppa:jonathonf/vim -y -``` - -## Step 3 - NodeSource Setup - -Download, setup and remove the NodeSource setup script: - -```bash -curl -SLO https://deb.nodesource.com/nsolid_setup_deb.sh -chmod 500 nsolid_setup_deb.sh -./nsolid_setup_deb.sh 21 -rm --force nsolid_setup_deb.sh -``` - -## Step 4 - Installing base packages - -Install base packages like zsh, git, vim, Node.js, Vim-Nox, build-essential, python3-dev, etc: - -```bash -apt update && apt install zsh git vim \ - nodejs vim-nox build-essential cmake \ - python3-dev mono-complete openjdk-17-jdk openjdk-17-jre -y -``` - -## Step 5 - Cloning Repos - -Set up the repo paths and clone the dotfiles repo: - -```bash -export REPOS=$HOME/repos -export LAIDBACK=github.com/laidback -export DOTFILES=$REPOS/$LAIDBACK/dotfiles -git clone https://$LAIDBACK/dotfiles $DOTFILES -``` - -## Step 6 - Installing GoLang - -Remove any previously installed version of golang and install the updated golang: - -```bash -rm -rf /usr/local/go -curl -sLO https://go.dev/dl/go1.21.5.linux-amd64.tar.gz -tar -C /usr/local -xzf go1.21.5.linux-amd64.tar.gz -rm go1.21.5.linux-amd64.tar.gz -GOROOT=/usr/local/go -``` -Add the Go path to your system path: - -```bash -export PATH=$PATH:/usr/local/go/bin -``` - -## Step 7 - Customizing Shell - -Change your default shell to ZSH: - -```bash -chsh -s /bin/zsh $USER -``` - -## Step 8 - Installing Oh-My-Zsh - -Remove any older version of Oh-My-Zsh and install the latest version: - -```bash -test -d $HOME/.oh-my-zsh && rm -rf $HOME/.oh-my-zsh -curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh | zsh -``` - -## Step 9 - Installing dotfiles - -Remove existing .zshrc and link the new .zshrc -Set up a zsh custom directory: - -```bash -ln -s $DOTFILES/.zshrc $HOME/.zshrc -export ZSH_CUSTOM=$HOME/oh-my-zsh-custom -ln -s $DOTFILES/oh-my-zsh-custom/ $ZSH_CUSTOM -``` - -## Step 10 - Installing Plugins - -Clone zsh plugins into the custom/plugins directory: - -```bash -mkdir -p ${ZSH_CUSTOM}/plugins -git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM}/plugins/zsh-autosuggestions -git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM}/plugins/zsh-syntax-highlighting -git clone https://github.com/jeffreytse/zsh-vi-mode ${ZSH_CUSTOM}/plugins/zsh-vi-mode -``` - -## Step 11 - Installing zoxide and starship - -```bash -curl -sS https://raw.githubusercontent.com/ajeetdsouza/zoxide/main/install.sh | zsh -curl -sS https://starship.rs/install.sh | sh -s -- --yes -``` -Link the configuration file: - -```bash -ln -s $DOTFILES/.config .config -``` - -## Step 12 - Vim Setup - -Set up the Vim package managers, install the dotfiles, Github copilot and Charm: - -```bash -curl -fLo ~/.vim/autoload/plug.vim --create-dirs \ - https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim -git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim -ln -s $DOTFILES/.vimrc $HOME/.vimrc -git clone https://github.com/github/copilot.vim.git ~/.vim/pack/github/start/copilot.vim -``` - -## Step 13 - Charm Setup - -Download and install the charm packages: - -```bash -mkdir -p /etc/apt/keyrings -curl -fsSL https://repo.charm.sh/apt/gpg.key | gpg --dearmor -o /etc/apt/keyrings/charm.gpg -echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | tee /etc/apt/sources.list.d/charm.list -apt update -y && apt install charm skate mods gum glow -charm completion zsh > "${fpath[1]}/_charm" -``` - -### Add Charm to Systemd - -see: https://github.com/charmbracelet/charm/blob/main/systemd.md - -## Step 14 - Manual Setup - -Perform additional manual setup, such as updating Vim plugins, setting up mods authentication, and compiling YouCompleteMe: - -```bash -vim +PlugUpdate +qall -vim +PluginInstall +qall -skate set github.com https://github.com/settings/tokens -skate set openai.com https://platform.openai.com/api-keys -python3 $HOME/.vim/bundle/YouCompleteMe/install.py --all --force-sudo -``` - -## Installation Process - -### Prerequisites -- Ensure you have `root` user access. - -### Docker Installation - -1. Update the apt package index and install the appropriate dependencies. -``` - apt-get update - apt-get install ca-certificates curl gnupg -y -``` -2. Get Docker's official GPG key and add the repository to apt sources. -``` - install -m 0755 -d /etc/apt/keyrings - curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg - chmod a+r /etc/apt/keyrings/docker.gpg - echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null -``` -3. Install Docker. -``` - apt-get update - apt-get install docker-ce docker-ce-cli containerd.io -y - sudo groupadd docker -``` -4. Add the user to the Docker group. -``` - sudo usermod -aG docker $USER -``` - -### Add Docker to Systemd - -see: https://github.com/moby/moby/blob/master/contrib/init/systemd - -### Kubectl Installation -1. Download kubectl's GPG key and add the repository to apt sources. -``` - curl -fsSL https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - - apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" -``` -2. Install kubectl. -``` - apt-get update - apt-get install kubectl -y -``` - -### Helm Installation -1. Add Helm's GPG key and add the repository to apt sources. -``` - curl https://baltocdn.com/helm/signing.asc | sudo apt-key add - - apt-get install apt-transport-https --yes - echo "deb [arch=$(dpkg --print-architecture)] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list -``` -2. Install Helm. -``` - apt-get update - apt-get install helm -y -``` - -### Krew Installation -1. Install krew. -``` - cd "$(mktemp -d)" && - OS="$(uname | tr '[:upper:]' '[:lower:]')" && - ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" && - KREW="krew-${OS}_${ARCH}" && - curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" && - tar zxvf "${KREW}.tar.gz" && - ./"${KREW}" install krew -``` - -### Go Tools and Kubernetes Packages Installation -1. Install Go tools and packages. -``` - go install sigs.k8s.io/kind@latest - go install github.com/stern/stern@latest -``` -2. Install flux -``` - curl -s https://fluxcd.io/install.sh | sudo bash -``` - -### AWS CLI Installation -1. Download, unzip, and install the AWS CLI. -``` - curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" - unzip awscliv2.zip - sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update - rm -rf ./aws -``` - -### AWS Azure Login Installation -1. Install AWS Azure Login via Node Package Manager. -``` - npm install -g aws-azure-login -``` - -## File Structure - -``` -dotfiles/ -├── Dockerfile # Complete dev environment -├── 01-setup_dev_vm.sh # Base: zsh, vim, Go, Node, Java -├── 02-setup_dev_env.sh # DevOps: docker, k8s, cloud -├── .zshrc # Shell config -├── .vimrc # Vim config -├── .wslconfig # WSL2 tuning -├── vscode/ # VS Code templates (keep private!) -├── github/ # AI chatmodes & instructions -└── oh-my-zsh-custom/ # Shell theme & customizations -``` - -## Keeping VS Code Settings Private - -Your VS Code config often contains personal tokens, workspace paths, and preferences. Here's how to handle it: - -### Option 1: Git Info Exclude (Recommended) -```bash -# Keep in repo but don't commit changes -echo "vscode/settings.local.json" >> .git/info/exclude -echo "vscode/*.local.*" >> .git/info/exclude -``` - -### Option 2: Separate Private Repo -```bash -# Keep dotfiles public, VS Code settings private -# In dotfiles: Only templates -# In private repo: Your actual settings -``` - -### Option 3: Environment-Specific Configs -```bash -vscode/ -├── settings.json # Template (commit this) -├── settings.local.json # Your personal settings (gitignored) -└── keybindings.json # Safe to commit (no secrets) -``` - -## The Dockerfile Approach - -Everything in the setup scripts can run in a container: - -```dockerfile -# See Dockerfile for full setup -docker build -t dotfiles . -docker run -it dotfiles - -# Your entire dev environment, portable -``` - -**Why containerize?**: -- Consistent environment across machines -- Test setup scripts safely -- Share dev environment with team -- Fast machine onboarding - -## Advanced Configuration - -### Cross-Platform Support - -#### macOS-specific - -```bash -# Colima for Docker (macOS alternative to Docker Desktop) -export DOCKER_HOST="unix://${HOME}/.colima/default/docker.sock" - -# Homebrew-managed Go installation -export GOROOT=$(brew --prefix golang)/libexec -``` - -#### WSL2-specific - -- Memory: 16GB allocated (`.wslconfig`) -- Networking: NAT mode with DNS tunneling -- Integration: systemd boot commands for KVM permissions - -### Kubernetes Workflows - -```bash -# Switch between kubeconfig files interactively -ktx - -# Switch namespace in current context -kns - -# View logs across multiple pods -stern - -# Quick cluster creation with kind -kind create cluster --name dev -``` - -### Git Workflows - -```bash -# Add all, commit with prompt, and push -gap - -# Create branch, add all, commit with prompts -gcc - -# Pretty git log with colors -glog -``` - -## Manual Setup Steps - -After automated installation, perform these steps: - -### 1. Vim Plugins - -```bash -vim +PlugUpdate +qall -vim +PluginInstall +qall -``` - -### 2. GitHub Copilot Authentication - -```bash -vim -# Inside vim, run: :Copilot setup -``` - -### 3. API Keys Setup (using Charm Skate) - -```bash -skate set github.com -skate set openai.com - -export GITHUB_TOKEN=$(skate get github.com) -export OPENAI_API_KEY=$(skate get openai.com) -``` - -### 4. YouCompleteMe Compilation - -```bash -python3 ~/.vim/bundle/YouCompleteMe/install.py --all --force-sudo -``` - -### 5. Systemd Integration (Optional) - -- [Charm systemd setup](https://github.com/charmbracelet/charm/blob/main/systemd.md) -- [Docker systemd setup](https://github.com/moby/moby/blob/master/contrib/init/systemd) - -## Repository Structure - -``` -dotfiles/ -├── 01-setup_dev_vm.sh # Base system + shell setup -├── 02-setup_dev_env.sh # Development tools installation -├── .zshrc # Zsh configuration -├── .vimrc # Vim configuration -├── .wslconfig # WSL2 settings -├── .config/ # Application configs -│ └── starship.toml # Starship prompt config -├── .github/ # GitHub-specific configs -│ └── copilot-instructions.md # AI coding guidelines -├── github/ # AI chatmodes & instructions -│ ├── chatmodes/ # AI persona definitions -│ ├── instructions/ # Coding standards -│ └── prompts/ # Task templates -├── oh-my-zsh-custom/ # Zsh customizations -│ ├── plugins/ # Additional plugins -│ └── themes/ # Custom themes -├── templates/ # Project templates -│ ├── .gitlab-ci.yml # CI/CD template -│ └── .releaserc.json # Semantic release config -└── vscode/ # VS Code templates - ├── settings.json # Editor preferences - └── keybindings.json # Custom keybindings -``` - -## Integration with DevOps Copilot - -This repository serves as the base configuration layer for the [DevOps Copilot Framework](https://git.buts.hilti.cloud/ci24/devops-copilot), providing: - -- **Consistent Environment**: Shared shell, editor, and tool configurations -- **AI Instructions**: Reusable chatmodes and coding standards -- **Automation Scripts**: Template-based repository initialization -- **Tool Chain**: Common DevOps utilities across all projects - -## Additional Tools (Optional) - -For enhanced security and networking capabilities: - -- **Mullvad VPN**: Client and CLI for secure connections -- **IPFS**: Distributed file system -- **iperf3**: Network performance measurement -- **shadowsocks**: Secure tunneling - -## Resources - -- [Oh My Zsh](https://ohmyz.sh/) -- [Starship Prompt](https://starship.rs/) -- [GitHub Copilot](https://github.com/features/copilot) -- [Charm Tools](https://charm.sh/) -- [Proto School](https://proto.school/) - Learn web3 protocols - ---- - -**License**: MIT -**Maintained by**: [@laidback](https://github.com/laidback) - -```` diff --git a/etc/wsl.conf b/etc/wsl.conf deleted file mode 100644 index eeb8480..0000000 --- a/etc/wsl.conf +++ /dev/null @@ -1,10 +0,0 @@ -[boot] -systemd = true - -[network] -generateHosts = true -generateResolvConf = true -hostname = wakanda - -[user] -default = laid \ No newline at end of file diff --git a/github/README.md b/github/README.md deleted file mode 100644 index 296282b..0000000 --- a/github/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Quick Reference Guide - -## File Structure Overview -``` -.github/ -├── instructions/ # Development guidelines and processes -│ ├── instructions.md # Global AI instructions -│ ├── mr-guidelines.md # Merge request guidelines -│ ├── code-review.md # Code review standards -│ └── development-workflow.md # Team workflow -├── prompts/ # AI prompts for specific tasks -│ ├── code-generation.md -│ ├── debugging.md -│ ├── refactoring.md -│ └── testing.md -└── modes/ # AI persona modes - ├── senior-dev.md - ├── architect.md - └── reviewer.md -``` - -## How to Use These Templates - -### For AI Interactions -1. Reference specific prompt files: `@prompts/code-generation.md` -2. Set AI mode: `Use @modes/architect.md persona` -3. Apply guidelines: `Follow @instructions/mr-guidelines.md` - -### For Team Usage -- Customize templates to match your team's practices -- Add project-specific guidelines -- Update regularly based on team feedback -- Use as onboarding material for new team members - -### Common Commands -- `@prompts/debugging.md help me debug [issue]` -- `@modes/reviewer.md review this code` -- `@instructions/development-workflow.md how should I handle [scenario]` - -## Customization Tips -- Add your team's specific coding standards -- Include project-specific architecture patterns -- Reference your preferred tools and frameworks -- Add links to internal documentation -- Include contact information for help - - diff --git a/github/chatmodes/lc-architect.chatmode.md b/github/chatmodes/lc-architect.chatmode.md deleted file mode 100644 index 0959579..0000000 --- a/github/chatmodes/lc-architect.chatmode.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: Design and architect software systems with focus on scalability, performance, and long-term maintainability. -tools: ['codebase', 'fetch', 'search', 'usages', 'githubRepo'] -model: Claude Sonnet 4 ---- -# Software Architect Mode - -## Persona -Act as a software architect with expertise in: -- System design and architecture patterns -- Scalability and performance optimization -- Technology selection and evaluation -- Cross-cutting concerns and non-functional requirements -- Enterprise integration patterns - -## Approach -- Focus on high-level system design -- Consider scalability, reliability, and maintainability -- Evaluate technology choices and their implications -- Design for future growth and changes -- Balance technical debt with business requirements - -## Design Considerations -- Microservices vs monolithic architecture -- Data consistency and transaction boundaries -- Caching strategies and performance optimization -- Security architecture and compliance -- Monitoring, logging, and observability - -## Communication Style -- Think in terms of systems and components -- Consider non-functional requirements -- Discuss trade-offs and architectural decisions -- Provide strategic technical guidance -- Focus on long-term implications - - diff --git a/github/chatmodes/reviewer.chatmode.md b/github/chatmodes/reviewer.chatmode.md deleted file mode 100644 index 3693659..0000000 --- a/github/chatmodes/reviewer.chatmode.md +++ /dev/null @@ -1,114 +0,0 @@ ---- -description: Provide thorough automated code reviews and merge approved code automatically. -tools: ['codebase', 'search', 'usages', 'findTestFiles', 'githubRepo'] -model: Claude Sonnet 4 ---- - -# Automated Code Reviewer Mode - -## Persona - -Act as an automated code reviewer that: - -- Performs thorough code reviews automatically -- Provides constructive feedback and suggestions -- Automatically merges code that meets quality standards -- Maintains high code quality and security standards -- Ensures compliance with team guidelines and best practices - -## Automated Review Process - -1. **Pre-Review Checks** - - - [ ] All CI/CD pipelines pass - - [ ] No merge conflicts exist - - [ ] MR has proper description and ticket reference - - [ ] Branch is up-to-date with target branch - -2. **Code Quality Assessment** - - - [ ] Code follows team conventions and style guides - - [ ] Functions and classes have single responsibilities - - [ ] Error handling is comprehensive and appropriate - - [ ] Security considerations are addressed - - [ ] Performance implications are considered - - [ ] Tests are adequate and meaningful (>80% coverage) - - [ ] Documentation is clear and up-to-date - -3. **Security Review** - - - [ ] No hardcoded secrets or credentials - - [ ] Input validation is proper - - [ ] Authentication/authorization is correct - - [ ] Sensitive data is handled securely - - [ ] Dependencies are up-to-date and secure - -4. **Automated Actions** - - **Auto-Approve**: If all checks pass and changes are low-risk - - **Auto-Merge**: If approved and meets merge criteria - - **Request Changes**: If issues found, provide detailed feedback - - **Assign Reviewers**: If manual review needed for complex changes - -## Auto-Merge Criteria - -- All automated checks pass -- Code coverage remains above 80% -- No breaking changes detected -- Proper ticket reference (BAR-XXX format) -- Follows conventional commit messages -- No critical security vulnerabilities -- Performance benchmarks met - -## Review Categories - -### ✅ Auto-Merge (Low Risk) - -- Documentation updates -- Minor bug fixes -- Test additions -- Configuration changes -- Dependency updates (non-breaking) - -### 🔍 Manual Review Required (Medium/High Risk) - -- New features or major changes -- Database schema modifications -- Security-related changes -- API breaking changes -- Performance-critical modifications - -## Feedback Style - -- Provide specific, actionable suggestions -- Include code examples for improvements -- Explain the "why" behind each recommendation -- Recognize good practices and improvements -- Balance automation with human insight -- Focus on education and knowledge sharing - -## Integration Commands - -- `@reviewer auto-review` - Perform automated review -- `@reviewer approve-and-merge` - Auto-approve and merge if criteria met -- `@reviewer security-scan` - Focus on security review -- `@reviewer performance-check` - Analyze performance impact - -## Workflow Integration - -When a new MR is created: - -1. Automatically trigger review process -2. Run all quality checks and tests -3. Provide feedback or approve based on criteria -4. Auto-merge if all conditions are met -5. Notify team of actions taken -6. Update ticket status accordingly - -## Error Handling - -- If automated checks fail, provide clear error messages -- Suggest specific fixes for common issues -- Escalate complex issues to human reviewers -- Log all automated actions for audit trail - - diff --git a/github/chatmodes/senior-dev.chatmode.md b/github/chatmodes/senior-dev.chatmode.md deleted file mode 100644 index fae6413..0000000 --- a/github/chatmodes/senior-dev.chatmode.md +++ /dev/null @@ -1,37 +0,0 @@ ---- -description: Act as a senior software developer with 10+ years of experience, focusing on best practices and mentoring. -tools: ['codebase', 'fetch', 'search', 'usages', 'githubRepo', 'findTestFiles'] -model: Claude Sonnet 4 ---- -# Senior Developer Mode - -## Persona -Act as a senior software developer with 10+ years of experience. Focus on: -- Best practices and design patterns -- Long-term maintainability -- Performance and scalability -- Code quality and architecture -- Mentoring and knowledge sharing - -## Approach -- Consider the bigger picture and system architecture -- Suggest improvements beyond immediate requirements -- Think about edge cases and potential issues -- Recommend industry standards and best practices -- Balance pragmatism with technical excellence - -## Code Review Focus -- Architecture and design patterns -- Performance implications -- Security considerations -- Maintainability and readability -- Test coverage and quality - -## Communication Style -- Provide detailed explanations -- Share reasoning behind decisions -- Suggest alternatives and trade-offs -- Include references to best practices -- Mentor through examples and guidance - - diff --git a/github/copilot-instructions.md b/github/copilot-instructions.md deleted file mode 100644 index 4ff6375..0000000 --- a/github/copilot-instructions.md +++ /dev/null @@ -1,116 +0,0 @@ -# AI Coding Instructions for Workspaces Configuration Repository - -## Project Overview - -This is a configuration management repository for AI development tools, primarily focused on GitHub Copilot, MCP (Model Context Protocol) servers, and VS Code workspace settings. The repository serves as a centralized hub for AI coding standards and development environment configurations. - -## Architecture & Key Components - -### MCP Server Configuration - -- **Primary config**: `.vscode/mcp.json` defines server connections -- **Internal GitLab**: Uses custom API endpoint `git.buts.hilti.cloud/api/v4` -- **Token management**: Environment variables via VS Code input prompts -- **Server types**: Mixed stdio (npx commands) and HTTP (SSE) connections - -### AI Instructions Hierarchy - -1. **Global**: `.vscode/copilot-instructions.md` - applies to all files -2. **Targeted**: `.github/instructions/*.instructions.md` - specific patterns -3. **Context-aware**: `.github/chatmodes/*.chatmode.md` - persona-based interactions - -## Critical Workflows - -### MCP Server Setup - -```bash -# Use the provided setup script -./scripts/setup.sh -# This installs: @playwright/mcp, @zereight/mcp-gitlab, @azure/mcp -``` - -### Token Configuration - -- GitLab tokens are prompted via VS Code inputs (see `mcp.json` inputs section) -- Never hardcode tokens - always use `${input:token-name}` pattern -- Token descriptions should clearly indicate the service and permissions needed - -## Project-Specific Conventions - -### File Naming Patterns - -- Instructions: `*.instructions.md` with frontmatter `applyTo: "**"` -- Chat modes: `*.chatmode.md` with model and tools specification -- Prompts: `*.prompt.md` with mode and requirements metadata - -### Frontmatter Standards - -```markdown ---- -applyTo: '**' # For instructions -model: Claude Sonnet 4 # For chatmodes -mode: 'agent' # For prompts ---- -``` - -### Mandatory AI Edit Markers - -- All AI-generated files must end with: `` -- This is enforced by `base.instructions.md` global rule - -## Integration Points - -### VS Code Workspace Configuration - -- Multi-root workspace: `workspaces.code-workspace` and `wfm.code-workspace` -- MCP integration automatically loads on workspace open -- Copilot instructions are globally applied via `.vscode/` directory - -### External Dependencies - -- **Hilti Internal GitLab**: `git.buts.hilti.cloud` (requires VPN/internal network) -- **Atlassian Cloud**: SSE connection to `mcp.atlassian.com` -- **Azure Services**: Latest MCP server for cloud resource management -- **Playwright**: Browser automation via MCP interface - -## Development Patterns - -### Configuration File Updates - -- When modifying `mcp.json`, validate JSON syntax and test server connections -- Always update corresponding documentation in `README.md` -- Use `npx` commands for portable MCP server execution - -### AI Mode Selection - -- Use `architect.chatmode.md` for system design discussions -- Use `reviewer.chatmode.md` for code quality assessments -- Use `senior-dev.chatmode.md` for implementation guidance - -### Prompt Template Usage - -- Reference specific prompts via `@prompts/filename.prompt.md` -- Templates include requirements for TypeScript, error handling, and testing -- Follow conventional commits and semantic release practices - -## Team Conventions - -- **Commit format**: Conventional commits (`feat:`, `fix:`, `docs:`, etc.) -- **Branch naming**: `feature/[ticket-id]-[description]`, `bugfix/`, `hotfix/` -- **Error handling**: Always implement try/catch for async operations -- **Naming**: PascalCase for types/interfaces, camelCase for functions/variables - -## Quick Reference Commands - -```bash -# Test MCP connection -npx @zereight/mcp-gitlab --version - -# Validate workspace configuration -code --list-extensions | grep copilot - -# Reload VS Code window to apply new MCP configs -# Command Palette > "Developer: Reload Window" -``` - - diff --git a/github/instructions/base.instructions.md b/github/instructions/base.instructions.md deleted file mode 100644 index bc19351..0000000 --- a/github/instructions/base.instructions.md +++ /dev/null @@ -1,4 +0,0 @@ ---- -applyTo: "**" ---- -Add a comment at the end of the file: 'Contains AI-generated edits.' diff --git a/github/instructions/merge.instructions.md b/github/instructions/merge.instructions.md deleted file mode 100644 index 79f4ca7..0000000 --- a/github/instructions/merge.instructions.md +++ /dev/null @@ -1,99 +0,0 @@ ---- -description: Provide thorough automated code reviews and merge approved code automatically. -tools: ['codebase', 'search', 'usages', 'findTestFiles', 'githubRepo', 'gitlab'] -model: Claude Sonnet 4 ---- -# Automated Code Reviewer Mode - -## Persona -Act as an automated code reviewer that: -- Performs thorough code reviews automatically -- Provides constructive feedback and suggestions -- Automatically merges code that meets quality standards -- Maintains high code quality and security standards -- Ensures compliance with team guidelines and best practices - -## Automated Review Process -1. **Pre-Review Checks** - - [ ] All CI/CD pipelines pass - - [ ] No merge conflicts exist - - [ ] MR has proper description and ticket reference - - [ ] Branch is up-to-date with target branch - -2. **Code Quality Assessment** - - [ ] Code follows team conventions and style guides - - [ ] Functions and classes have single responsibilities - - [ ] Error handling is comprehensive and appropriate - - [ ] Security considerations are addressed - - [ ] Performance implications are considered - - [ ] Tests are adequate and meaningful (>80% coverage) - - [ ] Documentation is clear and up-to-date - -3. **Security Review** - - [ ] No hardcoded secrets or credentials - - [ ] Input validation is proper - - [ ] Authentication/authorization is correct - - [ ] Sensitive data is handled securely - - [ ] Dependencies are up-to-date and secure - -4. **Automated Actions** - - **Auto-Approve**: If all checks pass and changes are low-risk - - **Auto-Merge**: If approved and meets merge criteria - - **Request Changes**: If issues found, provide detailed feedback - - **Assign Reviewers**: If manual review needed for complex changes - -## Auto-Merge Criteria -- All automated checks pass -- Code coverage remains above 80% -- No breaking changes detected -- Proper ticket reference (BAR-XXX format) -- Follows conventional commit messages -- No critical security vulnerabilities -- Performance benchmarks met - -## Review Categories - -### ✅ Auto-Merge (Low Risk) -- Documentation updates -- Minor bug fixes -- Test additions -- Configuration changes -- Dependency updates (non-breaking) - -### 🔍 Manual Review Required (Medium/High Risk) -- New features or major changes -- Database schema modifications -- Security-related changes -- API breaking changes -- Performance-critical modifications - -## Feedback Style -- Provide specific, actionable suggestions -- Include code examples for improvements -- Explain the "why" behind each recommendation -- Recognize good practices and improvements -- Balance automation with human insight -- Focus on education and knowledge sharing - -## Integration Commands -- `@reviewer auto-review` - Perform automated review -- `@reviewer approve-and-merge` - Auto-approve and merge if criteria met -- `@reviewer security-scan` - Focus on security review -- `@reviewer performance-check` - Analyze performance impact - -## Workflow Integration -When a new MR is created: -1. Automatically trigger review process -2. Run all quality checks and tests -3. Provide feedback or approve based on criteria -4. Auto-merge if all conditions are met -5. Notify team of actions taken -6. Update ticket status accordingly - -## Error Handling -- If automated checks fail, provide clear error messages -- Suggest specific fixes for common issues -- Escalate complex issues to human reviewers -- Log all automated actions for audit trail - - \ No newline at end of file diff --git a/github/instructions/review.instructions.md b/github/instructions/review.instructions.md deleted file mode 100644 index 2629c57..0000000 --- a/github/instructions/review.instructions.md +++ /dev/null @@ -1,58 +0,0 @@ -# Code Review Guidelines - -## Review Principles -- Be respectful and constructive -- Focus on the code, not the person -- Explain the reasoning behind suggestions -- Recognize good practices and improvements -- Balance thoroughness with practicality - -## What to Review -### Functionality -- [ ] Code does what it's supposed to do -- [ ] Edge cases are handled -- [ ] Error conditions are managed properly -- [ ] Business logic is correct - -### Code Quality -- [ ] Code is readable and well-structured -- [ ] Functions have single responsibilities -- [ ] Variable and function names are descriptive -- [ ] Code follows team conventions - -### Security -- [ ] Input validation is proper -- [ ] Authentication/authorization is correct -- [ ] Sensitive data is handled securely -- [ ] No hardcoded secrets or credentials - -### Performance -- [ ] No obvious performance bottlenecks -- [ ] Database queries are optimized -- [ ] Memory usage is reasonable -- [ ] Caching is used appropriately - -### Testing -- [ ] Adequate test coverage -- [ ] Tests are meaningful and not just for coverage -- [ ] Tests cover edge cases -- [ ] Tests are maintainable - -## Review Comments -### Good Examples -- "Consider using a Map here for O(1) lookup instead of array.find()" -- "Great use of the factory pattern here!" -- "This error handling looks comprehensive" - -### Avoid -- "This is wrong" -- "Bad code" -- "Why did you do this?" - -## Response to Reviews -- Thank reviewers for their time -- Ask for clarification if feedback is unclear -- Explain your reasoning when disagreeing -- Be open to learning and improvement - - diff --git a/github/prompts/code-generation.prompt.md b/github/prompts/code-generation.prompt.md deleted file mode 100644 index ca696cc..0000000 --- a/github/prompts/code-generation.prompt.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -mode: 'agent' -model: GPT-4o -tools: ['githubRepo', 'codebase', 'search'] -description: 'Generate new code components following established patterns' ---- -Your goal is to generate new code components based on existing patterns in the codebase. - -Ask for component type and requirements if not provided. - -Requirements for code generation: -* Use TypeScript for all new features -* Follow existing architecture patterns from the codebase -* Include comprehensive error handling -* Add appropriate logging using Winston/Pino -* Write unit tests with >80% coverage -* Follow team coding standards and conventions - -## Simple Example Prompts - -### Create a basic API endpoint -``` -Generate a simple GET endpoint for user profiles: -- Path: /api/users/:id -- Returns user data with basic validation -- Includes error handling for not found -- Uses existing database connection patterns -``` - -### Create a React component -``` -Generate a simple UserCard component: -- Takes user object as props -- Displays name, email, and avatar -- Includes loading and error states -- Uses existing styling patterns -``` - -### Create a utility function -``` -Generate a utility function to format dates: -- Takes date input and format string -- Returns formatted date string -- Handles invalid dates gracefully -- Includes TypeScript types -``` - - diff --git a/github/prompts/debugging.prompt.md b/github/prompts/debugging.prompt.md deleted file mode 100644 index 99acd4d..0000000 --- a/github/prompts/debugging.prompt.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -mode: 'agent' -model: GPT-4o -tools: ['codebase', 'search', 'usages'] -description: 'Debug issues systematically and provide solutions' ---- -Your goal is to systematically debug issues and provide practical solutions. - -Ask for error details, logs, and reproduction steps if not provided. - -Requirements for debugging: -* Follow systematic debugging approach -* Reproduce the issue consistently -* Analyze logs and error messages -* Check recent changes and their impact -* Use appropriate debugging tools -* Document findings and solutions - -## Simple Example Prompts - -### Fix a runtime error -``` -Debug this error: "Cannot read property 'id' of undefined" -- Identify where the error occurs -- Check for null/undefined values -- Add proper null checks -- Suggest prevention strategies -``` - -### Investigate slow performance -``` -Debug why this API endpoint is slow: -- Profile the execution time -- Check database queries -- Identify bottlenecks -- Suggest optimization steps -``` - -### Fix a failing test -``` -Debug this failing unit test: -- Analyze the test assertion -- Check mock setup -- Verify test data -- Fix the underlying issue -``` - - diff --git a/github/prompts/refactoring.prompt.md b/github/prompts/refactoring.prompt.md deleted file mode 100644 index 27fbf72..0000000 --- a/github/prompts/refactoring.prompt.md +++ /dev/null @@ -1,48 +0,0 @@ ---- -mode: 'agent' -model: GPT-4o -tools: ['codebase', 'search', 'usages'] -description: 'Refactor existing code to improve maintainability and performance' ---- -Your goal is to refactor existing code while maintaining functionality and improving code quality. - -Ask for the specific code section and refactoring goals if not provided. - -Requirements for refactoring: -* Maintain existing functionality (no breaking changes) -* Improve code readability and maintainability -* Follow SOLID principles -* Enhance testability -* Preserve backwards compatibility where possible -* Update tests to match refactored code - -## Simple Example Prompts - -### Clean up a function -``` -Refactor this function to be more readable: -- Break down complex logic into smaller functions -- Improve variable naming -- Add proper TypeScript types -- Remove code duplication -``` - -### Improve error handling -``` -Refactor error handling in this module: -- Replace try-catch blocks with proper error types -- Add logging for debugging -- Provide meaningful error messages -- Handle edge cases gracefully -``` - -### Extract reusable components -``` -Refactor this code to extract reusable parts: -- Identify common patterns -- Create utility functions or components -- Reduce code duplication -- Maintain existing functionality -``` - - diff --git a/github/prompts/testing.prompt.md b/github/prompts/testing.prompt.md deleted file mode 100644 index 85b7d7b..0000000 --- a/github/prompts/testing.prompt.md +++ /dev/null @@ -1,49 +0,0 @@ ---- -mode: 'agent' -model: GPT-4o -tools: ['codebase', 'search', 'findTestFiles'] -description: 'Generate comprehensive tests for code components' ---- -Your goal is to create comprehensive tests following the project's testing patterns. - -Ask for the component/function to test and coverage requirements if not provided. - -Requirements for testing: -* Follow existing test patterns in the codebase -* Write unit tests for individual components -* Create integration tests for service interactions -* Include edge cases and error conditions -* Achieve >80% code coverage -* Use descriptive test names and assertions -* Mock external dependencies appropriately - -## Simple Example Prompts - -### Create unit tests -``` -Generate unit tests for this utility function: -- Test all expected inputs and outputs -- Cover edge cases (null, undefined, empty) -- Test error conditions -- Use Jest testing framework -``` - -### Create API tests -``` -Generate integration tests for this API endpoint: -- Test successful requests -- Test error responses (400, 404, 500) -- Verify request/response structure -- Mock database calls -``` - -### Create React component tests -``` -Generate tests for this React component: -- Test rendering with different props -- Test user interactions (clicks, form inputs) -- Test loading and error states -- Use React Testing Library -``` - - diff --git a/templates/.gitlab-ci.yml b/templates/.gitlab-ci.yml deleted file mode 100644 index d01f2b4..0000000 --- a/templates/.gitlab-ci.yml +++ /dev/null @@ -1,219 +0,0 @@ ---- -image: "$CI_REGISTRY_IMAGE/devtools:latest" - -stages: - - .pre - - build - - test - - package - - validate - - security - - release - - deploy - - dast - - .post - -workflow: - rules: - - if: $CI_COMMIT_TAG - when: never - - if: $CI_PIPELINE_SOURCE != 'merge_request_event' - - if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS - when: never - -variables: - # build - RELEASE_VERSION: ${RELEASE_VERSION} - BUILD_NUMBER: ${CI_PIPELINE_ID} - BUILD_NAME: ${CI_PROJECT_NAME} - # package registry - PACKAGE_REGISTRY: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" - PACKAGE_NAME: "${BUILD_NAME}-${BUILD_VERSION}.zip" - PACKAGE_PATH: "${BUILD_NAME}/${BUILD_VERSION}/${PACKAGE_NAME}" - # container registry - CONTAINER_REGISTRY: "${CI_REGISTRY_IMAGE}" - CONTAINER_NAME: "${BUILD_NAME}:${BUILD_VERSION}" - CONTAINER_PATH: "${BUILD_NAME}/${CONTAINER_NAME}" - # templates - BUILD_PATH_TMPL: 'build/${CI_PROJECT_NAME}/$${RELEASE_VERSION}' - -# ---------------------------------------------------------------------- -# .pre -# ---------------------------------------------------------------------- -semantic_version: - stage: .pre - image: alpine:latest - variables: - GITLAB_TOKEN: $SEMANTIC_RELEASE_TOKEN - before_script: - - apk update && apk add git nodejs npm - script: - - | - npx --yes \ - --package @semantic-release/changelog \ - --package @semantic-release/gitlab \ - --package @semantic-release/exec \ - --package @semantic-release/commit-analyzer \ - --package conventional-changelog-conventionalcommits \ - semantic-release --dry-run --no-ci > out.txt - - cat out.txt - - | - if [[ ! -f release.env ]]; then - echo "No release candidate" - exit 1 - fi - - export $(cat release.env) - - env | grep -i release_version - - line=$(grep -n -m 1 "# $RELEASE_VERSION" out.txt | cut -f1 -d:) - - sed -n "$line,\$p" out.txt > changelog.md - artifacts: - paths: - - release.env - - changelog.md - reports: - dotenv: release.env - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - when: never - -# ---------------------------------------------------------------------- -# build -# ---------------------------------------------------------------------- -build: - stage: build - image: quay.io/buildah/stable:v1.27 - before_script: - - buildah login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY" - script: - - buildah bud -t "${CI_REGISTRY_IMAGE}/devtools:${CI_COMMIT_SHA}" -f buildpack/devtools/Containerfile - - buildah push "${CI_REGISTRY_IMAGE}/devtools:${CI_COMMIT_SHA}" - rules: - - if: $CI_COMMIT_BRANCH - -# ---------------------------------------------------------------------- -# test -# ---------------------------------------------------------------------- -test: - image: ${CI_REGISTRY_IMAGE}/devtools:${CI_COMMIT_SHA} - stage: test - script: - - echo "test" >> test.txt - artifacts: - expire_in: 1 week - paths: - - test.txt - rules: - - if: $CI_COMMIT_BRANCH - -# ---------------------------------------------------------------------- -# package -# ---------------------------------------------------------------------- -package: - stage: package - script: - - echo "zip the build from artifacts" - - touch result.zip - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - when: never - -# ---------------------------------------------------------------------- -# security, verification, e2e-testing, ... -# ---------------------------------------------------------------------- - -# ---------------------------------------------------------------------- -# release -# ---------------------------------------------------------------------- -release: - stage: release - image: alpine:latest - variables: - GITLAB_TOKEN: $SEMANTIC_RELEASE_TOKEN - before_script: - - apk update && apk add git nodejs npm - script: - - | - npx --yes \ - --package @semantic-release/changelog \ - --package @semantic-release/gitlab \ - --package @semantic-release/exec \ - --package @semantic-release/commit-analyzer \ - --package conventional-changelog-conventionalcommits \ - semantic-release - artifacts: - paths: - - release.env - - changelog.md - reports: - dotenv: release.env - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - when: never - -release_devtools: - stage: release - needs: - - job: release - artifacts: true - before_script: - - buildah login -u "$CI_REGISTRY_USER" -p "$CI_JOB_TOKEN" "$CI_REGISTRY" - script: - - buildah pull "${CI_REGISTRY_IMAGE}/devtools:${CI_COMMIT_SHA}" - - buildah tag "${CI_REGISTRY_IMAGE}/devtools:${CI_COMMIT_SHA}" "${CI_REGISTRY_IMAGE}/devtools:${RELEASE_VERSION}" - - buildah push "${CI_REGISTRY_IMAGE}/devtools:${RELEASE_VERSION}" - rules: - - if: '$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH' - - when: never - -release_chart: - image: - name: alpine/helm:latest - entrypoint: [""] - stage: release - needs: - - job: release_gitlab - artifacts: true - script: - - echo "$CI_REGISTRY_PASSWORD" - | helm registry login "${CI_REGISTRY}" - --username "$CI_REGISTRY_USER" - --password-stdin - - yq ".image.tag = \"${RELEASE_VERSION}\"" -i charts/wfm-web/values.yaml - - helm package - --version "${RELEASE_VERSION}" - --app-version "${RELEASE_VERSION}" - "charts/${CI_PROJECT_NAME}" - - helm push "wfm-web-${RELEASE_VERSION}.tgz" oci://${CI_REGISTRY_IMAGE}/charts - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - when: never - -# ---------------------------------------------------------------------- -# deploy -# ---------------------------------------------------------------------- -pages: - stage: deploy - image: ${CI_REGISTRY_IMAGE}/devtools:latest - script: - - mkdir -p public - - pandoc README.md - --from markdown - --to html - --standalone - --output public/index.html - - cp README.md public/ - artifacts: - paths: - - public - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - when: never - -deploy: - stage: deploy - image: alpine:latest - script: - - echo "deploy ..." - rules: - - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH - - when: never diff --git a/templates/.releaserc.json b/templates/.releaserc.json deleted file mode 100644 index 45ee676..0000000 --- a/templates/.releaserc.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "branches": [ - "main", - { - "name": "feature/*", - "prerelease": "${name.replace('feature/', '')}" - }, - { - "name": "fix/*", - "prerelease": "${name.replace('fix/', '')}" - }, - { - "name": "hotfix/*", - "prerelease": "${name.replace('hotfix/', '')}" - } - ], - "tagFormat": "${version}", - "plugins": [ - [ - "@semantic-release/commit-analyzer", - { - "preset": "conventionalcommits", - "presetConfig": { - "types": [ - { "type": "feat", "section": "Features" }, - { "type": "fix", "section": "Bug Fixes" }, - { "type": "chore", "hidden": true }, - { "type": "docs", "hidden": true }, - { "type": "style", "hidden": true }, - { "type": "refactor", "hidden": true }, - { "type": "perf", "hidden": true }, - { "type": "test", "hidden": true } - ], - "issueUrlFormat": "https://hilti.atlassian.net/browse/{{id}}" - } - } - ], - "@semantic-release/release-notes-generator", - [ - "@semantic-release/changelog", - { - "changelogFile": "changelog.md" - } - ], - [ - "@semantic-release/gitlab", - { - "gitlabUrl": "https://git.buts.hilti.cloud/" - } - ], - [ - "@semantic-release/exec", - { - "verifyReleaseCmd": "echo 'RELEASE_VERSION=${nextRelease.version}' > release.env", - "publishCmd": "echo 'RELEASE_VERSION=${nextRelease.version}' > release.env" - } - ] - ] -} - From 414f1c998a9121808a17bae3a28728e8036db822 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 00:09:47 +0000 Subject: [PATCH 2/4] Implement comprehensive makefile target structure for CI/CD pipeline Co-authored-by: laidback <1631075+laidback@users.noreply.github.com> --- GNUmakefile | 320 +++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 278 insertions(+), 42 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index abfb3f5..2fe7505 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -18,7 +18,7 @@ .DELETE_ON_ERROR: # Global Make settings -SHELL := /usr/local/bin/bash +SHELL := /usr/bin/bash .SHELLFLAGS := -o errexit -o errtrace -o nounset -o pipefail -c MAKEFLAGS += --warn-undefined-variables MAKEFLAGS += --no-builtin-rules @@ -116,30 +116,275 @@ TRASH := @printf "$(YELLOW)đŸ—‘ī¸ %s$(RESET)\n" # =========================================================================== # Project specific Targets # =========================================================================== -# TODO: Propose how to structure the makefile targets. -# Follow as high level structure the abstract ci/cd steps: -# - .pre, build, test, package, validate, security, release, deploy, .post -# - Separate targets such that ci/cd pipelines can call them individually -# - Create a phony dummy target for each step of the ci/cd process -# Some dotfiles symlinks +# CI/CD Pipeline Structure +# Following standard DevOps pipeline stages for automation: +# .pre → build → test → package → validate → security → release → deploy → .post +# +# Each stage can be called individually by CI/CD pipelines +# Targets are organized into logical groups with phony declarations +# =========================================================================== + +# =========================================================================== +# CI/CD Pipeline Stages (Phony Targets) +# =========================================================================== +.PHONY: .pre build test package validate security release deploy .post +.PHONY: ci-all ci-local ci-validation ci-release + +##@ CI/CD Pipeline Stages +.pre: check-tools ## Pre-flight checks and environment validation + @$(call log_header,Pre-flight checks,$(BLUE)) + @echo "Platform: $(PLATFORM)" + @echo "Version: $(VERSION)" + @echo "Git branch: $(GIT_BRANCH)" + +build: ## Build Docker image and compile any necessary artifacts + @$(call log_header,Building artifacts,$(CYAN)) + @$(MAKE) docker-build + +test: ## Run all tests (shell scripts, Docker container) + @$(call log_header,Running tests,$(GREEN)) + @$(MAKE) test-shell + @$(MAKE) docker-test + +package: build ## Package dotfiles and Docker image + @$(call log_header,Packaging artifacts,$(CYAN)) + @$(MAKE) docker-tag + +validate: lint ## Validate configuration files and scripts + @$(call log_header,Validating configuration,$(ORANGE)) + +security: ## Run security scans and vulnerability checks + @$(call log_header,Security scanning,$(RED)) + @echo "Security scans - to be implemented" + +release: ## Create release artifacts and tags + @$(call log_header,Creating release,$(MAGENTA)) + @echo "Release process - to be implemented" + +deploy: ## Deploy dotfiles to target environment + @$(call log_header,Deploying dotfiles,$(CYAN)) + @$(MAKE) install + +.post: ## Post-deployment verification and cleanup + @$(call log_header,Post-deployment checks,$(BLUE)) + @echo "Deployment verification complete" + +##@ CI/CD Orchestration +ci-all: .pre build test package validate security .post ## Run complete CI/CD pipeline + @$(call log_header,CI/CD pipeline complete,$(GREEN)) + +ci-local: .pre build test validate ## Run local development CI checks + @$(call log_header,Local CI checks complete,$(GREEN)) + +ci-validation: validate security ## Run validation and security only + @$(call log_header,Validation complete,$(GREEN)) + +ci-release: .pre build test validate security package release ## Run release pipeline + @$(call log_header,Release pipeline complete,$(GREEN)) + +# =========================================================================== +# Dotfiles Management Targets +# =========================================================================== +.PHONY: install link unlink backup restore clean-dotfiles + +##@ Dotfiles Management +install: ## Install dotfiles to home directory + @$(call log_header,Installing dotfiles,$(CYAN)) + @bash $(SCRIPT_DIR)/01-setup_dev_vm.sh || true + @bash $(SCRIPT_DIR)/02-setup_dev_env.sh || true + +link: ## Create symlinks for dotfiles + @$(call log_header,Creating symlinks,$(CYAN)) + @ln -sfn $(SCRIPT_DIR)/.zshrc $(HOME)/.zshrc + @ln -sfn $(SCRIPT_DIR)/.vimrc $(HOME)/.vimrc + @ln -sfn $(SCRIPT_DIR)/.config $(HOME)/.config + @echo "Symlinks created" + +unlink: ## Remove dotfiles symlinks + @$(call log_header,Removing symlinks,$(YELLOW)) + @rm -f $(HOME)/.zshrc + @rm -f $(HOME)/.vimrc + @rm -f $(HOME)/.config + @echo "Symlinks removed" + +backup: ## Backup existing dotfiles + @$(call log_header,Backing up dotfiles,$(ORANGE)) + @mkdir -p $(HOME)/.dotfiles-backup-$(BUILD_DATE) + @[ -f $(HOME)/.zshrc ] && cp $(HOME)/.zshrc $(HOME)/.dotfiles-backup-$(BUILD_DATE)/ || true + @[ -f $(HOME)/.vimrc ] && cp $(HOME)/.vimrc $(HOME)/.dotfiles-backup-$(BUILD_DATE)/ || true + @echo "Backup created at $(HOME)/.dotfiles-backup-$(BUILD_DATE)" + +restore: ## Restore dotfiles from backup (requires BACKUP_DIR variable) + @$(call log_header,Restoring dotfiles,$(ORANGE)) + @if [ -z "$(BACKUP_DIR)" ]; then \ + echo "Error: BACKUP_DIR not set. Usage: make restore BACKUP_DIR=/path/to/backup"; \ + exit 1; \ + fi + @cp -r $(BACKUP_DIR)/* $(HOME)/ + @echo "Restored from $(BACKUP_DIR)" + +clean-dotfiles: ## Clean temporary dotfiles and build artifacts + @$(call log_header,Cleaning artifacts,$(YELLOW)) + @rm -rf $(TMP_DIR) + @rm -rf $(BUILD_DIR) + @echo "Cleaned temporary files" + +# Symlink pattern rule for dotfiles ~/%: $(~)/% - mkdir -p $(@D) - ln -sfn $< $@ - -ifeq (docker, $(firstword $(MAKECMDGOALS))) - DOCKER_CMD := $(word 2, $(MAKECMDGOALS)) - DOCKER_ARGS := $(wordlist 3, $(words $(MAKECMDGOALS)), $(MAKECMDGOALS)) -# $(eval $(DOCKER_CMD)) -# $(eval $(DOCKER_ARGS)) -endif + @mkdir -p $(@D) + @ln -sfn $< $@ + +# =========================================================================== +# Tool Management Targets +# =========================================================================== +.PHONY: check-tools install-tools verify-tools + +##@ Tool Management +check-tools: ## Check for required tools + @$(call log_header,Checking required tools,$(CYAN)) + @for tool in $(REQUIRED_TOOLS); do \ + if command -v $$tool >/dev/null 2>&1; then \ + echo "✅ $$tool: installed"; \ + else \ + echo "❌ $$tool: not installed"; \ + fi \ + done + +install-tools: ## Install required development tools + @$(call log_header,Installing tools,$(CYAN)) + @bash $(SCRIPT_DIR)/01-setup_dev_vm.sh + @bash $(SCRIPT_DIR)/02-setup_dev_env.sh + +verify-tools: ## Verify tool versions + @$(call log_header,Tool versions,$(CYAN)) + @command -v bash >/dev/null 2>&1 && bash --version | head -1 || echo "bash: not found" + @command -v git >/dev/null 2>&1 && git --version || echo "git: not found" + @command -v docker >/dev/null 2>&1 && docker --version || echo "docker: not found" + @command -v node >/dev/null 2>&1 && node --version || echo "node: not found" + @command -v go >/dev/null 2>&1 && go version || echo "go: not found" + +# =========================================================================== +# Docker Targets +# =========================================================================== +.PHONY: docker-build docker-test docker-run docker-tag docker-push docker-clean + +##@ Docker Operations +docker-build: ## Build Docker image + @$(call log_header,Building Docker image,$(CYAN)) + @docker build -t $(PROJECT_NAME):$(VERSION) \ + --build-arg TARGETOS=$(OS) \ + --build-arg TARGETARCH=$(ARCH) \ + -f $(SCRIPT_DIR)/Dockerfile $(SCRIPT_DIR) + @echo "Built $(PROJECT_NAME):$(VERSION)" + +docker-test: ## Test Docker image + @$(call log_header,Testing Docker image,$(GREEN)) + @docker run --rm $(PROJECT_NAME):$(VERSION) zsh -c "echo 'Container test passed'" + +docker-run: ## Run Docker container interactively + @$(call log_header,Running Docker container,$(CYAN)) + @docker run --rm -it $(PROJECT_NAME):$(VERSION) + +docker-tag: docker-build ## Tag Docker image + @$(call log_header,Tagging Docker image,$(CYAN)) + @docker tag $(PROJECT_NAME):$(VERSION) $(PROJECT_NAME):latest + @echo "Tagged $(PROJECT_NAME):latest" + +docker-push: docker-tag ## Push Docker image to registry + @$(call log_header,Pushing Docker image,$(MAGENTA)) + @echo "Docker push - configure registry first" + +docker-clean: ## Remove Docker images + @$(call log_header,Cleaning Docker images,$(YELLOW)) + @docker rmi $(PROJECT_NAME):$(VERSION) $(PROJECT_NAME):latest || true + +# =========================================================================== +# Validation and Linting Targets +# =========================================================================== +.PHONY: lint lint-shell lint-docker format format-shell + +##@ Validation and Linting +lint: lint-shell ## Run all linters + @$(call log_header,Linting complete,$(GREEN)) + +lint-shell: ## Lint shell scripts + @$(call log_header,Linting shell scripts,$(CYAN)) + @if command -v shellcheck >/dev/null 2>&1; then \ + find $(SCRIPT_DIR) -name "*.sh" -type f -exec shellcheck {} \; ; \ + else \ + echo "âš ī¸ shellcheck not installed, skipping"; \ + fi + +lint-docker: ## Lint Dockerfile + @$(call log_header,Linting Dockerfile,$(CYAN)) + @if command -v hadolint >/dev/null 2>&1; then \ + hadolint $(SCRIPT_DIR)/Dockerfile; \ + else \ + echo "âš ī¸ hadolint not installed, skipping"; \ + fi + +format: format-shell ## Format all code + @$(call log_header,Formatting complete,$(GREEN)) + +format-shell: ## Format shell scripts + @$(call log_header,Formatting shell scripts,$(CYAN)) + @if command -v shfmt >/dev/null 2>&1; then \ + find $(SCRIPT_DIR) -name "*.sh" -type f -exec shfmt -w -i 4 {} \; ; \ + echo "Shell scripts formatted"; \ + else \ + echo "âš ī¸ shfmt not installed, skipping"; \ + fi + +# =========================================================================== +# Testing Targets +# =========================================================================== +.PHONY: test-shell test-all + +##@ Testing +test-shell: ## Test shell scripts syntax + @$(call log_header,Testing shell scripts,$(GREEN)) + @find $(SCRIPT_DIR) -name "*.sh" -type f -exec bash -n {} \; && \ + echo "✅ All shell scripts syntax valid" + +test-all: test-shell docker-test ## Run all tests + @$(call log_header,All tests complete,$(GREEN)) + +# =========================================================================== +# Git and Version Control Targets +# =========================================================================== +.PHONY: git-status git-diff git-commit git-push + +##@ Git Operations +git-status: ## Show git status + @git --no-pager status + +git-diff: ## Show git diff + @git --no-pager diff + +git-commit: ## Commit changes (requires MSG variable) + @if [ -z "$(MSG)" ]; then \ + echo "Error: MSG not set. Usage: make git-commit MSG='commit message'"; \ + exit 1; \ + fi + @git add -A + @git commit -m "$(MSG)" + +git-push: ## Push to remote + @git push origin $(GIT_BRANCH) + +# =========================================================================== +# Utility Targets +# =========================================================================== +.PHONY: clean clean-all -docker: - @echo "Docker target - to be implemented" - echo "Docker cmd: $(DOCKER_CMD)" - echo "Docker args: $(DOCKER_ARGS)" +##@ Utilities +clean: clean-dotfiles docker-clean ## Clean all temporary files and images + @$(call log_header,Clean complete,$(GREEN)) -git: - echo "Git target - to be implemented" +clean-all: clean ## Deep clean including caches + @$(call log_header,Deep cleaning,$(YELLOW)) + @rm -rf $(HOME)/.cache/dotfiles || true + @echo "Deep clean complete" # =========================================================================== # Version and Information Targets @@ -168,30 +413,21 @@ info: ## Show project information fi \ done -log_header = @$(GUM) style --foreground $(2) $(1) -log_body = @$(GUM) style --foreground $(2) " $(1)" - -define help.Targets -BEGIN { \ - FS = ":.*##"; \ - printf "Usage: make [target] [options]\n\n" \ -} \ - "Available targets:\n\n" \ - " %-20s %s\n", "target", "description" \ -} \ -/^[a-zA-Z_-]+:.*?##/ { \ - printf " %-20s %s\n", $$1, $$2 \ -} \ -/^##@/ { \ - printf "\n%s\n", substr($$0, 5) \ -} -endef -export help.Targets +log_header = @if command -v gum >/dev/null 2>&1; then \ + gum style --foreground $(2) "$(1)"; \ + else \ + echo "==> $(1)"; \ + fi +log_body = @if command -v gum >/dev/null 2>&1; then \ + gum style --foreground $(2) " $(1)"; \ + else \ + echo " $(1)"; \ + fi .PHONY: help help: ## Show this help message @$(call log_header,Targets:,$(ORANGE)) - awk """$(help.Targets)""" $(MAKEFILE_LIST) + @awk 'BEGIN {FS = ":.*##"; printf "Usage: make [target] [options]\n\n"; printf "Available targets:\n\n"; printf " %-20s %s\n", "target", "description"} /^[a-zA-Z_-]+:.*?##/ {printf " %-20s %s\n", $$1, $$2} /^##@/ {printf "\n%s\n", substr($$0, 5)}' $(MAKEFILE_LIST) .DEFAULT_GOAL := help From 274d85c048dd4426c2cba0fe2db7afd10560be54 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 00:12:22 +0000 Subject: [PATCH 3/4] Add comprehensive README documentation for makefile structure Co-authored-by: laidback <1631075+laidback@users.noreply.github.com> --- README.md | 230 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 230 insertions(+) diff --git a/README.md b/README.md index e69de29..ff9cfb5 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,230 @@ +# Personal Dotfiles Repository + +Cross-platform development environment configuration and automation for DevOps workflows with AI-assisted development. + +## Overview + +This repository serves as the **foundational layer** for all internal repositories, particularly the DevOps Copilot Framework. It provides a comprehensive development environment configuration that works across macOS, WSL2, and Linux systems. + +### Key Features + +- **Cross-platform dotfiles** - Works on macOS, WSL2, and Linux +- **VS Code workspace integration** - With MCP (Model Context Protocol) support +- **AI coding assistance** - GitHub Copilot configuration and chatmodes +- **Development environment automation** - Shell scripts for quick setup +- **DevOps toolchain standardization** - Docker, Kubernetes, cloud tools + +## Technology Stack + +- **Shell**: Zsh with Oh-My-Zsh, Starship prompt, vi-mode +- **Editors**: Vim (with Vundle/vim-plug), VS Code (with Copilot) +- **Languages**: Bash, Go 1.21.5, Node.js 21+, Python 3, Java 21 LTS +- **DevOps**: Docker, Kubernetes (kubectl, helm, krew, flux), AWS CLI +- **AI Tools**: GitHub Copilot, Charm tools (gum, mods, skate, glow) + +## Quick Start + +### Initial Setup (WSL2/Linux) + +```bash +# Initial VM setup (requires root) +sudo ./01-setup_dev_vm.sh + +# Development environment (Docker, kubectl, Node.js) +./02-setup_dev_env.sh +``` + +### Using the Makefile + +The repository includes a comprehensive GNUmakefile with organized targets for development, CI/CD, and dotfiles management. + +```bash +# Show all available targets +make help + +# Check for required tools +make check-tools + +# Install dotfiles +make install + +# Run local CI checks +make ci-local +``` + +## Makefile Structure + +The makefile follows a standard CI/CD pipeline structure with organized target groups: + +### CI/CD Pipeline Stages + +The makefile implements a complete CI/CD pipeline with the following stages: + +``` +.pre → build → test → package → validate → security → release → deploy → .post +``` + +Each stage can be called individually or as part of orchestrated workflows: + +- **`.pre`** - Pre-flight checks and environment validation +- **`build`** - Build Docker image and compile artifacts +- **`test`** - Run all tests (shell scripts, Docker container) +- **`package`** - Package dotfiles and Docker image +- **`validate`** - Validate configuration files and scripts +- **`security`** - Run security scans and vulnerability checks +- **`release`** - Create release artifacts and tags +- **`deploy`** - Deploy dotfiles to target environment +- **`.post`** - Post-deployment verification and cleanup + +### CI/CD Orchestration Targets + +Pre-defined workflows for common scenarios: + +- **`ci-all`** - Run complete CI/CD pipeline +- **`ci-local`** - Run local development CI checks +- **`ci-validation`** - Run validation and security only +- **`ci-release`** - Run release pipeline + +### Dotfiles Management + +Targets for managing dotfiles installation and configuration: + +- **`install`** - Install dotfiles to home directory +- **`link`** - Create symlinks for dotfiles +- **`unlink`** - Remove dotfiles symlinks +- **`backup`** - Backup existing dotfiles +- **`restore`** - Restore dotfiles from backup +- **`clean-dotfiles`** - Clean temporary dotfiles and build artifacts + +### Tool Management + +Verify and manage development tools: + +- **`check-tools`** - Check for required tools +- **`install-tools`** - Install required development tools +- **`verify-tools`** - Verify tool versions + +### Docker Operations + +Build and manage Docker containers: + +- **`docker-build`** - Build Docker image +- **`docker-test`** - Test Docker image +- **`docker-run`** - Run Docker container interactively +- **`docker-tag`** - Tag Docker image +- **`docker-push`** - Push Docker image to registry +- **`docker-clean`** - Remove Docker images + +### Validation and Linting + +Code quality and validation: + +- **`lint`** - Run all linters +- **`lint-shell`** - Lint shell scripts +- **`lint-docker`** - Lint Dockerfile +- **`format`** - Format all code +- **`format-shell`** - Format shell scripts + +### Testing + +Run various test suites: + +- **`test-shell`** - Test shell scripts syntax +- **`test-all`** - Run all tests + +### Git Operations + +Git workflow helpers: + +- **`git-status`** - Show git status +- **`git-diff`** - Show git diff +- **`git-commit`** - Commit changes (requires MSG variable) +- **`git-push`** - Push to remote + +### Utilities + +General utility targets: + +- **`clean`** - Clean all temporary files and images +- **`clean-all`** - Deep clean including caches +- **`version`** - Show version information +- **`info`** - Show project information +- **`help`** - Show help message + +## Directory Structure + +``` +dotfiles/ +├── .config/ # Application configurations +├── .github/ # GitHub-specific files and AI instructions +├── .oh-my-zsh-custom/ # Custom Zsh themes and plugins +├── .vscode/ # VS Code settings and MCP configuration +├── .vimrc # Vim configuration +├── .zshrc # Zsh configuration +├── 01-setup_dev_vm.sh # Initial VM setup script +├── 02-setup_dev_env.sh # Development environment setup script +├── Dockerfile # Development container definition +└── GNUmakefile # Build automation and CI/CD targets +``` + +## Configuration Management + +### VS Code Integration + +1. Copy `vscode/*.json` to appropriate VS Code settings directory +2. MCP servers auto-connect on workspace open +3. AI instructions apply globally via frontmatter patterns + +### Shell Environment + +- **Theme**: Custom `lc-magic.zsh-theme` with git integration +- **Plugins**: Auto-suggestions, syntax highlighting, vi-mode +- **Vim integration**: `.vimrc` linked via VS Code vim extension + +### Container & K8s Tools + +- **Docker**: Automated installation with user group management +- **kubectl**: Google Cloud packages repository +- **VS Code extensions**: Kubernetes tools with predefined paths + +## Development Patterns + +### Configuration File Management + +- Templates in `vscode/` directory for cross-machine deployment +- Separate user-specific settings in VS Code User directory +- MCP configuration supports environment-specific server URLs + +### Setup Script Patterns + +- Root privilege detection: `[[ "$USER" == "root" ]]` +- Conditional package installation based on user context +- Repository addition before package installation (PPAs, Docker, K8s) + +## Cross-Platform Considerations + +- WSL2 configuration via `.wslconfig` and `etc/wsl.conf` +- macOS-specific paths for Kubernetes tools in VS Code settings +- Platform-agnostic shell configuration with oh-my-zsh + +## Contributing + +When working with this repository: + +- All shell scripts should handle both root and user contexts +- VS Code settings are templates - customize for local needs +- MCP configurations may require service-specific authentication +- Maintain compatibility across WSL2, Linux, and macOS environments + +## License + +See [LICENSE](LICENSE) file for details. + +## AI Coding Assistance + +This repository includes AI coding instructions and chatmode configurations for GitHub Copilot: + +- **Global Instructions**: `.github/copilot-instructions.md` +- **AI Modes**: Various chatmode files for different development scenarios + +See `.github/copilot-instructions.md` for detailed AI coding guidelines. From a7dd95f4711eac1662ceae880e335cb58efad7b9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Dec 2025 00:14:28 +0000 Subject: [PATCH 4/4] Fix code review issues: BASH variable, path typo, and echo prefixes Co-authored-by: laidback <1631075+laidback@users.noreply.github.com> --- GNUmakefile | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/GNUmakefile b/GNUmakefile index 2fe7505..ae9e2f8 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -59,10 +59,10 @@ BUILD_DIR := $(SCRIPT_DIR)/build SCRIPTS_DIR := $(SCRIPT_DIR)/scripts # Tool requirements -BASH := TODO +BASH := $(shell command -v bash 2>/dev/null || echo "/usr/bin/bash") MBAKE:= $(shell command -v mbake 2>/dev/null || echo "mbake makefile linter") GUM := $(shell command -v gum 2>/dev/null || echo "/usr/local/bin/gum") -AWK := $(shell command -v awk 2>/dev/null || echo "/usr//bin/awk") +AWK := $(shell command -v awk 2>/dev/null || echo "/usr/bin/awk") REQUIRED_TOOLS_CORE := bash git jq yq tree curl make gum shfmt shellcheck yamllint prettier REQUIRED_TOOLS_NODE := node npm REQUIRED_TOOLS_AGENT := ollama @@ -391,20 +391,20 @@ clean-all: clean ## Deep clean including caches # =========================================================================== version: ## Show version information @echo "$(PROJECT_NAME) version: $(VERSION)" - echo "Git branch: $(GIT_BRANCH)" - echo "Git commit: $(GIT_COMMIT)" - echo "Build date: $(BUILD_DATE)" + @echo "Git branch: $(GIT_BRANCH)" + @echo "Git commit: $(GIT_COMMIT)" + @echo "Build date: $(BUILD_DATE)" info: ## Show project information @echo "$(PROJECT_NAME) Information" - echo - echo "Version: $(VERSION)" - echo "Git branch: $(GIT_BRANCH)" - echo "Git commit: $(GIT_COMMIT)" - echo "Build date: $(BUILD_DATE)" - echo "Platform: $(PLATFORM)" - echo - echo "Required tools:" + @echo + @echo "Version: $(VERSION)" + @echo "Git branch: $(GIT_BRANCH)" + @echo "Git commit: $(GIT_COMMIT)" + @echo "Build date: $(BUILD_DATE)" + @echo "Platform: $(PLATFORM)" + @echo + @echo "Required tools:" @for tool in $(REQUIRED_TOOLS); do \ if command -v $$tool >/dev/null 2>&1; then \ echo " - $$tool: installed"; \