Files
metabuilder/deployment/deployment.py
johndoe6345789 03d07635a2 feat(deployment): add modular Python CLI, fix node-deps registry routing, bump to Node 24
- Dockerfile.node-deps: upgrade FROM node:22 to node:24
- Dockerfile.node-deps: rewrite main registry= line to Nexus when detected
  (was only rewriting scoped @esbuild-kit registry, leaving registry.npmjs.org
  unreachable inside Docker)
- Dockerfile.node-deps: fix sed ordering so cleanup of old auth lines runs
  before registry rewrite (prevents new registry= line from being deleted)
- Add deployment/cli/ modular Python CLI powered by JSON config, replacing
  12 shell scripts (build-base-images.sh, build-apps.sh, deploy.sh,
  start-stack.sh, release.sh, nexus-init.sh, nexus-ci-init.sh,
  push-to-nexus.sh, populate-nexus.sh, publish-npm-patches.sh,
  build-testcontainers.sh, artifactory-init.sh)
- Bump rocksdict 0.3.23 -> 0.3.29 (old version removed from PyPI)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 01:13:47 +00:00

49 lines
1.6 KiB
Python

#!/usr/bin/env python3
"""MetaBuilder Deployment CLI — JSON-powered, modular command system.
All command definitions live in cli/commands.json.
Each command dispatches to a Python module in cli/*.py.
Usage:
python3 deployment.py --help
python3 deployment.py build base [--force] [apt] [node-deps] ...
python3 deployment.py build apps [--force] [--sequential] [codegen] ...
python3 deployment.py build testcontainers [--skip-native] [--skip-sidecar]
python3 deployment.py deploy <app> [--all] [--no-cache]
python3 deployment.py stack up|down|build|logs|ps|clean [--monitoring] [--media]
python3 deployment.py release <app> [patch|minor|major|x.y.z]
python3 deployment.py nexus init|push|populate
python3 deployment.py npm publish-patches [--nexus] [--verdaccio]
python3 deployment.py artifactory init
"""
import sys
from cli.loader import build_parser, dispatch
def main() -> int:
parser, config = build_parser()
args = parser.parse_args()
if not args.command:
parser.print_help()
return 0
# Handle --list for build base
if args.command == "build" and getattr(args, "build_type", None) == "base" and getattr(args, "list", False):
for name, img in config["definitions"]["base_images"].items():
print(f" {name} -> {img['tag']}")
return 0
module_path = getattr(args, "_module", None)
if not module_path:
# No module set — print help for the subcommand group
parser.parse_args([args.command, "--help"])
return 0
return dispatch(args, config)
if __name__ == "__main__":
sys.exit(main())