After the repositories and the mirror, the script now creates the local project: the directory, git on main, credential-free origin (and github) remotes, and the license history from Gitea. Then it adds the framework as a submodule over SSH, installs its skills and git hooks once (plan gate optional), and copies the AGENTS.md and artifact registry templates. Nothing is overwritten without a yes: an existing directory, core.hooksPath, AGENTS.md or docs/artifact-registry.md each ask first (default no). Without SSH the framework steps can only be skipped, after a yes. No commit is made in the new project. New optional config key FRAMEWORK_REPO. New library files git.sh, localproject.sh and framework.sh. Tests run real git against local bare repositories that stand in for Gitea and the framework, with a private git configuration (769 checks). The README is now the full guide. Task: MIL-003#1 Task: MIL-003#2 Task: MIL-003#3 Task: MIL-003#4 Task: MIL-003#5 Refs #15 Refs #16 Refs #17 Refs #18 Refs #19 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
49 lines
1.6 KiB
Bash
49 lines
1.6 KiB
Bash
# shellcheck shell=bash
|
|
# constants.sh - Constants and the shared state of a run.
|
|
#
|
|
# Part of create-project.sh: sourced by it, never run on its own.
|
|
#
|
|
# The state variables are read and written by the other library files; this
|
|
# is the one place that declares them.
|
|
# shellcheck disable=SC2034 # read and written by the other library files
|
|
|
|
readonly PROJECT_NAME="${REPOFOUNDRY_NAME:-RepoFoundry}"
|
|
readonly VERSION="0.3.0"
|
|
readonly EXIT_FAILURE=1
|
|
readonly EXIT_USAGE=2
|
|
readonly MAX_VALUE_LENGTH=2048
|
|
readonly MAX_DESCRIPTION_LENGTH=350
|
|
readonly HTTP_TIMEOUT_SECONDS=30
|
|
readonly DEFAULT_MIRROR_INTERVAL="10m0s"
|
|
readonly DEFAULT_SSH_PORT=10022
|
|
readonly DEFAULT_FRAMEWORK_REPO="TirSystem/SQA-QC-Framework"
|
|
readonly AGPL_LICENSE_KEY="AGPL-3.0"
|
|
readonly DEFAULT_BRANCH="main"
|
|
readonly PLAN_STEPS=("GitHub repository" "Gitea repository" "Push mirror"
|
|
"Local project" "Framework" "Skills and hooks" "Templates")
|
|
# shellcheck disable=SC2034 # read through namerefs (parse_env_file)
|
|
readonly CONFIG_KEYS=(GITHUB_API_URL GITHUB_WEB_URL GITEA_URL GITEA_API_URL
|
|
GITEA_SSH_PORT MIRROR_INTERVAL FRAMEWORK_REPO)
|
|
readonly CREDENTIAL_KEYS=(GITHUB_PAT GITHUB_USER GITEA_TOKEN)
|
|
|
|
CONFIG_FILE="$PROJECT_ROOT/config.env"
|
|
ENV_FILE="$PROJECT_ROOT/.env"
|
|
TMP_DIR=""
|
|
HAS_JQ=0
|
|
HTTP_STATUS=0
|
|
HTTP_BODY_FILE=""
|
|
HTTP_ERROR=""
|
|
REPLY=""
|
|
IS_APPLY=0
|
|
IS_CREATION_STARTED=0
|
|
SECRET_VALUES=()
|
|
TEMP_FILES=()
|
|
declare -A CONFIG=()
|
|
declare -A CREDENTIALS=()
|
|
declare -A PROJECT=()
|
|
# Facts found by the preflight checks (logins, owner kinds, repository state).
|
|
declare -A STATE=()
|
|
# Outcome of each step in PLAN_STEPS, for the final report.
|
|
declare -A STEP_STATUS=()
|
|
declare -A STEP_DETAIL=()
|