- Reset master to upstream/main (16,697 commits) - Overlay 2,271 local-only files (skills, tools, workspace, configs, apps) - Restore IDENTITY.md and USER.md templates - Build verified, gateway running, Discord working Co-Authored-By: Claude Opus 4.6 <[email protected]>
43 lines
1.1 KiB
Bash
43 lines
1.1 KiB
Bash
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
PROMPT=${1:-}
|
|
shift || true
|
|
|
|
if [[ -z "${PROMPT}" ]]; then
|
|
echo "Usage: copilot_prompt.sh \"<prompt>\" [--model <model>] [--add-dir <dir>]" >&2
|
|
exit 2
|
|
fi
|
|
|
|
MODEL="claude-sonnet-4.5"
|
|
ADD_DIR="$(pwd)"
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case "$1" in
|
|
--model)
|
|
MODEL="$2"; shift 2 ;;
|
|
--add-dir)
|
|
ADD_DIR="$2"; shift 2 ;;
|
|
*)
|
|
echo "Unknown arg: $1" >&2
|
|
exit 2 ;;
|
|
esac
|
|
done
|
|
|
|
ARGS=(-- --model "$MODEL" -p "$PROMPT" -s --no-color --stream off --no-ask-user --allow-all-tools --add-dir "$ADD_DIR")
|
|
|
|
# Run Copilot CLI, but keep output deterministic for scripting.
|
|
# Default behavior can include extra wrapper text; filter if requested.
|
|
if [[ "${STRICT_OUTPUT:-0}" == "1" ]]; then
|
|
# If EXPECT is set, extract and print it if present.
|
|
# Otherwise, print the first ALLCAPS token-like word.
|
|
OUT=$(gh copilot "${ARGS[@]}" || true)
|
|
if [[ -n "${EXPECT:-}" ]]; then
|
|
echo "$OUT" | grep -o -- "$EXPECT" | head -n 1 || true
|
|
else
|
|
echo "$OUT" | grep -Eo '[A-Z0-9_]{3,}' | head -n 1 || true
|
|
fi
|
|
else
|
|
exec gh copilot "${ARGS[@]}"
|
|
fi
|