deepflow 0.1.65 → 0.1.66
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.
- package/bin/deepflow-auto.sh +103 -44
- package/package.json +1 -1
package/bin/deepflow-auto.sh
CHANGED
|
@@ -1138,70 +1138,129 @@ generate_report() {
|
|
|
1138
1138
|
# Build report
|
|
1139
1139
|
# -----------------------------------------------------------------
|
|
1140
1140
|
{
|
|
1141
|
-
#
|
|
1142
|
-
echo "
|
|
1141
|
+
# Header
|
|
1142
|
+
echo "# deepflow auto report"
|
|
1143
1143
|
echo ""
|
|
1144
|
-
echo "Status
|
|
1144
|
+
echo "**Status:** ${overall_status} "
|
|
1145
|
+
echo "**Date:** $(date -u '+%Y-%m-%d %H:%M UTC')"
|
|
1145
1146
|
echo ""
|
|
1146
1147
|
|
|
1147
|
-
#
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1148
|
+
# Per-spec details
|
|
1149
|
+
for sname in "${all_spec_names[@]}"; do
|
|
1150
|
+
local s="$(_spec_get STATUS "$sname" "unknown")"
|
|
1151
|
+
local w="$(_spec_get WINNER "$sname")"
|
|
1152
|
+
|
|
1153
|
+
echo "---"
|
|
1154
|
+
echo ""
|
|
1155
|
+
echo "## ${sname}"
|
|
1156
|
+
echo ""
|
|
1157
|
+
echo "**Status:** ${s}"
|
|
1158
|
+
if [[ -n "$w" ]]; then
|
|
1159
|
+
echo "**Winner:** ${w}"
|
|
1160
|
+
fi
|
|
1161
|
+
echo ""
|
|
1162
|
+
|
|
1163
|
+
# Hypotheses
|
|
1164
|
+
local hyp_file="${PROJECT_ROOT}/.deepflow/hypotheses/${sname}-cycle-0.json"
|
|
1165
|
+
if [[ -f "$hyp_file" ]]; then
|
|
1166
|
+
echo "### Hypotheses"
|
|
1167
|
+
echo ""
|
|
1168
|
+
# Parse each hypothesis slug + description
|
|
1169
|
+
local slug_list hyp_list
|
|
1170
|
+
slug_list="$(grep -o '"slug"[[:space:]]*:[[:space:]]*"[^"]*"' "$hyp_file" | sed 's/.*"\([^"]*\)".*/\1/')" || slug_list=""
|
|
1171
|
+
hyp_list="$(grep -o '"hypothesis"[[:space:]]*:[[:space:]]*"[^"]*"' "$hyp_file" | sed 's/.*"hypothesis"[[:space:]]*:[[:space:]]*"\([^"]*\)".*/\1/')" || hyp_list=""
|
|
1172
|
+
|
|
1173
|
+
paste <(echo "$slug_list") <(echo "$hyp_list") | while IFS=$'\t' read -r hslug hhyp; do
|
|
1174
|
+
[[ -z "$hslug" ]] && continue
|
|
1175
|
+
echo "- **${hslug}:** ${hhyp}"
|
|
1176
|
+
done
|
|
1177
|
+
echo ""
|
|
1178
|
+
fi
|
|
1179
|
+
|
|
1180
|
+
# Spike results
|
|
1181
|
+
local has_spikes=false
|
|
1182
|
+
for wt_dir in "${PROJECT_ROOT}/.deepflow/worktrees/${sname}-"*; do
|
|
1183
|
+
[[ -d "$wt_dir" ]] || continue
|
|
1184
|
+
local wt_slug
|
|
1185
|
+
wt_slug="$(basename "$wt_dir")"
|
|
1186
|
+
wt_slug="${wt_slug#${sname}-}"
|
|
1187
|
+
|
|
1188
|
+
local spike_yaml="${wt_dir}/.deepflow/results/spike-${wt_slug}.yaml"
|
|
1189
|
+
if [[ -f "$spike_yaml" ]]; then
|
|
1190
|
+
if [[ "$has_spikes" == "false" ]]; then
|
|
1191
|
+
echo "### Spike Results"
|
|
1192
|
+
echo ""
|
|
1193
|
+
has_spikes=true
|
|
1156
1194
|
fi
|
|
1157
|
-
|
|
1195
|
+
local spike_status spike_summary
|
|
1196
|
+
spike_status="$(grep -m1 '^status:' "$spike_yaml" | sed 's/^status:[[:space:]]*//')" || spike_status="unknown"
|
|
1197
|
+
spike_summary="$(grep -m1 '^summary:' "$spike_yaml" | sed 's/^summary:[[:space:]]*//')" || spike_summary=""
|
|
1198
|
+
local status_icon="✅"
|
|
1199
|
+
[[ "$spike_status" =~ fail ]] && status_icon="❌"
|
|
1200
|
+
echo "- ${status_icon} **${wt_slug}** — ${spike_summary}"
|
|
1158
1201
|
fi
|
|
1159
1202
|
done
|
|
1160
|
-
|
|
1161
|
-
|
|
1203
|
+
if [[ "$has_spikes" == "true" ]]; then
|
|
1204
|
+
echo ""
|
|
1205
|
+
fi
|
|
1162
1206
|
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
local w="$(_spec_get WINNER "$sname" "-")"
|
|
1169
|
-
echo "| ${sname} | ${s} | ${w} |"
|
|
1170
|
-
done
|
|
1171
|
-
echo ""
|
|
1207
|
+
# Selection rationale
|
|
1208
|
+
local winner_file="${PROJECT_ROOT}/.deepflow/selection/${sname}-winner.json"
|
|
1209
|
+
if [[ -f "$winner_file" ]]; then
|
|
1210
|
+
echo "### Selection Rationale"
|
|
1211
|
+
echo ""
|
|
1172
1212
|
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1213
|
+
# Parse rankings from winner file
|
|
1214
|
+
local rankings
|
|
1215
|
+
rankings="$(node -e "
|
|
1216
|
+
try {
|
|
1217
|
+
const d = JSON.parse(require('fs').readFileSync('${winner_file}','utf8'));
|
|
1218
|
+
if (d.selection_output && d.selection_output.rankings) {
|
|
1219
|
+
d.selection_output.rankings.forEach(r => {
|
|
1220
|
+
const icon = r.rank === 1 ? '🏆' : ' ';
|
|
1221
|
+
console.log(icon + ' **#' + r.rank + ' ' + r.slug + ':** ' + r.rationale);
|
|
1222
|
+
});
|
|
1223
|
+
}
|
|
1224
|
+
} catch(e) {}
|
|
1225
|
+
" 2>/dev/null)" || rankings=""
|
|
1226
|
+
|
|
1227
|
+
if [[ -n "$rankings" ]]; then
|
|
1228
|
+
echo "$rankings"
|
|
1229
|
+
fi
|
|
1230
|
+
echo ""
|
|
1231
|
+
fi
|
|
1176
1232
|
|
|
1177
|
-
|
|
1178
|
-
for sname in "${all_spec_names[@]}"; do
|
|
1179
|
-
local w="$(_spec_get WINNER "$sname")"
|
|
1233
|
+
# Changes (git diff stat)
|
|
1180
1234
|
if [[ -n "$w" ]]; then
|
|
1181
|
-
has_changes=true
|
|
1182
1235
|
local branch_name="df/${sname}-${w}"
|
|
1183
|
-
echo "###
|
|
1236
|
+
echo "### Changes"
|
|
1184
1237
|
echo ""
|
|
1185
1238
|
echo '```'
|
|
1186
|
-
git diff --stat "main...${branch_name}" 2>/dev/null || echo "(branch ${branch_name} not found)"
|
|
1239
|
+
git -C "$PROJECT_ROOT" diff --stat "main...${branch_name}" 2>/dev/null || echo "(branch ${branch_name} not found)"
|
|
1187
1240
|
echo '```'
|
|
1188
1241
|
echo ""
|
|
1189
1242
|
fi
|
|
1190
1243
|
done
|
|
1191
|
-
if [[ "$has_changes" == "false" ]]; then
|
|
1192
|
-
echo "No changes selected"
|
|
1193
|
-
echo ""
|
|
1194
|
-
fi
|
|
1195
1244
|
|
|
1196
|
-
#
|
|
1197
|
-
echo "
|
|
1245
|
+
# Next steps
|
|
1246
|
+
echo "---"
|
|
1198
1247
|
echo ""
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
if [[
|
|
1202
|
-
|
|
1248
|
+
echo "## Next Steps"
|
|
1249
|
+
echo ""
|
|
1250
|
+
if [[ "$overall_status" == "converged" ]]; then
|
|
1251
|
+
for sname in "${all_spec_names[@]}"; do
|
|
1252
|
+
local w="$(_spec_get WINNER "$sname")"
|
|
1253
|
+
if [[ -n "$w" ]]; then
|
|
1254
|
+
echo "To merge the winner:"
|
|
1255
|
+
echo '```bash'
|
|
1256
|
+
echo "git merge df/${sname}-${w}"
|
|
1257
|
+
echo '```'
|
|
1258
|
+
fi
|
|
1259
|
+
done
|
|
1260
|
+
elif [[ "$overall_status" == "in-progress" ]]; then
|
|
1261
|
+
echo "Run \`deepflow auto --continue\` to resume."
|
|
1203
1262
|
else
|
|
1204
|
-
echo "
|
|
1263
|
+
echo "Review the spec and run \`deepflow auto\` again."
|
|
1205
1264
|
fi
|
|
1206
1265
|
echo ""
|
|
1207
1266
|
} > "$report_file"
|