Skip to content

qtsone/learning / skills/tutor

tutor

Flagged

Turn this agent into a personal programming tutor with a versioned 0-to-expert curriculum (Go available; more languages coming). Use when the user wants to learn a programming language, start or resume lessons, get their exercise code graded, check learning progress, or contribute curriculum fixes — e.g. "/tutor go", "/tutor resume", "teach me Go", "continue my lessons", "grade my exercise".

FileKindSize
SKILL.mdskill md9.2 KB
curriculum/content/focus/cli-tooling/capstone/LESSON.mdmarkdown17.1 KB
curriculum/content/focus/cli-tooling/capstone/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/app.goscript5.8 KB
curriculum/content/focus/cli-tooling/capstone/exercise/authors.goscript1.6 KB
curriculum/content/focus/cli-tooling/capstone/exercise/authors_test.goscript7.3 KB
curriculum/content/focus/cli-tooling/capstone/exercise/cli_test.goscript11.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/config_test.goscript11.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/go.modmanifest187 B
curriculum/content/focus/cli-tooling/capstone/exercise/go.summanifest900 B
curriculum/content/focus/cli-tooling/capstone/exercise/main.goscript2.0 KB
curriculum/content/focus/cli-tooling/capstone/exercise/render.goscript1.9 KB
curriculum/content/focus/cli-tooling/capstone/exercise/root.goscript2.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/scan.goscript2.5 KB
curriculum/content/focus/cli-tooling/capstone/exercise/scan_test.goscript4.0 KB
curriculum/content/focus/cli-tooling/capstone/exercise/signal_unix_test.goscript1.4 KB
curriculum/content/focus/cli-tooling/capstone/exercise/version.goscript942 B
curriculum/content/focus/cli-tooling/capstone/quiz.jsonconfig5.0 KB
curriculum/content/focus/cli-tooling/capstone/solution/app.goscript9.9 KB
curriculum/content/focus/cli-tooling/capstone/solution/authors.goscript2.9 KB
curriculum/content/focus/cli-tooling/capstone/solution/render.goscript2.6 KB
curriculum/content/focus/cli-tooling/capstone/solution/root.goscript4.7 KB
curriculum/content/focus/cli-tooling/capstone/solution/scan.goscript3.7 KB
curriculum/content/focus/cli-tooling/cobra/LESSON.mdmarkdown12.8 KB
curriculum/content/focus/cli-tooling/cobra/TUTOR.mdmarkdown5.9 KB
curriculum/content/focus/cli-tooling/cobra/exercise/app.goscript1.7 KB
curriculum/content/focus/cli-tooling/cobra/exercise/go.modmanifest193 B
curriculum/content/focus/cli-tooling/cobra/exercise/go.summanifest900 B
curriculum/content/focus/cli-tooling/cobra/exercise/main.goscript422 B
curriculum/content/focus/cli-tooling/cobra/exercise/notes_test.goscript9.8 KB
curriculum/content/focus/cli-tooling/cobra/exercise/root.goscript919 B
curriculum/content/focus/cli-tooling/cobra/exercise/store.goscript1.7 KB
curriculum/content/focus/cli-tooling/cobra/quiz.jsonconfig5.1 KB
curriculum/content/focus/cli-tooling/cobra/solution/app.goscript2.4 KB
curriculum/content/focus/cli-tooling/cobra/solution/root.goscript4.2 KB
curriculum/content/focus/cli-tooling/distribution/LESSON.mdmarkdown17.2 KB
curriculum/content/focus/cli-tooling/distribution/TUTOR.mdmarkdown7.0 KB
curriculum/content/focus/cli-tooling/distribution/exercise/check.shexecutablescript12.0 KB
curriculum/content/focus/cli-tooling/distribution/exercise/go.modmanifest35 B
curriculum/content/focus/cli-tooling/distribution/exercise/internal/buildinfo/buildinfo.goscript1.4 KB
curriculum/content/focus/cli-tooling/distribution/exercise/main.goscript1.2 KB
curriculum/content/focus/cli-tooling/distribution/quiz.jsonconfig5.0 KB
curriculum/content/focus/cli-tooling/distribution/solution/.goreleaser.yamlconfig2.1 KB
curriculum/content/focus/cli-tooling/distribution/solution/internal/buildinfo/buildinfo.goscript1.3 KB
curriculum/content/focus/cli-tooling/files-processes/LESSON.mdmarkdown18.8 KB
curriculum/content/focus/cli-tooling/files-processes/TUTOR.mdmarkdown7.8 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/atomicfile.goscript772 B
curriculum/content/focus/cli-tooling/files-processes/exercise/atomicfile_test.goscript2.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/exec.goscript3.8 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/exec_test.goscript10.7 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/go.modmanifest44 B
curriculum/content/focus/cli-tooling/files-processes/exercise/main.goscript1.9 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/paths.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/paths_test.goscript3.1 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal_test.goscript1.6 KB
curriculum/content/focus/cli-tooling/files-processes/exercise/signal_unix_test.goscript2.4 KB
curriculum/content/focus/cli-tooling/files-processes/quiz.jsonconfig7.9 KB
curriculum/content/focus/cli-tooling/files-processes/solution/atomicfile.goscript2.1 KB
curriculum/content/focus/cli-tooling/files-processes/solution/exec.goscript5.4 KB
curriculum/content/focus/cli-tooling/files-processes/solution/paths.goscript2.2 KB
curriculum/content/focus/cli-tooling/files-processes/solution/signal.goscript2.1 KB
curriculum/content/focus/cli-tooling/flags-config/LESSON.mdmarkdown12.3 KB
curriculum/content/focus/cli-tooling/flags-config/TUTOR.mdmarkdown6.7 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/config.goscript2.4 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/config_test.goscript3.1 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/flagvalue.goscript769 B
curriculum/content/focus/cli-tooling/flags-config/exercise/flagvalue_test.goscript1.9 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/go.modmanifest41 B
curriculum/content/focus/cli-tooling/flags-config/exercise/loader.goscript5.5 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/loader_test.goscript12.4 KB
curriculum/content/focus/cli-tooling/flags-config/exercise/main.goscript1.2 KB
curriculum/content/focus/cli-tooling/flags-config/quiz.jsonconfig5.3 KB
curriculum/content/focus/cli-tooling/flags-config/solution/config.goscript3.2 KB
curriculum/content/focus/cli-tooling/flags-config/solution/flagvalue.goscript957 B
curriculum/content/focus/cli-tooling/flags-config/solution/loader.goscript9.0 KB
curriculum/content/focus/cli-tooling/terminal-ux/LESSON.mdmarkdown14.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/TUTOR.mdmarkdown6.2 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/color.goscript1.6 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/color_test.goscript2.3 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/go.modmanifest40 B
curriculum/content/focus/cli-tooling/terminal-ux/exercise/main.goscript3.6 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/progress.goscript1.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/progress_test.goscript1.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/prompt.goscript2.3 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/prompt_test.goscript4.7 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/render.goscript3.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/exercise/render_test.goscript6.1 KB
curriculum/content/focus/cli-tooling/terminal-ux/quiz.jsonconfig5.9 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/color.goscript1.8 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/progress.goscript2.0 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/prompt.goscript2.2 KB
curriculum/content/focus/cli-tooling/terminal-ux/solution/render.goscript4.3 KB
curriculum/content/focus/containers/capstone/LESSON.mdmarkdown20.0 KB
curriculum/content/focus/containers/capstone/TUTOR.mdmarkdown6.7 KB
curriculum/content/focus/containers/capstone/exercise/.dockerignoreother190 B
curriculum/content/focus/containers/capstone/exercise/.github/workflows/release.ymlconfig2.4 KB
curriculum/content/focus/containers/capstone/exercise/Dockerfileother903 B
curriculum/content/focus/containers/capstone/exercise/RUNBOOK.mdmarkdown1.6 KB
curriculum/content/focus/containers/capstone/exercise/check.shscript62.6 KB
curriculum/content/focus/containers/capstone/exercise/deploy/base/deployment.yamlconfig2.8 KB
curriculum/content/focus/containers/capstone/exercise/deploy/base/kustomization.yamlconfig845 B
curriculum/content/focus/containers/capstone/exercise/deploy/base/service.yamlconfig316 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/dev/kustomization.yamlconfig1.3 KB
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/dev/resources-patch.yamlconfig906 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/prod/kustomization.yamlconfig899 B
curriculum/content/focus/containers/capstone/exercise/deploy/overlays/prod/resources-patch.yamlconfig341 B
curriculum/content/focus/containers/capstone/exercise/go.modmanifest48 B
curriculum/content/focus/containers/capstone/exercise/main.goscript6.4 KB
curriculum/content/focus/containers/capstone/quiz.jsonconfig6.5 KB
curriculum/content/focus/containers/capstone/solution/.github/workflows/release.ymlconfig6.4 KB
curriculum/content/focus/containers/capstone/solution/Dockerfileother1.2 KB
curriculum/content/focus/containers/capstone/solution/RUNBOOK.mdmarkdown7.7 KB
curriculum/content/focus/containers/capstone/solution/deploy/overlays/prod/kustomization.yamlconfig1.4 KB
curriculum/content/focus/containers/capstone/solution/deploy/overlays/prod/resources-patch.yamlconfig1.1 KB
curriculum/content/focus/containers/compose/LESSON.mdmarkdown13.5 KB
curriculum/content/focus/containers/compose/TUTOR.mdmarkdown5.2 KB
curriculum/content/focus/containers/compose/exercise/.env.exampleother348 B
curriculum/content/focus/containers/compose/exercise/app/Dockerfileother962 B
curriculum/content/focus/containers/compose/exercise/app/go.modmanifest40 B
curriculum/content/focus/containers/compose/exercise/app/main.goscript2.2 KB
curriculum/content/focus/containers/compose/exercise/check.shscript24.5 KB
curriculum/content/focus/containers/compose/exercise/compose.yamlconfig877 B
curriculum/content/focus/containers/compose/quiz.jsonconfig4.5 KB
curriculum/content/focus/containers/compose/solution/.envconfig203 B
curriculum/content/focus/containers/compose/solution/compose.yamlconfig1.6 KB
curriculum/content/focus/containers/deploying-go/LESSON.mdmarkdown21.1 KB
curriculum/content/focus/containers/deploying-go/TUTOR.mdmarkdown6.5 KB
curriculum/content/focus/containers/deploying-go/exercise/.dockerignoreother150 B
curriculum/content/focus/containers/deploying-go/exercise/Dockerfileother851 B
curriculum/content/focus/containers/deploying-go/exercise/SHUTDOWN.mdmarkdown1.4 KB
curriculum/content/focus/containers/deploying-go/exercise/check.shscript43.5 KB
curriculum/content/focus/containers/deploying-go/exercise/configmap.yamlconfig526 B
curriculum/content/focus/containers/deploying-go/exercise/deployment.yamlconfig2.5 KB
curriculum/content/focus/containers/deploying-go/exercise/go.modmanifest41 B
curriculum/content/focus/containers/deploying-go/exercise/main.goscript6.1 KB
curriculum/content/focus/containers/deploying-go/exercise/service.yamlconfig347 B
curriculum/content/focus/containers/deploying-go/exercise/shutdown_test.goscript3.3 KB
curriculum/content/focus/containers/deploying-go/quiz.jsonconfig6.5 KB
curriculum/content/focus/containers/deploying-go/solution/SHUTDOWN.mdmarkdown5.4 KB
curriculum/content/focus/containers/deploying-go/solution/configmap.yamlconfig541 B
curriculum/content/focus/containers/deploying-go/solution/deployment.yamlconfig4.0 KB
curriculum/content/focus/containers/deploying-go/solution/main.goscript6.1 KB
curriculum/content/focus/containers/docker-fundamentals/LESSON.mdmarkdown14.4 KB
curriculum/content/focus/containers/docker-fundamentals/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/Dockerfileother261 B
curriculum/content/focus/containers/docker-fundamentals/exercise/NOTES.mdmarkdown1.4 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/check.shscript10.7 KB
curriculum/content/focus/containers/docker-fundamentals/exercise/go.modmanifest38 B
curriculum/content/focus/containers/docker-fundamentals/exercise/local.envconfig218 B
curriculum/content/focus/containers/docker-fundamentals/exercise/main.goscript780 B
curriculum/content/focus/containers/docker-fundamentals/exercise/scratch/notes.mdmarkdown153 B
curriculum/content/focus/containers/docker-fundamentals/quiz.jsonconfig5.5 KB
curriculum/content/focus/containers/docker-fundamentals/solution/.dockerignoreother230 B
curriculum/content/focus/containers/docker-fundamentals/solution/Dockerfileother504 B
curriculum/content/focus/containers/docker-fundamentals/solution/NOTES.mdmarkdown3.8 KB
curriculum/content/focus/containers/dockerizing-go/LESSON.mdmarkdown14.0 KB
curriculum/content/focus/containers/dockerizing-go/TUTOR.mdmarkdown5.4 KB
curriculum/content/focus/containers/dockerizing-go/exercise/.dockerignoreother143 B
curriculum/content/focus/containers/dockerizing-go/exercise/Dockerfile.naiveother512 B
curriculum/content/focus/containers/dockerizing-go/exercise/NOTES.mdmarkdown1.1 KB
curriculum/content/focus/containers/dockerizing-go/exercise/check.shscript14.2 KB
curriculum/content/focus/containers/dockerizing-go/exercise/go.modmanifest43 B
curriculum/content/focus/containers/dockerizing-go/exercise/go.summanifest0 B
curriculum/content/focus/containers/dockerizing-go/exercise/main.goscript1.7 KB
curriculum/content/focus/containers/dockerizing-go/quiz.jsonconfig4.5 KB
curriculum/content/focus/containers/dockerizing-go/solution/Dockerfileother755 B
curriculum/content/focus/containers/dockerizing-go/solution/NOTES.mdmarkdown2.7 KB
curriculum/content/focus/containers/helm-kustomize/LESSON.mdmarkdown19.1 KB
curriculum/content/focus/containers/helm-kustomize/TUTOR.mdmarkdown9.5 KB
curriculum/content/focus/containers/helm-kustomize/exercise/NOTES.mdmarkdown1.5 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/Chart.yamlconfig518 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/_helpers.tplother1.8 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/configmap.yamlconfig392 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/deployment.yamlconfig3.2 KB
curriculum/content/focus/containers/helm-kustomize/exercise/chart/templates/service.yamlconfig512 B
curriculum/content/focus/containers/helm-kustomize/exercise/chart/values.yamlconfig1.4 KB
curriculum/content/focus/containers/helm-kustomize/exercise/check.shscript55.4 KB
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/deployment.yamlconfig2.1 KB
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/kustomization.yamlconfig798 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/base/service.yamlconfig347 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/dev/kustomization.yamlconfig616 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/dev/resources-patch.yamlconfig506 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/prod/kustomization.yamlconfig477 B
curriculum/content/focus/containers/helm-kustomize/exercise/kustomize/overlays/prod/resources-patch.yamlconfig614 B
curriculum/content/focus/containers/helm-kustomize/quiz.jsonconfig7.4 KB
curriculum/content/focus/containers/helm-kustomize/solution/NOTES.mdmarkdown3.3 KB
curriculum/content/focus/containers/helm-kustomize/solution/chart/Chart.yamlconfig366 B
curriculum/content/focus/containers/helm-kustomize/solution/chart/templates/configmap.yamlconfig547 B
curriculum/content/focus/containers/helm-kustomize/solution/chart/templates/deployment.yamlconfig2.5 KB
curriculum/content/focus/containers/helm-kustomize/solution/chart/values.yamlconfig1.2 KB
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/base/kustomization.yamlconfig915 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/dev/kustomization.yamlconfig820 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/dev/resources-patch.yamlconfig515 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/prod/kustomization.yamlconfig267 B
curriculum/content/focus/containers/helm-kustomize/solution/kustomize/overlays/prod/resources-patch.yamlconfig649 B
curriculum/content/focus/containers/kubernetes-config/LESSON.mdmarkdown19.4 KB
curriculum/content/focus/containers/kubernetes-config/TUTOR.mdmarkdown6.3 KB
curriculum/content/focus/containers/kubernetes-config/exercise/NOTES.mdmarkdown1.3 KB
curriculum/content/focus/containers/kubernetes-config/exercise/app/Dockerfileother1.0 KB

curriculum/content/focus/cli-tooling/distribution/exercise/check.sh

View on GitHub
#!/usr/bin/env bash
# Referee for the distribution exercise: builds your tool the way a release
# pipeline would and inspects your goreleaser config. Nothing here touches the
# network or git, and goreleaser itself is optional — checks that need a tool
# you do not have are reported SKIPPED, never FAILED.
# Run from this folder:  bash check.sh
set -u
cd "$(dirname "$0")"

VERSION=1.4.2
COMMIT=9f8e7d6c
DATE=2024-05-01T10:00:00Z
PKG=tutor.local/digest/internal/buildinfo
LDFLAGS="-s -w -X $PKG.version=$VERSION -X $PKG.commit=$COMMIT -X $PKG.date=$DATE"
HELLO_SHA=5891b5b522d5df086d0ff0b110fbd9d21bb4fc7163af34d08286a2e846f6be03

tmp=$(mktemp -d) || exit 1
trap 'rm -rf "$tmp"' EXIT

pass=0
fail=0
skip=0

ok() {
	pass=$((pass + 1))
	printf 'ok    %s\n' "$1"
}

bad() {
	fail=$((fail + 1))
	printf 'FAIL  %s\n      fix: %s\n' "$1" "$2"
}

skipped() {
	skip=$((skip + 1))
	printf 'SKIP  %s\n      %s\n' "$1" "$2"
}

finish() {
	echo
	if [ "$fail" -eq 0 ]; then
		echo "All $pass checks passed ($skip skipped). This tool is shippable."
		exit 0
	fi
	echo "$pass passed, $fail failed, $skip skipped. Fix the FAIL lines above and re-run: bash check.sh"
	exit 1
}

# ---------------------------------------------------------------- toolchain

if ! command -v go >/dev/null 2>&1; then
	bad "go toolchain is installed" \
		"install Go and put it on PATH (S0 dev-environment), then re-run"
	finish
fi
ok "go toolchain is installed"

if [ -z "$(gofmt -l . 2>/dev/null)" ]; then
	ok "gofmt reports nothing to fix"
else
	bad "gofmt reports nothing to fix" \
		"run 'gofmt -l .' to see the files, then 'gofmt -w .'"
fi

if go vet ./... >"$tmp/vet.log" 2>&1; then
	ok "go vet ./... passes"
else
	bad "go vet ./... passes" \
		"run 'go vet ./...' and read the finding: $(head -n 3 "$tmp/vet.log" | tr '\n' ' ')"
fi

# ---------------------------------------------------------------- the binary

if ! go build -o "$tmp/plain" . >"$tmp/build.log" 2>&1; then
	bad "the module builds (go build .)" \
		"read the compiler output: $(head -n 3 "$tmp/build.log" | tr '\n' ' ')"
	finish
fi
ok "the module builds (go build .)"

printf 'hello\n' >"$tmp/hello.txt"
if "$tmp/plain" "$tmp/hello.txt" 2>/dev/null | grep -q "^$HELLO_SHA  "; then
	ok "digest still hashes files correctly"
else
	bad "digest still hashes files correctly" \
		"the tool's own job must keep working — restore main.go's behaviour"
fi

"$tmp/plain" --version >"$tmp/v.out" 2>"$tmp/v.err"
rc=$?
if [ "$rc" -eq 0 ]; then
	ok "digest --version exits 0"
else
	bad "digest --version exits 0" \
		"--version is a successful run, not an error; got exit code $rc"
fi

if [ -s "$tmp/v.out" ] && [ ! -s "$tmp/v.err" ]; then
	ok "digest --version writes to stdout and leaves stderr empty"
else
	bad "digest --version writes to stdout and leaves stderr empty" \
		"version information is data a script may read: stdout only (terminal-ux lesson)"
fi

if head -n 1 "$tmp/v.out" | grep -Eq '^digest[[:space:]]+dev([[:space:]]|$)'; then
	ok "an unstamped build reports the placeholder version 'dev'"
else
	bad "an unstamped build reports the placeholder version 'dev'" \
		"with no -X, String() must print 'digest dev (…)'; '(devel)' from ReadBuildInfo is not a real version. Got: $(head -n 1 "$tmp/v.out")"
fi

# ---------------------------------------------------------------- stamping

if ! go build -trimpath -ldflags "$LDFLAGS" -o "$tmp/rel1" . >"$tmp/rel.log" 2>&1; then
	bad "the tool builds with the documented -ldflags" \
		"go build -trimpath -ldflags \"$LDFLAGS\" -o digest . said: $(head -n 3 "$tmp/rel.log" | tr '\n' ' ')"
	finish
fi
ok "the tool builds with the documented -ldflags"

"$tmp/rel1" --version >"$tmp/rv.out" 2>/dev/null
stamped=$(head -n 1 "$tmp/rv.out")

if printf '%s\n' "$stamped" | grep -Eq "^digest[[:space:]]+v?$VERSION([[:space:]]|$)"; then
	ok "--version reports the injected version ($VERSION), not a placeholder"
else
	bad "--version reports the injected version ($VERSION), not a placeholder" \
		"-X silently does nothing when the symbol path is wrong: it must be $PKG.version, and version must be a package-level string var. Got: $stamped"
fi

if printf '%s\n' "$stamped" | grep -Fq "$COMMIT"; then
	ok "--version reports the injected commit"
else
	bad "--version reports the injected commit" \
		"stamp and print commit the same way as version ($PKG.commit). Got: $stamped"
fi

if printf '%s\n' "$stamped" | grep -Fq "$DATE"; then
	ok "--version reports the injected build date"
else
	bad "--version reports the injected build date" \
		"stamp and print date the same way as version ($PKG.date). Got: $stamped"
fi

if printf '%s\n' "$stamped" | grep -Eq 'go1\.[0-9]+' &&
	printf '%s\n' "$stamped" | grep -Fq "$(go env GOOS)/$(go env GOARCH)"; then
	ok "--version reports the go version and the target platform"
else
	bad "--version reports the go version and the target platform" \
		"runtime.Version(), runtime.GOOS and runtime.GOARCH belong in the line — no linker flag needed. Got: $stamped"
fi

go build -trimpath -ldflags "$LDFLAGS" -o "$tmp/rel2" . >/dev/null 2>&1
if cmp -s "$tmp/rel1" "$tmp/rel2"; then
	ok "the build is reproducible: same inputs, byte-identical binary"
else
	bad "the build is reproducible: same inputs, byte-identical binary" \
		"something varying got baked in — build with -trimpath and never stamp a wall-clock timestamp"
fi

# ---------------------------------------------------------------- cross-compilation

for target in linux/amd64 darwin/arm64 windows/amd64; do
	goos=${target%/*}
	goarch=${target#*/}
	out="$tmp/digest-$goos-$goarch"
	[ "$goos" = windows ] && out="$out.exe"
	if CGO_ENABLED=0 GOOS="$goos" GOARCH="$goarch" go build -trimpath -ldflags "$LDFLAGS" -o "$out" . >"$tmp/x.log" 2>&1; then
		ok "cross-compiles for $target with CGO_ENABLED=0"
	else
		bad "cross-compiles for $target with CGO_ENABLED=0" \
			"pure-Go code needs no cross toolchain: $(head -n 3 "$tmp/x.log" | tr '\n' ' ')"
	fi
done

# ---------------------------------------------------------------- goreleaser config

cfg=""
for candidate in .goreleaser.yaml .goreleaser.yml goreleaser.yaml goreleaser.yml; do
	if [ -f "$candidate" ]; then
		cfg=$candidate
		break
	fi
done

if [ -z "$cfg" ]; then
	bad "a goreleaser config exists (.goreleaser.yaml)" \
		"write .goreleaser.yaml in this folder — the walkthrough in LESSON.md shows every key the checks below want"
	finish
fi
ok "goreleaser config found: $cfg"

facts="$tmp/facts"
: >"$facts"

to_json() {
	if python3 -c 'import yaml' >/dev/null 2>&1; then
		python3 -c 'import json,sys,yaml; json.dump(yaml.safe_load(open(sys.argv[1])), sys.stdout)' \
			"$cfg" >"$tmp/cfg.json" 2>"$tmp/yaml.err" && return 0
		return 1
	fi
	if command -v yq >/dev/null 2>&1; then
		yq -o=json '.' "$cfg" >"$tmp/cfg.json" 2>"$tmp/yaml.err" && return 0
		return 1
	fi
	return 2
}

facts_from_grep() {
	skipped "$cfg parses as YAML" \
		"no YAML parser available here (python3 with PyYAML, or yq) — falling back to text matching, so the key checks below are less precise"
	has() { grep -Eq "$1" "$cfg" && echo "$2=1" || echo "$2=0"; }
	{
		has '^version:[[:space:]]*2[[:space:]]*$' cfgversion2
		has '^builds:' builds
		has 'CGO_ENABLED=0' cgo0
		has '\-trimpath' trimpath
		has 'internal/buildinfo\.version=' xversion
		has 'internal/buildinfo\.commit=' xcommit
		has 'internal/buildinfo\.date=' xdate
		has '\{\{' template
		has '^archives:' archives
		has '^checksum:' checksum
		has '^changelog:' changelog
		has '^(brews|homebrew_casks):' brew
		has 'name:[[:space:]]*homebrew-' tap
	} >"$facts"
	if [ "$(grep -Ec '^[[:space:]]*-[[:space:]]*(linux|darwin|windows|freebsd)[[:space:]]*$' "$cfg")" -ge 2 ] ||
		grep -Eq 'goos:[[:space:]]*\[[^]]*,' "$cfg"; then
		echo "goosmulti=1" >>"$facts"
	else
		echo "goosmulti=0" >>"$facts"
	fi
	if [ "$(grep -Ec '^[[:space:]]*-[[:space:]]*(amd64|arm64|386|arm)[[:space:]]*$' "$cfg")" -ge 2 ] ||
		grep -Eq 'goarch:[[:space:]]*\[[^]]*,' "$cfg"; then
		echo "goarchmulti=1" >>"$facts"
	else
		echo "goarchmulti=0" >>"$facts"
	fi
}

to_json
parse_rc=$?

if [ "$parse_rc" -eq 1 ]; then
	bad "$cfg parses as YAML" \
		"YAML is indentation-sensitive and never accepts tabs: $(tail -n 3 "$tmp/yaml.err" | tr '\n' ' ')"
	finish
fi

if [ "$parse_rc" -eq 0 ]; then
	python3 - "$tmp/cfg.json" >"$facts" 2>/dev/null <<'PY'
import json, sys

cfg = json.load(open(sys.argv[1]))
if not isinstance(cfg, dict):
    cfg = {}


def aslist(v):
    if v is None:
        return []
    if isinstance(v, list):
        return [str(x) for x in v]
    return [str(v)]


builds = [b for b in (cfg.get("builds") or []) if isinstance(b, dict)]
env = " ".join(x for b in builds for x in aslist(b.get("env")))
flags = " ".join(x for b in builds for x in aslist(b.get("flags")))
ld = " ".join(x for b in builds for x in aslist(b.get("ldflags")))
goos = max([len(aslist(b.get("goos"))) for b in builds] or [0])
goarch = max([len(aslist(b.get("goarch"))) for b in builds] or [0])

brews = [b for b in (cfg.get("brews") or cfg.get("homebrew_casks") or []) if isinstance(b, dict)]
tap = 0
for b in brews:
    repo = b.get("repository") or b.get("tap") or {}
    if isinstance(repo, dict) and str(repo.get("name", "")).startswith("homebrew-"):
        tap = 1

facts = {
    "cfgversion2": str(cfg.get("version")) == "2",
    "builds": bool(builds),
    "cgo0": "CGO_ENABLED=0" in env.replace(" ", ""),
    "trimpath": "-trimpath" in flags,
    "xversion": "internal/buildinfo.version=" in ld,
    "xcommit": "internal/buildinfo.commit=" in ld,
    "xdate": "internal/buildinfo.date=" in ld,
    "template": "{{" in ld,
    "goosmulti": goos >= 2,
    "goarchmulti": goarch >= 2,
    "archives": bool(cfg.get("archives")),
    "checksum": bool(cfg.get("checksum")),
    "changelog": "changelog" in cfg,
    "brew": bool(brews),
    "tap": bool(tap),
}
for k, v in facts.items():
    print("%s=%d" % (k, 1 if v else 0))
PY
	if [ -s "$facts" ]; then
		ok "$cfg parses as YAML"
	else
		facts_from_grep
	fi
else
	facts_from_grep
fi

check_fact() {
	if grep -qx "$1=1" "$facts"; then
		ok "$2"
	else
		bad "$2" "$3"
	fi
}

check_fact cfgversion2 "config declares 'version: 2'" \
	"goreleaser v2 refuses a config without a top-level 'version: 2'"
check_fact builds "config has a builds section" \
	"add a builds: list with one entry for this tool"
check_fact cgo0 "the build sets CGO_ENABLED=0" \
	"add env: [CGO_ENABLED=0] to the build — cgo would need a C cross-toolchain per target"
check_fact trimpath "the build passes -trimpath" \
	"add flags: [-trimpath] so absolute paths from your machine stay out of the binary"
check_fact xversion "ldflags stamp the version symbol" \
	"add -X $PKG.version=… to the build's ldflags"
check_fact xcommit "ldflags stamp the commit symbol" \
	"add -X $PKG.commit=… to the build's ldflags"
check_fact xdate "ldflags stamp the date symbol" \
	"add -X $PKG.date=… to the build's ldflags"
check_fact template "ldflags use goreleaser template values" \
	"hard-coded values would be wrong on the next tag — use {{ .Version }}, {{ .FullCommit }}, {{ .CommitDate }}"
check_fact goosmulti "the build targets at least two operating systems" \
	"list goos: linux, darwin, windows"
check_fact goarchmulti "the build targets at least two architectures" \
	"list goarch: amd64, arm64"
check_fact archives "config has an archives section" \
	"users download an archive, not a bare binary — add archives:"
check_fact checksum "config has a checksum section" \
	"add checksum: so the release carries checksums.txt"
check_fact changelog "config has a changelog section" \
	"add changelog: — the release notes come from the commits since the last tag"
check_fact brew "config publishes a Homebrew formula" \
	"add a brews: entry (or homebrew_casks: on newer goreleaser)"
check_fact tap "the Homebrew repository is a tap (name starts with homebrew-)" \
	"brew only recognises taps whose repository is named homebrew-<something>, e.g. homebrew-tap"

if command -v goreleaser >/dev/null 2>&1; then
	if goreleaser check >"$tmp/gr.log" 2>&1; then
		ok "goreleaser check passes"
	else
		bad "goreleaser check passes" \
			"read its output: $(tail -n 5 "$tmp/gr.log" | tr '\n' ' ')"
	fi
else
	skipped "goreleaser check passes" \
		"goreleaser is not installed — install it later and run 'goreleaser check' plus 'goreleaser release --snapshot --clean'"
fi

finish
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 471kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall