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>
53 lines
1.9 KiB
Bash
53 lines
1.9 KiB
Bash
# shellcheck shell=bash
|
|
# shellcheck disable=SC2004,SC2034,SC2154 # shared state and arrays are declared in constants.sh
|
|
# steps.sh - The outcome of each step and the final report of a run.
|
|
#
|
|
# Part of create-project.sh: sourced by it, never run on its own.
|
|
#
|
|
# Provides: init_steps, begin_step, finish_step, report_outcome
|
|
|
|
init_steps() {
|
|
local label
|
|
for label in "${PLAN_STEPS[@]}"; do
|
|
STEP_STATUS[$label]="not attempted"
|
|
STEP_DETAIL[$label]=""
|
|
done
|
|
if ! ((PROJECT[has_github])); then
|
|
STEP_STATUS["GitHub repository"]="not used"
|
|
STEP_STATUS["Push mirror"]="not used"
|
|
fi
|
|
}
|
|
|
|
# begin_step LABEL marks the step failed until finish_step says otherwise, so
|
|
# any stop in the middle of a step is reported as a failure of that step.
|
|
begin_step() {
|
|
STEP_STATUS[$1]="FAILED"
|
|
STEP_DETAIL[$1]=""
|
|
}
|
|
|
|
finish_step() {
|
|
STEP_STATUS[$1]="$2"
|
|
STEP_DETAIL[$1]="${3:-}"
|
|
}
|
|
|
|
report_outcome() {
|
|
local code="$1" label
|
|
say ""
|
|
if ((code == 0)); then
|
|
say "Done. This is what exists now:"
|
|
else
|
|
say "The run stopped before it finished. This is what exists now:"
|
|
fi
|
|
for label in "${PLAN_STEPS[@]}"; do
|
|
say "$(printf ' %-18s: %s' "$label" "${STEP_STATUS[$label]}${STEP_DETAIL[$label]:+ ${STEP_DETAIL[$label]}}")"
|
|
done
|
|
if ((code == 0)); then
|
|
say "The project is in ${PROJECT[directory]}. Nothing was committed there: review it, then work on a branch."
|
|
else
|
|
say "To continue: fix the problem named above and run the same command again with --apply."
|
|
say "A repository this run created is still empty (or holds only the license), so the next run offers to reuse it."
|
|
say "A directory, remotes and submodule created so far are used again by the next run; you are asked before an existing directory or file is touched."
|
|
say "Nothing is deleted automatically. To start over, delete the repositories above in the web interface and the project directory by hand."
|
|
fi
|
|
}
|