forked from xencon/aixcl
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaixcl
More file actions
executable file
·102 lines (84 loc) · 4.09 KB
/
Copy pathaixcl
File metadata and controls
executable file
·102 lines (84 loc) · 4.09 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash
#
# AIXCL - AI Execution Control Layer
# Main entry point script
#
set -e # Exit on error
set -u # Treat unset variables as an error
set -o pipefail # Catch errors in pipelines
# Get script directory early (needed for compose file paths and library sourcing)
SCRIPT_DIR="$(cd "$(dirname "$(readlink -f "$0")")" && pwd)"
# ── Source shared libraries ──────────────────────────────────────────────────
# Order matters: color.sh and common.sh first (no dependencies), then modules
# that depend on them. load_env_file must run before docker_utils.sh so that
# COMPOSE_FILE from .env is picked up during validation.
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/color.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/common.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/service_utils.sh"
# Load environment variables from .env file (before docker_utils validates COMPOSE_FILE)
if ! load_env_file ".env"; then
if [ "${1:-}" != "stack" ] || [ "${2:-}" != "start" ]; then
echo " Warning: .env file not found. AIXCL will use default values."
echo " Run './aixcl stack start' to initialize the environment."
echo ""
fi
fi
# docker_utils.sh validates COMPOSE_FILE and sets default COMPOSE_CMD/COMPOSE_WORKDIR
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/docker_utils.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/logging.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/env_check.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/pgadmin_utils.sh"
# CLI profile management (must be before AIXCL modules that use profiles)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/cli/profile.sh"
# App manifest parser (safe: Python3-based YAML parsing, no eval on user input)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/app_parser.sh"
# App provisioning (platform-side hook implementing the app.yaml provision contract)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/core/app_provision.sh"
# ── Source AIXCL modules ─────────────────────────────────────────────────────
# CLI module (contains help_menu, install_completion)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/cli.sh"
# Command modules (order matters: utils, config, models are used by stack)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/utils.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/engine.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/models.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/stack.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/checks.sh"
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/test.sh"
# Vault command module
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/vault.sh"
# Application services command module (generic "bring your own app" infrastructure)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/app.sh"
# Release process command module (developer workflow tooling)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/commands/release.sh"
# Dispatcher (must be last - contains main function)
# shellcheck disable=SC1091
source "${SCRIPT_DIR}/lib/aixcl/dispatcher.sh"
# ── Source the autocomplete script if it exists ─────────────────────────────
# (with security validation)
COMPLETION_SCRIPT="${SCRIPT_DIR}/completion/aixcl.bash"
if [ -f "$COMPLETION_SCRIPT" ] && [[ "$COMPLETION_SCRIPT" =~ ^/ ]] && [ -r "$COMPLETION_SCRIPT" ]; then
# shellcheck disable=SC1090
source "$COMPLETION_SCRIPT"
fi
# ── Entry point ─────────────────────────────────────────────────────────────
main "$@"