-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Expand file tree
/
Copy pathcops
More file actions
executable file
·73 lines (66 loc) · 1.65 KB
/
Copy pathcops
File metadata and controls
executable file
·73 lines (66 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/usr/bin/env bash
# cops — thin wrapper: run any career-ops command inside the docker container.
#
# Examples:
# ./cops doctor
# ./cops verify
# ./cops pdf cv.html output/cv.pdf
# ./cops scan
# ./cops node generate-pdf.mjs cv.html output/cv.pdf
# ./cops shell # interactive bash
# ./cops up | down | rebuild | logs
#
# Anything not matching a known subcommand is forwarded to npm run <subcommand>
# when package.json defines it, otherwise executed verbatim inside the container.
set -euo pipefail
cd "$(dirname "$0")"
SERVICE="career-ops"
ensure_up() {
if ! docker compose ps --services --filter "status=running" | grep -qx "$SERVICE"; then
docker compose up -d >/dev/null
fi
}
case "${1:-}" in
""|help|-h|--help)
sed -n '2,15p' "$0" | sed 's/^# \{0,1\}//'
exit 0
;;
up)
docker compose up -d
exit 0
;;
down)
docker compose down
exit 0
;;
rebuild)
docker compose build --no-cache
docker compose up -d
exit 0
;;
logs)
shift
docker compose logs -f "$@"
exit 0
;;
shell|bash)
ensure_up
exec docker compose exec -it "$SERVICE" bash
;;
node|npm|npx|go|bash|sh)
ensure_up
exec docker compose exec -it "$SERVICE" "$@"
;;
esac
# Map known npm scripts → `npm run <name>`. Anything else is forwarded raw.
cmd="$1"; shift || true
case "$cmd" in
doctor|verify|normalize|dedup|merge|pdf|sync-check|liveness|scan|gemini:eval|update|update:check|rollback)
ensure_up
exec docker compose exec -it "$SERVICE" npm run --silent "$cmd" -- "$@"
;;
*)
ensure_up
exec docker compose exec -it "$SERVICE" "$cmd" "$@"
;;
esac