Skip to content

Commit 917b0a7

Browse files
committed
refactor: reorganize tools/ into tests/ and scripts/
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.
1 parent 4cfd25c commit 917b0a7

28 files changed

Lines changed: 86 additions & 85 deletions

.github/labeler.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ smartem-devtools:claude:
2121

2222
smartem-devtools:e2e-test:
2323
- changed-files:
24-
- any-glob-to-any-file: tools/e2e/**
24+
- any-glob-to-any-file: tests/e2e/**
2525

2626
# Type-of-work labels
2727
documentation:
@@ -34,6 +34,6 @@ devops:
3434
- changed-files:
3535
- any-glob-to-any-file:
3636
- .github/**
37-
- tools/k8s/**
38-
- tools/github/**
37+
- scripts/k8s/**
38+
- scripts/github/**
3939
- k8s/**

.github/workflows/gitflow.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ on:
1515
branches: [main]
1616
paths:
1717
- 'core/github-tags-config.ts'
18-
- 'tools/github/**'
18+
- 'scripts/github/**'
1919

2020
jobs:
2121
check-labels:
@@ -38,7 +38,7 @@ jobs:
3838
- name: Check labels
3939
env:
4040
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
run: npx tsx tools/github/sync-labels.ts --check --verbose
41+
run: npx tsx scripts/github/sync-labels.ts --check --verbose
4242

4343
sync-labels:
4444
name: Sync Labels
@@ -60,4 +60,4 @@ jobs:
6060
- name: Sync labels
6161
env:
6262
GH_TOKEN: ${{ secrets.LABEL_SYNC_TOKEN }}
63-
run: npx tsx tools/github/sync-labels.ts --sync --verbose
63+
run: npx tsx scripts/github/sync-labels.ts --sync --verbose

claude-code/CLAUDE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,16 +127,16 @@ Developer tooling, documentation, and workspace configuration for the SmartEM ec
127127
- Core TypeScript config for multi-repo management
128128
- API specs (SmartEM, Athena)
129129
- Kubernetes manifests for dev/stage/prod (k8s/)
130-
- K8s development scripts (tools/k8s/)
131-
- E2E test scripts (tools/e2e/)
130+
- K8s development scripts (scripts/k8s/)
131+
- E2E test scripts (tests/e2e/)
132132
- EPUPlayer for EPU filesystem recording/playback (packages/smartem-epuplayer/)
133133

134134
**Key directories:**
135135
- `docs/` - Markdown documentation, ADRs, how-to guides (synced to webui as MDX)
136136
- `claude-code/` - Skills, repo guidelines, architecture docs
137137
- `webui/` - React developer dashboard
138138
- `core/` - Repository and workspace config definitions
139-
- `tools/e2e/` - E2E test runners for SmartEM (single and multi-microscope)
139+
- `tests/e2e/` - E2E test runners for SmartEM (single and multi-microscope)
140140
- `packages/smartem-epuplayer/` - EPU filesystem recording/playback for dev/test
141141

142142
**Tech**: Python 3.11+, Node.js, React 19, Vite, TypeScript

claude-code/shared/skills/devops/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ Kubernetes deployment, container management, and CI/CD operations for the SmartE
2525
cd repos/DiamondLightSource/smartem-decisions
2626

2727
# Start local k3s cluster with all services
28-
./tools/k8s/dev-k8s.sh up
28+
./scripts/k8s/dev-k8s.sh up
2929

3030
# Stop and cleanup
31-
./tools/k8s/dev-k8s.sh down
31+
./scripts/k8s/dev-k8s.sh down
3232

3333
# Check cluster status
3434
kubectl get pods -n smartem-decisions

claude-code/smartem-decisions/settings.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@
3434
"Bash(psql:*)",
3535
"Bash(pg_dump:*)",
3636
"Bash(pg_restore:*)",
37-
"Bash(./tools/k8s/dev-k8s.sh:*)",
38-
"Bash(./tools/*)",
37+
"Bash(./scripts/k8s/dev-k8s.sh:*)",
38+
"Bash(./scripts/*)",
39+
"Bash(./tests/*)",
3940
"WebFetch(domain:github.com)",
4041
"WebFetch(domain:diamondlightsource.github.io)",
4142
"WebFetch(domain:docs.anthropic.com)",

docs/backend/api-server.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ The core backend service providing HTTP API, database operations, and message qu
66

77
```bash
88
# create env and launch service stack locally:
9-
./tools/k8s/dev-k8s.sh up
9+
./scripts/k8s/dev-k8s.sh up
1010

1111
# launch RabbitMQ worker (consumer)
1212
python -m smartem_backend.consumer # ERROR level (default)

docs/decision-records/decisions/0006-sealed-secrets-kubernetes-secrets-management.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ be safely committed to version control whilst maintaining security.
4646

4747
Implementation will include:
4848
- Installation of sealed-secrets controller in each Kubernetes environment
49-
- Integration with existing deployment workflow via tools/k8s/generate-sealed-secrets.sh script
49+
- Integration with existing deployment workflow via scripts/k8s/generate-sealed-secrets.sh script
5050
- Documentation in docs/how-to/manage-kubernetes-secrets.md for team procedures
5151
- Environment-specific encryption keys for development, staging, and production clusters
5252

docs/decision-records/decisions/0013-json-config-with-typescript-types.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ React components
9696
### Modified
9797
- `webui/src/config/index.ts` - now imports from `core/index.ts` and transforms
9898
- `webui/scripts/prebuild.ts` - simplified to docs sync only
99-
- `tools/github/sync-labels.ts` - updated import path
99+
- `scripts/github/sync-labels.ts` - updated import path
100100

101101
### Deleted
102102
- `core/github-labels-config.ts`

docs/development/e2e-simulation.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,21 @@ For the simplest test execution, use the automated test runner script:
88

99
```bash
1010
# Check k3s status first (DO NOT restart if already running)
11-
./tools/k8s/dev-k8s.sh status
11+
./scripts/k8s/dev-k8s.sh status
1212

1313
# Run automated test (Test Type 2: Pre-Acquisition Agent Setup)
14-
./tools/run-e2e-test.sh
14+
./tests/e2e/run-e2e-test.sh
1515

1616
# With custom parameters (paths relative to workspace root)
17-
./tools/run-e2e-test.sh \
17+
./tests/e2e/run-e2e-test.sh \
1818
../../testdata/recordings/bi37708-42_epurecording.tar.gz \
1919
../../tmp/epu-test-dir \
2020
0.1
2121

2222
# Or override via environment variables
2323
SMARTEM_TEST_RECORDING=/path/to/recording.tar.gz \
2424
SMARTEM_EPU_DIR=/path/to/epu-dir \
25-
./tools/run-e2e-test.sh
25+
./tests/e2e/run-e2e-test.sh
2626
```
2727

2828
**Script parameters** (all optional):
@@ -64,7 +64,7 @@ If you've already set up once and just need to run another test:
6464

6565
```bash
6666
# 1. Check k3s status (DO NOT restart if already running)
67-
./tools/k8s/dev-k8s.sh status
67+
./scripts/k8s/dev-k8s.sh status
6868

6969
# 2. Prepare clean environment
7070
unset POSTGRES_HOST POSTGRES_PORT POSTGRES_DB POSTGRES_USER POSTGRES_PASSWORD
@@ -115,13 +115,13 @@ For testing multiple concurrent microscopes and acquisition sessions simultaneou
115115

116116
```bash
117117
# Check k3s status first (DO NOT restart if already running)
118-
./tools/k8s/dev-k8s.sh status
118+
./scripts/k8s/dev-k8s.sh status
119119

120120
# Run multi-microscope test with 3 microscopes (default)
121-
./tools/run-e2e-test-multi-microscope.sh
121+
./tests/e2e/run-e2e-test-multi-microscope.sh
122122

123123
# With custom parameters (paths relative to workspace root)
124-
./tools/run-e2e-test-multi-microscope.sh \
124+
./tests/e2e/run-e2e-test-multi-microscope.sh \
125125
3 \
126126
../../testdata/recordings/bi37708-42_epurecording.tar.gz \
127127
../../tmp/epu-test-dir \
@@ -130,7 +130,7 @@ For testing multiple concurrent microscopes and acquisition sessions simultaneou
130130
# Or override via environment variables
131131
SMARTEM_TEST_RECORDING=/path/to/recording.tar.gz \
132132
SMARTEM_EPU_DIR=/path/to/epu-dir \
133-
./tools/run-e2e-test-multi-microscope.sh 3
133+
./tests/e2e/run-e2e-test-multi-microscope.sh 3
134134
```
135135

136136
**Script parameters** (all optional):
@@ -239,7 +239,7 @@ The test setup simulates a complete SmartEM workflow:
239239
### Environment Setup
240240
- Python 3.12+ with venv activated: `source .venv/bin/activate`
241241
- Full development install: `pip install -e .[all]`
242-
- Local k3s cluster running: `./tools/k8s/dev-k8s.sh up`
242+
- Local k3s cluster running: `./scripts/k8s/dev-k8s.sh up`
243243
- Environment file: `.env` (created from `.env.example` - see Environment File Setup below)
244244

245245
### Test Data
@@ -298,7 +298,7 @@ ADMINER_PORT=8080
298298
CORS_ALLOWED_ORIGINS=*
299299
```
300300

301-
**Usage**: Automatically loaded by `./tools/run-e2e-test.sh` script
301+
**Usage**: Automatically loaded by `./tests/e2e/run-e2e-test.sh` script
302302

303303
## Database Operations
304304

@@ -506,7 +506,7 @@ pkill -f uvicorn
506506
pkill -f fastapi
507507

508508
# 5. Verify k3s services are running (DO NOT restart if already running)
509-
./tools/k8s/dev-k8s.sh status
509+
./scripts/k8s/dev-k8s.sh status
510510

511511
# 6. Clean RabbitMQ (restart to ensure empty queue)
512512
kubectl rollout restart deployment/rabbitmq -n smartem-decisions
@@ -773,7 +773,7 @@ pgrep -f "smartem_backend|smartem_agent|epuplayer"
773773
rm -rf ../epu-test-dir
774774

775775
# Stop k3s cluster (if needed)
776-
./tools/k8s/dev-k8s.sh down
776+
./scripts/k8s/dev-k8s.sh down
777777
```
778778

779779
## Troubleshooting

docs/development/github-labels.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The SmartEM ecosystem uses a standardised set of GitHub labels across four repos
1111
- `DiamondLightSource/smartem-devtools`
1212
- `DiamondLightSource/fandanGO-cryoem-dls`
1313

14-
Labels are defined in `core/github-labels-config.ts` and synced using `tools/github/sync-labels.ts`.
14+
Labels are defined in `core/github-labels-config.ts` and synced using `scripts/github/sync-labels.ts`.
1515

1616
## Prerequisites
1717

@@ -90,7 +90,7 @@ npm run labels:check
9090
Or directly:
9191

9292
```bash
93-
npx tsx tools/github/sync-labels.ts --check
93+
npx tsx scripts/github/sync-labels.ts --check
9494
```
9595

9696
This will:
@@ -110,7 +110,7 @@ npm run labels:sync
110110
Or directly:
111111

112112
```bash
113-
npx tsx tools/github/sync-labels.ts --sync
113+
npx tsx scripts/github/sync-labels.ts --sync
114114
```
115115

116116
This will:
@@ -123,23 +123,23 @@ This will:
123123
To sync only specific repositories:
124124

125125
```bash
126-
npx tsx tools/github/sync-labels.ts --sync --repo smartem-decisions
127-
npx tsx tools/github/sync-labels.ts --sync --repo smartem-frontend --repo smartem-devtools
126+
npx tsx scripts/github/sync-labels.ts --sync --repo smartem-decisions
127+
npx tsx scripts/github/sync-labels.ts --sync --repo smartem-frontend --repo smartem-devtools
128128
```
129129

130130
### Verbose Output
131131

132132
For detailed output including conforming labels:
133133

134134
```bash
135-
npx tsx tools/github/sync-labels.ts --check --verbose
135+
npx tsx scripts/github/sync-labels.ts --check --verbose
136136
```
137137

138138
## CI/CD Integration
139139

140140
The `gitflow.yml` workflow automates label management:
141141

142-
- **On push to main**: Runs `--check` mode when `core/github-labels-config.ts` or `tools/github/**` changes
142+
- **On push to main**: Runs `--check` mode when `core/github-labels-config.ts` or `scripts/github/**` changes
143143
- **Manual dispatch**: Can trigger `--sync` mode via GitHub Actions UI
144144

145145
### Running Sync via CI/CD

0 commit comments

Comments
 (0)