biotonomy 0.2.3 → 0.2.4

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.
Files changed (2) hide show
  1. package/commands/loop.sh +46 -2
  2. package/package.json +1 -1
package/commands/loop.sh CHANGED
@@ -104,10 +104,53 @@ bt_cmd_loop() {
104
104
  review_file="$feat_dir/REVIEW.md"
105
105
  local history_dir="$feat_dir/history"
106
106
  local progress_file="$feat_dir/loop-progress.json"
107
+ local resume_iter=0
108
+ local should_resume=0
107
109
 
108
- # Initialize progress
109
110
  mkdir -p "$history_dir"
110
- cat > "$progress_file" <<EOF
111
+ if [[ -f "$progress_file" ]]; then
112
+ local resume_meta
113
+ resume_meta="$(python3 - <<PY
114
+ import json
115
+ p = "$progress_file"
116
+ max_iter = $max_iter
117
+ try:
118
+ with open(p, "r", encoding="utf-8") as f:
119
+ d = json.load(f)
120
+ except Exception:
121
+ print("0 0")
122
+ raise SystemExit(0)
123
+ result = str(d.get("result", ""))
124
+ completed = d.get("completedIterations", 0)
125
+ try:
126
+ completed = int(completed)
127
+ except Exception:
128
+ completed = 0
129
+ if result in {"in-progress", "implement-failed"} and completed < max_iter:
130
+ d["feature"] = "$feature"
131
+ d["maxIterations"] = max_iter
132
+ d["completedIterations"] = completed
133
+ d["result"] = "in-progress"
134
+ if not isinstance(d.get("iterations"), list):
135
+ d["iterations"] = []
136
+ with open(p, "w", encoding="utf-8") as f:
137
+ json.dump(d, f, indent=2)
138
+ print(f"1 {completed}")
139
+ else:
140
+ print("0 0")
141
+ PY
142
+ )"
143
+ if [[ "$resume_meta" =~ ^1[[:space:]]+([0-9]+)$ ]]; then
144
+ should_resume=1
145
+ resume_iter="${BASH_REMATCH[1]}"
146
+ fi
147
+ fi
148
+
149
+ if [[ "$should_resume" == "1" ]]; then
150
+ iter="$resume_iter"
151
+ bt_info "resuming loop from iteration $((iter + 1)) / $max_iter"
152
+ else
153
+ cat > "$progress_file" <<EOF
111
154
  {
112
155
  "feature": "$feature",
113
156
  "maxIterations": $max_iter,
@@ -116,6 +159,7 @@ bt_cmd_loop() {
116
159
  "iterations": []
117
160
  }
118
161
  EOF
162
+ fi
119
163
 
120
164
  # Ensure subcommands return non-zero instead of exiting the entire loop process.
121
165
  export BT_DIE_MODE="return"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "biotonomy",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "description": "Codex-native autonomous development loop CLI",
5
5
  "license": "MIT",
6
6
  "repository": {