@jonit-dev/night-watch-cli 1.7.88 → 1.7.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -165,7 +165,7 @@ for AUDIT_ATTEMPT in $(seq 1 "${AUDIT_MAX_RETRIES}"); do
|
|
|
165
165
|
log "AUDIT: Attempt ${AUDIT_ATTEMPT}/${AUDIT_MAX_RETRIES} starting provider=${PROVIDER_CMD} timeout=${MAX_RUNTIME}s"
|
|
166
166
|
|
|
167
167
|
# Build provider command array using generic helper
|
|
168
|
-
mapfile -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${AUDIT_WORKTREE_DIR}" "${AUDIT_PROMPT}")
|
|
168
|
+
mapfile -d '' -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${AUDIT_WORKTREE_DIR}" "${AUDIT_PROMPT}")
|
|
169
169
|
|
|
170
170
|
# Execute — always cd into worktree so provider tools resolve project files correctly
|
|
171
171
|
if (cd "${AUDIT_WORKTREE_DIR}" && timeout "${MAX_RUNTIME}" "${PROVIDER_CMD_PARTS[@]}" 2>&1 | tee -a "${LOG_FILE}"); then
|
|
@@ -542,7 +542,7 @@ while [ "${ATTEMPT}" -lt "${MAX_RETRIES}" ]; do
|
|
|
542
542
|
LOG_LINE_BEFORE=$(wc -l < "${LOG_FILE}" 2>/dev/null || echo 0)
|
|
543
543
|
|
|
544
544
|
# Build provider command array using generic helper
|
|
545
|
-
mapfile -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${WORKTREE_DIR}" "${PROMPT}")
|
|
545
|
+
mapfile -d '' -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${WORKTREE_DIR}" "${PROMPT}")
|
|
546
546
|
|
|
547
547
|
# Execute — always cd into worktree so provider tools resolve project files correctly
|
|
548
548
|
if (cd "${WORKTREE_DIR}" && timeout "${SESSION_MAX_RUNTIME}" "${PROVIDER_CMD_PARTS[@]}" 2>&1 | tee -a "${LOG_FILE}"); then
|
|
@@ -90,8 +90,9 @@ validate_provider() {
|
|
|
90
90
|
# ── Generic Provider Command Builder ──────────────────────────────────────────
|
|
91
91
|
|
|
92
92
|
# Build a provider command from NW_PROVIDER_* environment variables.
|
|
93
|
-
# Outputs one argument
|
|
94
|
-
# This
|
|
93
|
+
# Outputs one NUL-delimited argument so callers can capture it as an array via
|
|
94
|
+
# `mapfile -d ''`. This preserves multiline prompt arguments verbatim instead of
|
|
95
|
+
# splitting them into multiple argv entries.
|
|
95
96
|
#
|
|
96
97
|
# Required env vars:
|
|
97
98
|
# NW_PROVIDER_CMD - CLI binary (e.g., "claude", "codex")
|
|
@@ -105,44 +106,44 @@ validate_provider() {
|
|
|
105
106
|
# NW_PROVIDER_MODEL - Model value (e.g., "claude-opus-4-6")
|
|
106
107
|
#
|
|
107
108
|
# Usage:
|
|
108
|
-
# mapfile -t CMD_PARTS < <(build_provider_cmd "/path/to/worktree" "Your prompt here")
|
|
109
|
+
# mapfile -d '' -t CMD_PARTS < <(build_provider_cmd "/path/to/worktree" "Your prompt here")
|
|
109
110
|
# "${CMD_PARTS[@]}"
|
|
110
111
|
#
|
|
111
|
-
# Returns: One argument per
|
|
112
|
+
# Returns: One NUL-delimited argument per entry (safe for mapfile -d '' array capture)
|
|
112
113
|
build_provider_cmd() {
|
|
113
114
|
local workdir="${1:?workdir required}"
|
|
114
115
|
local prompt="${2:?prompt required}"
|
|
115
116
|
|
|
116
117
|
# Binary
|
|
117
|
-
printf '%s\
|
|
118
|
+
printf '%s\0' "${NW_PROVIDER_CMD}"
|
|
118
119
|
|
|
119
120
|
# Optional subcommand (e.g., "exec" for codex)
|
|
120
121
|
if [ -n "${NW_PROVIDER_SUBCOMMAND:-}" ]; then
|
|
121
|
-
printf '%s\
|
|
122
|
+
printf '%s\0' "${NW_PROVIDER_SUBCOMMAND}"
|
|
122
123
|
fi
|
|
123
124
|
|
|
124
125
|
# Working directory flag (if provider supports it)
|
|
125
126
|
if [ -n "${NW_PROVIDER_WORKDIR_FLAG:-}" ]; then
|
|
126
|
-
printf '%s\
|
|
127
|
-
printf '%s\
|
|
127
|
+
printf '%s\0' "${NW_PROVIDER_WORKDIR_FLAG}"
|
|
128
|
+
printf '%s\0' "${workdir}"
|
|
128
129
|
fi
|
|
129
130
|
|
|
130
131
|
# Auto-approve flag
|
|
131
132
|
if [ -n "${NW_PROVIDER_APPROVE_FLAG:-}" ]; then
|
|
132
|
-
printf '%s\
|
|
133
|
+
printf '%s\0' "${NW_PROVIDER_APPROVE_FLAG}"
|
|
133
134
|
fi
|
|
134
135
|
|
|
135
136
|
# Model selection (only if both flag and value are set)
|
|
136
137
|
if [ -n "${NW_PROVIDER_MODEL_FLAG:-}" ] && [ -n "${NW_PROVIDER_MODEL:-}" ]; then
|
|
137
|
-
printf '%s\
|
|
138
|
-
printf '%s\
|
|
138
|
+
printf '%s\0' "${NW_PROVIDER_MODEL_FLAG}"
|
|
139
|
+
printf '%s\0' "${NW_PROVIDER_MODEL}"
|
|
139
140
|
fi
|
|
140
141
|
|
|
141
142
|
# Prompt - either with flag or positional
|
|
142
143
|
if [ -n "${NW_PROVIDER_PROMPT_FLAG:-}" ]; then
|
|
143
|
-
printf '%s\
|
|
144
|
+
printf '%s\0' "${NW_PROVIDER_PROMPT_FLAG}"
|
|
144
145
|
fi
|
|
145
|
-
printf '%s\
|
|
146
|
+
printf '%s\0' "${prompt}"
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
# Check if the provider uses a working directory flag (vs requiring cd).
|
|
@@ -1076,7 +1076,7 @@ for ATTEMPT in $(seq 1 "${TOTAL_ATTEMPTS}"); do
|
|
|
1076
1076
|
REVIEWER_PROMPT="${REVIEWER_PROMPT_BASE}${TARGET_SCOPE_PROMPT}${PRD_CONTEXT_PROMPT}"
|
|
1077
1077
|
|
|
1078
1078
|
# Build provider command array using generic helper
|
|
1079
|
-
mapfile -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${REVIEW_WORKTREE_DIR}" "${REVIEWER_PROMPT}")
|
|
1079
|
+
mapfile -d '' -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${REVIEW_WORKTREE_DIR}" "${REVIEWER_PROMPT}")
|
|
1080
1080
|
|
|
1081
1081
|
# Execute — always cd into worktree so provider tools resolve project files correctly
|
|
1082
1082
|
if (cd "${REVIEW_WORKTREE_DIR}" && timeout "${ATTEMPT_TIMEOUT}" "${PROVIDER_CMD_PARTS[@]}" 2>&1 | tee -a "${LOG_FILE}"); then
|
|
@@ -593,7 +593,7 @@ Action: generating QA tests and evidence."
|
|
|
593
593
|
PROVIDER_OK=0
|
|
594
594
|
|
|
595
595
|
# Build provider command array using generic helper
|
|
596
|
-
mapfile -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${QA_WORKTREE_DIR}" "${QA_PROMPT}")
|
|
596
|
+
mapfile -d '' -t PROVIDER_CMD_PARTS < <(build_provider_cmd "${QA_WORKTREE_DIR}" "${QA_PROMPT}")
|
|
597
597
|
|
|
598
598
|
# Execute — always cd into worktree so provider tools resolve project files correctly
|
|
599
599
|
if (cd "${QA_WORKTREE_DIR}" && timeout "${MAX_RUNTIME}" "${PROVIDER_CMD_PARTS[@]}" 2>&1 | tee -a "${LOG_FILE}"); then
|