Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb15c619cd | |||
| c643aaab87 |
@@ -0,0 +1,33 @@
|
||||
# Task 06G4A4F0TFXKZHJE48N05XN1HG
|
||||
|
||||
add a worktree report script to test-e2e
|
||||
|
||||
- Project: test-e2e
|
||||
- Source: gitea:test-e2e/5
|
||||
- Priority: 0
|
||||
|
||||
## Instructions
|
||||
|
||||
add `scripts/orchestra_worktree_report.sh`.
|
||||
|
||||
the script reports on the local Orchestra worktree layout. by default it prints a short human-readable summary. it also takes an optional `--json` flag for machine-readable output reporting the same checks.
|
||||
|
||||
keep it a plain bash script with no dependencies beyond coreutils, matching `scripts/orchestra_e2e_healthcheck.sh`.
|
||||
|
||||
## Acceptance criteria
|
||||
|
||||
- `--help` prints usage and exits 0
|
||||
- running with no arguments prints a human-readable summary and exits 0
|
||||
- `--json` exits 0 and prints one valid json object
|
||||
- the output reports whether `/tmp/test-e2e-worktrees` exists
|
||||
- the output reports how many entries `/tmp/test-e2e-worktrees` contains
|
||||
- the output reports whether `/tmp/test-e2e` is a git repository
|
||||
- unknown arguments exit non-zero with a message on stderr
|
||||
- `scripts/orchestra_e2e_healthcheck.sh` is unchanged
|
||||
|
||||
## Completion
|
||||
|
||||
Run the configured quality gate. When the task is ready for the worker to verify and deliver, create `.orchestra/done`. Do not write a prose completion report.
|
||||
|
||||
This file is immutable for the lifetime of the task (§6.2) — its hash is
|
||||
carried in every handoff and re-verified on every pickup. Do not edit it.
|
||||
Executable
+53
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
WORKTREES=/tmp/test-e2e-worktrees
|
||||
REPO=/tmp/test-e2e
|
||||
|
||||
main() {
|
||||
json=0
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--help)
|
||||
printf 'Usage: %s [--json]\n\n' "${0##*/}"
|
||||
printf 'Reports on the local Orchestra worktree layout.\n'
|
||||
printf 'Prints a human-readable summary by default, or one JSON object with --json.\n'
|
||||
exit 0
|
||||
;;
|
||||
--json)
|
||||
json=1
|
||||
;;
|
||||
*)
|
||||
printf 'unknown argument: %s\n' "$arg" >&2
|
||||
exit 2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -d "$WORKTREES" ]; then
|
||||
exists=true
|
||||
count=$(ls -A "$WORKTREES" 2>/dev/null | wc -l)
|
||||
else
|
||||
exists=false
|
||||
count=0
|
||||
fi
|
||||
|
||||
if [ -d "$REPO/.git" ]; then
|
||||
is_git=true
|
||||
else
|
||||
is_git=false
|
||||
fi
|
||||
|
||||
if [ "$json" = 1 ]; then
|
||||
printf '{"worktrees_dir":"%s","worktrees_dir_exists":%s,"worktrees_entries":%s,"repo":"%s","repo_is_git":%s}\n' \
|
||||
"$WORKTREES" "$exists" "$count" "$REPO" "$is_git"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
printf '%s exists: %s\n' "$WORKTREES" "$exists"
|
||||
printf '%s entries: %s\n' "$WORKTREES" "$count"
|
||||
printf '%s is a git repository: %s\n' "$REPO" "$is_git"
|
||||
exit 0
|
||||
}
|
||||
|
||||
main "$@"
|
||||
Executable
+31
@@ -0,0 +1,31 @@
|
||||
#!/usr/bin/env bash
|
||||
# ponytail: one assert-based check, no framework.
|
||||
|
||||
S=$(dirname "$0")/orchestra_worktree_report.sh
|
||||
|
||||
fail() { printf 'FAIL: %s\n' "$1" >&2; exit 1; }
|
||||
|
||||
out=$(bash "$S" --help) || fail '--help exited non-zero'
|
||||
case "$out" in *Usage:*) ;; *) fail '--help printed no usage' ;; esac
|
||||
|
||||
out=$(bash "$S") || fail 'no-args exited non-zero'
|
||||
case "$out" in *"/tmp/test-e2e-worktrees"*) ;; *) fail 'summary missing worktrees path' ;; esac
|
||||
case "$out" in *"/tmp/test-e2e is a git repository"*) ;; *) fail 'summary missing repo check' ;; esac
|
||||
|
||||
out=$(bash "$S" --json) || fail '--json exited non-zero'
|
||||
[ "$(printf '%s\n' "$out" | wc -l)" = 1 ] || fail '--json printed more than one line'
|
||||
case "$out" in '{'*'}') ;; *) fail '--json is not one object' ;; esac
|
||||
for k in worktrees_dir_exists worktrees_entries repo_is_git; do
|
||||
case "$out" in *"\"$k\":"*) ;; *) fail "--json missing key $k" ;; esac
|
||||
done
|
||||
n=${out#*\"worktrees_entries\":}
|
||||
n=${n%%,*}
|
||||
case "$n" in ''|*[!0-9]*) fail 'worktrees_entries is not digits' ;; esac
|
||||
|
||||
err=$(bash "$S" --bogus 2>&1 >/dev/null)
|
||||
[ $? -ne 0 ] || fail '--bogus exited 0'
|
||||
case "$err" in *"unknown argument"*) ;; *) fail '--bogus printed no stderr message' ;; esac
|
||||
[ -z "$(bash "$S" --bogus 2>/dev/null)" ] || fail '--bogus wrote to stdout'
|
||||
|
||||
printf 'OK\n'
|
||||
exit 0
|
||||
Reference in New Issue
Block a user