From e41b665396c97f5ad8e052226e53755a7dbde8b7 Mon Sep 17 00:00:00 2001 From: Val Redchenko Date: Fri, 23 Jan 2026 11:57:58 +0000 Subject: [PATCH] refactor: reorganize tools/ into tests/ and scripts/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Restructure the tools/ directory into semantically organized directories: - tools/e2e/ → tests/e2e/ (E2E test scripts) - tools/github/ → scripts/github/ (GitHub automation) - tools/k8s/ → scripts/k8s/ (Kubernetes scripts) Also renamed k8s_network_summary.sh to k8s-network-summary.sh for consistency with other script naming conventions. Updated all references across configuration files, documentation, and internal script paths. --- .github/labeler.yml | 6 ++--- .github/workflows/gitflow.yml | 6 ++--- claude-code/CLAUDE.md | 6 ++--- claude-code/shared/skills/devops/SKILL.md | 4 +-- claude-code/smartem-decisions/settings.json | 5 ++-- docs/backend/api-server.md | 2 +- ...d-secrets-kubernetes-secrets-management.md | 2 +- .../0013-json-config-with-typescript-types.md | 2 +- docs/development/e2e-simulation.md | 26 +++++++++---------- docs/development/github-labels.md | 14 +++++----- docs/operations/environment-variables.md | 20 +++++++------- docs/operations/kubernetes-secrets.md | 18 ++++++------- docs/operations/kubernetes.md | 16 ++++++------ docs/operations/setup-smartem-workspace.md | 4 +-- env-examples/.env.example.k8s.development | 2 +- env-examples/.env.example.k8s.production | 2 +- env-examples/.env.example.k8s.staging | 2 +- k8s/environments/development/configmap.yaml | 2 +- k8s/environments/production/configmap.yaml | 2 +- k8s/environments/staging/configmap.yaml | 2 +- package.json | 4 +-- {tools => scripts}/github/sync-labels.ts | 6 ++--- {tools => scripts}/k8s/dev-k8s.sh | 0 .../k8s/generate-sealed-secrets.sh | 2 +- .../k8s/k8s-network-summary.sh | 0 .../e2e/run-e2e-test-multi-microscope.sh | 6 ++--- {tools => tests}/e2e/run-e2e-test.sh | 6 ++--- .../e2e/setup-test-agent-session.py | 4 +-- 28 files changed, 86 insertions(+), 85 deletions(-) rename {tools => scripts}/github/sync-labels.ts (97%) rename {tools => scripts}/k8s/dev-k8s.sh (100%) rename {tools => scripts}/k8s/generate-sealed-secrets.sh (99%) rename tools/k8s/k8s_network_summary.sh => scripts/k8s/k8s-network-summary.sh (100%) rename {tools => tests}/e2e/run-e2e-test-multi-microscope.sh (98%) rename {tools => tests}/e2e/run-e2e-test.sh (96%) rename {tools => tests}/e2e/setup-test-agent-session.py (96%) diff --git a/.github/labeler.yml b/.github/labeler.yml index 8a67632..69b62cf 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -21,7 +21,7 @@ smartem-devtools:claude: smartem-devtools:e2e-test: - changed-files: - - any-glob-to-any-file: tools/e2e/** + - any-glob-to-any-file: tests/e2e/** # Type-of-work labels documentation: @@ -34,6 +34,6 @@ devops: - changed-files: - any-glob-to-any-file: - .github/** - - tools/k8s/** - - tools/github/** + - scripts/k8s/** + - scripts/github/** - k8s/** diff --git a/.github/workflows/gitflow.yml b/.github/workflows/gitflow.yml index cf711c5..46f3d65 100644 --- a/.github/workflows/gitflow.yml +++ b/.github/workflows/gitflow.yml @@ -15,7 +15,7 @@ on: branches: [main] paths: - 'core/github-tags-config.ts' - - 'tools/github/**' + - 'scripts/github/**' jobs: check-labels: @@ -38,7 +38,7 @@ jobs: - name: Check labels env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: npx tsx tools/github/sync-labels.ts --check --verbose + run: npx tsx scripts/github/sync-labels.ts --check --verbose sync-labels: name: Sync Labels @@ -60,4 +60,4 @@ jobs: - name: Sync labels env: GH_TOKEN: ${{ secrets.LABEL_SYNC_TOKEN }} - run: npx tsx tools/github/sync-labels.ts --sync --verbose + run: npx tsx scripts/github/sync-labels.ts --sync --verbose diff --git a/claude-code/CLAUDE.md b/claude-code/CLAUDE.md index 1c6cf42..6958bee 100644 --- a/claude-code/CLAUDE.md +++ b/claude-code/CLAUDE.md @@ -127,8 +127,8 @@ Developer tooling, documentation, and workspace configuration for the SmartEM ec - Core TypeScript config for multi-repo management - API specs (SmartEM, Athena) - Kubernetes manifests for dev/stage/prod (k8s/) -- K8s development scripts (tools/k8s/) -- E2E test scripts (tools/e2e/) +- K8s development scripts (scripts/k8s/) +- E2E test scripts (tests/e2e/) - EPUPlayer for EPU filesystem recording/playback (packages/smartem-epuplayer/) **Key directories:** @@ -136,7 +136,7 @@ Developer tooling, documentation, and workspace configuration for the SmartEM ec - `claude-code/` - Skills, repo guidelines, architecture docs - `webui/` - React developer dashboard - `core/` - Repository and workspace config definitions -- `tools/e2e/` - E2E test runners for SmartEM (single and multi-microscope) +- `tests/e2e/` - E2E test runners for SmartEM (single and multi-microscope) - `packages/smartem-epuplayer/` - EPU filesystem recording/playback for dev/test **Tech**: Python 3.11+, Node.js, React 19, Vite, TypeScript diff --git a/claude-code/shared/skills/devops/SKILL.md b/claude-code/shared/skills/devops/SKILL.md index b67381c..f0080fd 100644 --- a/claude-code/shared/skills/devops/SKILL.md +++ b/claude-code/shared/skills/devops/SKILL.md @@ -25,10 +25,10 @@ Kubernetes deployment, container management, and CI/CD operations for the SmartE cd repos/DiamondLightSource/smartem-decisions # Start local k3s cluster with all services -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # Stop and cleanup -./tools/k8s/dev-k8s.sh down +./scripts/k8s/dev-k8s.sh down # Check cluster status kubectl get pods -n smartem-decisions diff --git a/claude-code/smartem-decisions/settings.json b/claude-code/smartem-decisions/settings.json index 09d72ec..0d84f78 100644 --- a/claude-code/smartem-decisions/settings.json +++ b/claude-code/smartem-decisions/settings.json @@ -34,8 +34,9 @@ "Bash(psql:*)", "Bash(pg_dump:*)", "Bash(pg_restore:*)", - "Bash(./tools/k8s/dev-k8s.sh:*)", - "Bash(./tools/*)", + "Bash(./scripts/k8s/dev-k8s.sh:*)", + "Bash(./scripts/*)", + "Bash(./tests/*)", "WebFetch(domain:github.com)", "WebFetch(domain:diamondlightsource.github.io)", "WebFetch(domain:docs.anthropic.com)", diff --git a/docs/backend/api-server.md b/docs/backend/api-server.md index b19516c..d88f726 100644 --- a/docs/backend/api-server.md +++ b/docs/backend/api-server.md @@ -6,7 +6,7 @@ The core backend service providing HTTP API, database operations, and message qu ```bash # create env and launch service stack locally: -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # launch RabbitMQ worker (consumer) python -m smartem_backend.consumer # ERROR level (default) diff --git a/docs/decision-records/decisions/0006-sealed-secrets-kubernetes-secrets-management.md b/docs/decision-records/decisions/0006-sealed-secrets-kubernetes-secrets-management.md index 254e199..0055fea 100644 --- a/docs/decision-records/decisions/0006-sealed-secrets-kubernetes-secrets-management.md +++ b/docs/decision-records/decisions/0006-sealed-secrets-kubernetes-secrets-management.md @@ -46,7 +46,7 @@ be safely committed to version control whilst maintaining security. Implementation will include: - Installation of sealed-secrets controller in each Kubernetes environment -- Integration with existing deployment workflow via tools/k8s/generate-sealed-secrets.sh script +- Integration with existing deployment workflow via scripts/k8s/generate-sealed-secrets.sh script - Documentation in docs/how-to/manage-kubernetes-secrets.md for team procedures - Environment-specific encryption keys for development, staging, and production clusters diff --git a/docs/decision-records/decisions/0013-json-config-with-typescript-types.md b/docs/decision-records/decisions/0013-json-config-with-typescript-types.md index afc2835..a8d4979 100644 --- a/docs/decision-records/decisions/0013-json-config-with-typescript-types.md +++ b/docs/decision-records/decisions/0013-json-config-with-typescript-types.md @@ -96,7 +96,7 @@ React components ### Modified - `webui/src/config/index.ts` - now imports from `core/index.ts` and transforms - `webui/scripts/prebuild.ts` - simplified to docs sync only -- `tools/github/sync-labels.ts` - updated import path +- `scripts/github/sync-labels.ts` - updated import path ### Deleted - `core/github-labels-config.ts` diff --git a/docs/development/e2e-simulation.md b/docs/development/e2e-simulation.md index f0560f5..d9c2bc8 100644 --- a/docs/development/e2e-simulation.md +++ b/docs/development/e2e-simulation.md @@ -8,13 +8,13 @@ For the simplest test execution, use the automated test runner script: ```bash # Check k3s status first (DO NOT restart if already running) -./tools/k8s/dev-k8s.sh status +./scripts/k8s/dev-k8s.sh status # Run automated test (Test Type 2: Pre-Acquisition Agent Setup) -./tools/run-e2e-test.sh +./tests/e2e/run-e2e-test.sh # With custom parameters (paths relative to workspace root) -./tools/run-e2e-test.sh \ +./tests/e2e/run-e2e-test.sh \ ../../testdata/recordings/bi37708-42_epurecording.tar.gz \ ../../tmp/epu-test-dir \ 0.1 @@ -22,7 +22,7 @@ For the simplest test execution, use the automated test runner script: # Or override via environment variables SMARTEM_TEST_RECORDING=/path/to/recording.tar.gz \ SMARTEM_EPU_DIR=/path/to/epu-dir \ -./tools/run-e2e-test.sh +./tests/e2e/run-e2e-test.sh ``` **Script parameters** (all optional): @@ -64,7 +64,7 @@ If you've already set up once and just need to run another test: ```bash # 1. Check k3s status (DO NOT restart if already running) -./tools/k8s/dev-k8s.sh status +./scripts/k8s/dev-k8s.sh status # 2. Prepare clean environment unset POSTGRES_HOST POSTGRES_PORT POSTGRES_DB POSTGRES_USER POSTGRES_PASSWORD @@ -115,13 +115,13 @@ For testing multiple concurrent microscopes and acquisition sessions simultaneou ```bash # Check k3s status first (DO NOT restart if already running) -./tools/k8s/dev-k8s.sh status +./scripts/k8s/dev-k8s.sh status # Run multi-microscope test with 3 microscopes (default) -./tools/run-e2e-test-multi-microscope.sh +./tests/e2e/run-e2e-test-multi-microscope.sh # With custom parameters (paths relative to workspace root) -./tools/run-e2e-test-multi-microscope.sh \ +./tests/e2e/run-e2e-test-multi-microscope.sh \ 3 \ ../../testdata/recordings/bi37708-42_epurecording.tar.gz \ ../../tmp/epu-test-dir \ @@ -130,7 +130,7 @@ For testing multiple concurrent microscopes and acquisition sessions simultaneou # Or override via environment variables SMARTEM_TEST_RECORDING=/path/to/recording.tar.gz \ SMARTEM_EPU_DIR=/path/to/epu-dir \ -./tools/run-e2e-test-multi-microscope.sh 3 +./tests/e2e/run-e2e-test-multi-microscope.sh 3 ``` **Script parameters** (all optional): @@ -239,7 +239,7 @@ The test setup simulates a complete SmartEM workflow: ### Environment Setup - Python 3.12+ with venv activated: `source .venv/bin/activate` - Full development install: `pip install -e .[all]` -- Local k3s cluster running: `./tools/k8s/dev-k8s.sh up` +- Local k3s cluster running: `./scripts/k8s/dev-k8s.sh up` - Environment file: `.env` (created from `.env.example` - see Environment File Setup below) ### Test Data @@ -298,7 +298,7 @@ ADMINER_PORT=8080 CORS_ALLOWED_ORIGINS=* ``` -**Usage**: Automatically loaded by `./tools/run-e2e-test.sh` script +**Usage**: Automatically loaded by `./tests/e2e/run-e2e-test.sh` script ## Database Operations @@ -506,7 +506,7 @@ pkill -f uvicorn pkill -f fastapi # 5. Verify k3s services are running (DO NOT restart if already running) -./tools/k8s/dev-k8s.sh status +./scripts/k8s/dev-k8s.sh status # 6. Clean RabbitMQ (restart to ensure empty queue) kubectl rollout restart deployment/rabbitmq -n smartem-decisions @@ -773,7 +773,7 @@ pgrep -f "smartem_backend|smartem_agent|epuplayer" rm -rf ../epu-test-dir # Stop k3s cluster (if needed) -./tools/k8s/dev-k8s.sh down +./scripts/k8s/dev-k8s.sh down ``` ## Troubleshooting diff --git a/docs/development/github-labels.md b/docs/development/github-labels.md index 8b41565..41b850d 100644 --- a/docs/development/github-labels.md +++ b/docs/development/github-labels.md @@ -11,7 +11,7 @@ The SmartEM ecosystem uses a standardised set of GitHub labels across four repos - `DiamondLightSource/smartem-devtools` - `DiamondLightSource/fandanGO-cryoem-dls` -Labels are defined in `core/github-labels-config.ts` and synced using `tools/github/sync-labels.ts`. +Labels are defined in `core/github-labels-config.ts` and synced using `scripts/github/sync-labels.ts`. ## Prerequisites @@ -90,7 +90,7 @@ npm run labels:check Or directly: ```bash -npx tsx tools/github/sync-labels.ts --check +npx tsx scripts/github/sync-labels.ts --check ``` This will: @@ -110,7 +110,7 @@ npm run labels:sync Or directly: ```bash -npx tsx tools/github/sync-labels.ts --sync +npx tsx scripts/github/sync-labels.ts --sync ``` This will: @@ -123,8 +123,8 @@ This will: To sync only specific repositories: ```bash -npx tsx tools/github/sync-labels.ts --sync --repo smartem-decisions -npx tsx tools/github/sync-labels.ts --sync --repo smartem-frontend --repo smartem-devtools +npx tsx scripts/github/sync-labels.ts --sync --repo smartem-decisions +npx tsx scripts/github/sync-labels.ts --sync --repo smartem-frontend --repo smartem-devtools ``` ### Verbose Output @@ -132,14 +132,14 @@ npx tsx tools/github/sync-labels.ts --sync --repo smartem-frontend --repo smarte For detailed output including conforming labels: ```bash -npx tsx tools/github/sync-labels.ts --check --verbose +npx tsx scripts/github/sync-labels.ts --check --verbose ``` ## CI/CD Integration The `gitflow.yml` workflow automates label management: -- **On push to main**: Runs `--check` mode when `core/github-labels-config.ts` or `tools/github/**` changes +- **On push to main**: Runs `--check` mode when `core/github-labels-config.ts` or `scripts/github/**` changes - **Manual dispatch**: Can trigger `--sync` mode via GitHub Actions UI ### Running Sync via CI/CD diff --git a/docs/operations/environment-variables.md b/docs/operations/environment-variables.md index 6a13caf..690a12c 100644 --- a/docs/operations/environment-variables.md +++ b/docs/operations/environment-variables.md @@ -28,7 +28,7 @@ The project uses multiple environment configuration patterns for different deplo **When to Use**: - Day-to-day development with `python -m smartem_backend.consumer` - Running API server locally with `python -m smartem_backend.api_server` -- E2E testing with `./tools/run-e2e-test.sh` +- E2E testing with `./tests/e2e/run-e2e-test.sh` - Manual debugging and development workflows **Setup**: @@ -52,14 +52,14 @@ HTTP_API_PORT=8000 **Used By**: - Python code via `load_dotenv()` in `smartem_backend/consumer.py`, `smartem_backend/utils.py` - Docker `entrypoint.sh` when running containers outside Kubernetes -- E2E test scripts (`./tools/run-e2e-test.sh`) +- E2E test scripts (`./tests/e2e/run-e2e-test.sh`) ### 2. Kubernetes Development: `.env.k8s.development` **Use Case**: Deploying SmartEM to local K8s cluster (k3s) for development. **When to Use**: -- Running `./tools/k8s/dev-k8s.sh up` +- Running `./scripts/k8s/dev-k8s.sh up` - Setting up local development cluster with all services **Setup**: @@ -89,7 +89,7 @@ RABBITMQ_PASSWORD=password ``` **Used By**: -- `./tools/k8s/dev-k8s.sh` script to create K8s Secrets and ConfigMaps +- `./scripts/k8s/dev-k8s.sh` script to create K8s Secrets and ConfigMaps ### 3. Kubernetes Staging: `.env.k8s.staging` @@ -109,7 +109,7 @@ cp .env.example.k8s.staging .env.k8s.staging **Used By**: - CI/CD pipelines for staging deployments -- `DEPLOY_ENV=staging ./tools/k8s/dev-k8s.sh up` (if adapted for remote clusters) +- `DEPLOY_ENV=staging ./scripts/k8s/dev-k8s.sh up` (if adapted for remote clusters) ### 4. Kubernetes Production: `.env.k8s.production` @@ -167,7 +167,7 @@ cp .env.example.k8s.development .env.k8s.development nano .env.k8s.development # 3. Start K8s cluster (creates infrastructure) -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # 4. .env is already configured to connect to K8s NodePorts # No changes needed unless you want custom ports @@ -236,7 +236,7 @@ When running in Kubernetes: ```bash # 1. Start K8s cluster -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # 2. Use .env (already configured for NodePorts) cat .env @@ -261,7 +261,7 @@ cp .env.example.k8s.development .env.k8s.development # Edit with your credentials # 2. Deploy -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # 3. All services run in pods kubectl get pods -n smartem-decisions @@ -280,10 +280,10 @@ kubectl get pods -n smartem-decisions test -f .env || cp .env.example .env # 2. Start K8s cluster -./tools/k8s/dev-k8s.sh up +./scripts/k8s/dev-k8s.sh up # 3. Run E2E test (script loads .env automatically) -./tools/run-e2e-test.sh +./tests/e2e/run-e2e-test.sh # The script does: # - source .env (loads variables) diff --git a/docs/operations/kubernetes-secrets.md b/docs/operations/kubernetes-secrets.md index b38156d..6f98a2c 100644 --- a/docs/operations/kubernetes-secrets.md +++ b/docs/operations/kubernetes-secrets.md @@ -62,13 +62,13 @@ The project includes a convenient script that handles the entire sealed secret g ```bash # Generate secrets for development (auto-generated passwords) -./tools/k8s/generate-sealed-secrets.sh development +./scripts/k8s/generate-sealed-secrets.sh development # Generate secrets for production (interactive prompts) -./tools/k8s/generate-sealed-secrets.sh production +./scripts/k8s/generate-sealed-secrets.sh production # Generate secrets for all environments -./tools/k8s/generate-sealed-secrets.sh all +./scripts/k8s/generate-sealed-secrets.sh all ``` ## Environment-Specific Workflows @@ -78,7 +78,7 @@ The project includes a convenient script that handles the entire sealed secret g Development environments use automatically generated secure passwords for convenience: ```bash -./tools/k8s/generate-sealed-secrets.sh development +./scripts/k8s/generate-sealed-secrets.sh development ``` This will: @@ -92,7 +92,7 @@ This will: Production and staging environments require interactive credential input for security: ```bash -./tools/k8s/generate-sealed-secrets.sh production +./scripts/k8s/generate-sealed-secrets.sh production ``` You'll be prompted to provide: @@ -147,7 +147,7 @@ Regular secret rotation is essential for security. Follow these steps to rotate ```bash # Use the generation script with new credentials -./tools/k8s/generate-sealed-secrets.sh production +./scripts/k8s/generate-sealed-secrets.sh production ``` ### 2. Apply Updated Secrets @@ -274,7 +274,7 @@ For issues with the generation script: ```bash # Run with verbose output -bash -x ./tools/k8s/generate-sealed-secrets.sh development +bash -x ./scripts/k8s/generate-sealed-secrets.sh development # Check prerequisites manually kubectl cluster-info @@ -326,7 +326,7 @@ For complex applications requiring multiple secret sources: ```bash # Database secrets -./tools/k8s/generate-sealed-secrets.sh production +./scripts/k8s/generate-sealed-secrets.sh production # Additional API secrets kubectl create secret generic api-secrets \ @@ -355,7 +355,7 @@ rm plain-secret.yaml ## Files and Structure ``` -├── tools/k8s/generate-sealed-secrets.sh # Main secret generation script +├── scripts/k8s/generate-sealed-secrets.sh # Main secret generation script ├── k8s/environments/ │ ├── development/ │ │ ├── secrets.yaml # Development sealed secrets diff --git a/docs/operations/kubernetes.md b/docs/operations/kubernetes.md index 8e482c2..42830bd 100644 --- a/docs/operations/kubernetes.md +++ b/docs/operations/kubernetes.md @@ -8,22 +8,22 @@ For local development, use the convenient script that provides a docker-compose- ```bash # Start the development environment (equivalent to docker-compose up -d) -./tools/k8s/dev-k8s.sh +./scripts/k8s/dev-k8s.sh # Check status (equivalent to docker ps) -./tools/k8s/dev-k8s.sh status +./scripts/k8s/dev-k8s.sh status # View logs for a service -./tools/k8s/dev-k8s.sh logs smartem-http-api +./scripts/k8s/dev-k8s.sh logs smartem-http-api # Stop the environment (equivalent to docker-compose down) -./tools/k8s/dev-k8s.sh down +./scripts/k8s/dev-k8s.sh down # Restart everything -./tools/k8s/dev-k8s.sh restart +./scripts/k8s/dev-k8s.sh restart # Get help -./tools/k8s/dev-k8s.sh --help +./scripts/k8s/dev-k8s.sh --help ``` ### Access URLs @@ -55,14 +55,14 @@ deploying to any environment, you must generate the appropriate sealed secrets: ```bash # Auto-generate secure credentials for development -./tools/k8s/generate-sealed-secrets.sh development +./scripts/k8s/generate-sealed-secrets.sh development ``` ### Generate Secrets for Production ```bash # Interactive credential input for production security -./tools/k8s/generate-sealed-secrets.sh production +./scripts/k8s/generate-sealed-secrets.sh production ``` Sealed secrets are encrypted with the cluster's public key and safe to commit to version control. The sealed-secrets diff --git a/docs/operations/setup-smartem-workspace.md b/docs/operations/setup-smartem-workspace.md index 6ca90c7..02f924f 100644 --- a/docs/operations/setup-smartem-workspace.md +++ b/docs/operations/setup-smartem-workspace.md @@ -575,7 +575,7 @@ For smartem-decisions (backend): cd repos/DiamondLightSource/smartem-decisions uv sync --all-extras source .venv/bin/activate -./tools/k8s/dev-k8s.sh up # Starts PostgreSQL, RabbitMQ +./scripts/k8s/dev-k8s.sh up # Starts PostgreSQL, RabbitMQ ``` For smartem-frontend: @@ -894,7 +894,7 @@ After setting up your workspace: 1. **Read CLAUDE.md** for workspace overview and conventions 2. **Explore docs/how-to/** for development guides -3. **Run the backend** with `./tools/k8s/dev-k8s.sh up` +3. **Run the backend** with `./scripts/k8s/dev-k8s.sh up` 4. **Run the frontend** with `npm run dev` 5. **Run tests** to verify everything works 6. **Join discussions** on GitHub for questions diff --git a/env-examples/.env.example.k8s.development b/env-examples/.env.example.k8s.development index 3bf7b82..cbcf4e8 100644 --- a/env-examples/.env.example.k8s.development +++ b/env-examples/.env.example.k8s.development @@ -1,6 +1,6 @@ # SmartEM Decisions - Development Environment (K8s) # Copy this file to .env.k8s.development and configure for local K8s cluster -# Used by: ./tools/k8s/dev-k8s.sh when DEPLOY_ENV=development +# Used by: ./scripts/k8s/dev-k8s.sh when DEPLOY_ENV=development # Docker/GHCR credentials for container registry access DOCKER_USERNAME=your_github_username diff --git a/env-examples/.env.example.k8s.production b/env-examples/.env.example.k8s.production index f7b00f8..e1700cf 100644 --- a/env-examples/.env.example.k8s.production +++ b/env-examples/.env.example.k8s.production @@ -1,6 +1,6 @@ # SmartEM Decisions - Production Environment (K8s) # Copy this file to .env.k8s.production and replace placeholder values with real credentials -# Used by: ./tools/k8s/dev-k8s.sh when DEPLOY_ENV=production +# Used by: ./scripts/k8s/dev-k8s.sh when DEPLOY_ENV=production # Docker/GHCR credentials for container registry access DOCKER_USERNAME=your_github_username diff --git a/env-examples/.env.example.k8s.staging b/env-examples/.env.example.k8s.staging index bf3f109..fe75696 100644 --- a/env-examples/.env.example.k8s.staging +++ b/env-examples/.env.example.k8s.staging @@ -1,6 +1,6 @@ # SmartEM Decisions - Staging Environment (K8s) # Copy this file to .env.k8s.staging and replace placeholder values with real credentials -# Used by: ./tools/k8s/dev-k8s.sh when DEPLOY_ENV=staging +# Used by: ./scripts/k8s/dev-k8s.sh when DEPLOY_ENV=staging # Docker/GHCR credentials for container registry access DOCKER_USERNAME=your_github_username diff --git a/k8s/environments/development/configmap.yaml b/k8s/environments/development/configmap.yaml index 50a0e8b..dc5fac8 100644 --- a/k8s/environments/development/configmap.yaml +++ b/k8s/environments/development/configmap.yaml @@ -4,7 +4,7 @@ metadata: name: smartem-config namespace: smartem-decisions data: - # These are fallback values used if ./tools/k8s/dev-k8s.sh is not used + # These are fallback values used if ./scripts/k8s/dev-k8s.sh is not used # The script will dynamically override these with values from .dev.env POSTGRES_HOST: "postgres-service" POSTGRES_PORT: "5432" diff --git a/k8s/environments/production/configmap.yaml b/k8s/environments/production/configmap.yaml index 34d318a..b64f55a 100644 --- a/k8s/environments/production/configmap.yaml +++ b/k8s/environments/production/configmap.yaml @@ -4,7 +4,7 @@ metadata: name: smartem-config namespace: smartem-decisions-production data: - # These are fallback values used if ./tools/k8s/dev-k8s.sh is not used + # These are fallback values used if ./scripts/k8s/dev-k8s.sh is not used # The script will dynamically override these with values from .env.production POSTGRES_HOST: "postgres-service" POSTGRES_PORT: "5432" diff --git a/k8s/environments/staging/configmap.yaml b/k8s/environments/staging/configmap.yaml index ca1f3b4..0b289b6 100644 --- a/k8s/environments/staging/configmap.yaml +++ b/k8s/environments/staging/configmap.yaml @@ -4,7 +4,7 @@ metadata: name: smartem-config namespace: smartem-decisions-staging data: - # These are fallback values used if ./tools/k8s/dev-k8s.sh is not used + # These are fallback values used if ./scripts/k8s/dev-k8s.sh is not used # The script will dynamically override these with values from .env.staging POSTGRES_HOST: "postgres-service" POSTGRES_PORT: "5432" diff --git a/package.json b/package.json index 5aad39f..29300d5 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "private": true, "scripts": { - "labels:check": "npx tsx tools/github/sync-labels.ts --check", - "labels:sync": "npx tsx tools/github/sync-labels.ts --sync" + "labels:check": "npx tsx scripts/github/sync-labels.ts --check", + "labels:sync": "npx tsx scripts/github/sync-labels.ts --sync" }, "devDependencies": { "tsx": "^4.19.2", diff --git a/tools/github/sync-labels.ts b/scripts/github/sync-labels.ts similarity index 97% rename from tools/github/sync-labels.ts rename to scripts/github/sync-labels.ts index 9d55443..5ff1f6d 100644 --- a/tools/github/sync-labels.ts +++ b/scripts/github/sync-labels.ts @@ -6,9 +6,9 @@ * in core/github-labels.json. * * Usage: - * npx tsx tools/github/sync-labels.ts --check # Check conformity (default) - * npx tsx tools/github/sync-labels.ts --sync # Sync labels to all repos - * npx tsx tools/github/sync-labels.ts --sync --repo smartem-decisions + * npx tsx scripts/github/sync-labels.ts --check # Check conformity (default) + * npx tsx scripts/github/sync-labels.ts --sync # Sync labels to all repos + * npx tsx scripts/github/sync-labels.ts --sync --repo smartem-decisions * * Backends: * - Primary: gh CLI (requires `gh auth login`) diff --git a/tools/k8s/dev-k8s.sh b/scripts/k8s/dev-k8s.sh similarity index 100% rename from tools/k8s/dev-k8s.sh rename to scripts/k8s/dev-k8s.sh diff --git a/tools/k8s/generate-sealed-secrets.sh b/scripts/k8s/generate-sealed-secrets.sh similarity index 99% rename from tools/k8s/generate-sealed-secrets.sh rename to scripts/k8s/generate-sealed-secrets.sh index 26c90ae..6746984 100755 --- a/tools/k8s/generate-sealed-secrets.sh +++ b/scripts/k8s/generate-sealed-secrets.sh @@ -292,7 +292,7 @@ generate_sealed_secret() { # Add header comment to sealed secret local output_file="$env_dir/secrets.yaml" cat > "$output_file" << EOF -# Generated by tools/k8s/generate-sealed-secrets.sh +# Generated by scripts/k8s/generate-sealed-secrets.sh # This is a Bitnami Sealed Secret - safe to commit to version control # The sealed-secrets controller will decrypt this into a regular Secret --- diff --git a/tools/k8s/k8s_network_summary.sh b/scripts/k8s/k8s-network-summary.sh similarity index 100% rename from tools/k8s/k8s_network_summary.sh rename to scripts/k8s/k8s-network-summary.sh diff --git a/tools/e2e/run-e2e-test-multi-microscope.sh b/tests/e2e/run-e2e-test-multi-microscope.sh similarity index 98% rename from tools/e2e/run-e2e-test-multi-microscope.sh rename to tests/e2e/run-e2e-test-multi-microscope.sh index 03f936f..f3bc9c2 100755 --- a/tools/e2e/run-e2e-test-multi-microscope.sh +++ b/tests/e2e/run-e2e-test-multi-microscope.sh @@ -5,13 +5,13 @@ set -euo pipefail # This script automates concurrent e2e test execution simulating multiple microscopes # # Run from workspace root: -# ./repos/DiamondLightSource/smartem-devtools/tools/e2e/run-e2e-test-multi-microscope.sh +# ./repos/DiamondLightSource/smartem-devtools/tests/e2e/run-e2e-test-multi-microscope.sh # # Or with arguments: -# ./repos/DiamondLightSource/smartem-devtools/tools/e2e/run-e2e-test-multi-microscope.sh +# ./repos/DiamondLightSource/smartem-devtools/tests/e2e/run-e2e-test-multi-microscope.sh SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -TOOLS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +TESTS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)" # smartem-decisions repo location diff --git a/tools/e2e/run-e2e-test.sh b/tests/e2e/run-e2e-test.sh similarity index 96% rename from tools/e2e/run-e2e-test.sh rename to tests/e2e/run-e2e-test.sh index 7dd410f..8e9192d 100755 --- a/tools/e2e/run-e2e-test.sh +++ b/tests/e2e/run-e2e-test.sh @@ -5,13 +5,13 @@ set -euo pipefail # This script automates the e2e test execution for the SmartEM Agent # # Run from workspace root: -# ./repos/DiamondLightSource/smartem-devtools/tools/e2e/run-e2e-test.sh +# ./repos/DiamondLightSource/smartem-devtools/tests/e2e/run-e2e-test.sh # # Or with arguments: -# ./repos/DiamondLightSource/smartem-devtools/tools/e2e/run-e2e-test.sh +# ./repos/DiamondLightSource/smartem-devtools/tests/e2e/run-e2e-test.sh SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -TOOLS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" +TESTS_DIR="$(cd "$SCRIPT_DIR/.." && pwd)" WORKSPACE_ROOT="$(cd "$SCRIPT_DIR/../../../../.." && pwd)" # smartem-decisions repo location diff --git a/tools/e2e/setup-test-agent-session.py b/tests/e2e/setup-test-agent-session.py similarity index 96% rename from tools/e2e/setup-test-agent-session.py rename to tests/e2e/setup-test-agent-session.py index fb1b314..e439e3c 100644 --- a/tools/e2e/setup-test-agent-session.py +++ b/tests/e2e/setup-test-agent-session.py @@ -8,11 +8,11 @@ Usage (from workspace root, with smartem-decisions venv activated): cd repos/DiamondLightSource/smartem-decisions - python ../smartem-devtools/tools/e2e/setup-test-agent-session.py [--agent-id AGENT_ID] [--session-id SESSION_ID] + python ../smartem-devtools/tests/e2e/setup-test-agent-session.py [--agent-id AGENT_ID] [--session-id SESSION_ID] Or with PYTHONPATH: PYTHONPATH=repos/DiamondLightSource/smartem-decisions \ - python repos/DiamondLightSource/smartem-devtools/tools/e2e/setup-test-agent-session.py + python repos/DiamondLightSource/smartem-devtools/tests/e2e/setup-test-agent-session.py Examples: python setup-test-agent-session.py