claude-evolve 1.3.28 → 1.3.29
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/lib/csv_helper.py +91 -0
- package/package.json +1 -1
package/lib/csv_helper.py
CHANGED
|
@@ -150,6 +150,97 @@ def main():
|
|
|
150
150
|
print(f"Error: {e}", file=sys.stderr)
|
|
151
151
|
sys.exit(1)
|
|
152
152
|
|
|
153
|
+
elif operation == "find_pending":
|
|
154
|
+
# Args: csv_file
|
|
155
|
+
if len(sys.argv) != 3:
|
|
156
|
+
print("Usage: csv_helper.py find_pending <csv_file>", file=sys.stderr)
|
|
157
|
+
sys.exit(1)
|
|
158
|
+
|
|
159
|
+
csv_file = sys.argv[2]
|
|
160
|
+
|
|
161
|
+
try:
|
|
162
|
+
headers, rows = read_csv(csv_file)
|
|
163
|
+
|
|
164
|
+
# Find first row with empty status or status == "pending"
|
|
165
|
+
for i, row in enumerate(rows, start=2): # Start at 2 (1-indexed, skip header)
|
|
166
|
+
if len(row) < 5 or row[4] == '' or row[4] == 'pending':
|
|
167
|
+
print(i)
|
|
168
|
+
sys.exit(0)
|
|
169
|
+
|
|
170
|
+
# No pending found
|
|
171
|
+
sys.exit(1)
|
|
172
|
+
|
|
173
|
+
except Exception as e:
|
|
174
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
175
|
+
sys.exit(1)
|
|
176
|
+
|
|
177
|
+
elif operation == "get_row":
|
|
178
|
+
# Args: csv_file, row_num
|
|
179
|
+
if len(sys.argv) != 4:
|
|
180
|
+
print("Usage: csv_helper.py get_row <csv_file> <row_num>", file=sys.stderr)
|
|
181
|
+
sys.exit(1)
|
|
182
|
+
|
|
183
|
+
csv_file = sys.argv[2]
|
|
184
|
+
row_num = int(sys.argv[3])
|
|
185
|
+
|
|
186
|
+
try:
|
|
187
|
+
headers, rows = read_csv(csv_file)
|
|
188
|
+
|
|
189
|
+
# Get the specific row (row_num is 1-indexed, includes header)
|
|
190
|
+
if row_num < 2 or row_num > len(rows) + 1:
|
|
191
|
+
print(f"Row {row_num} out of range", file=sys.stderr)
|
|
192
|
+
sys.exit(1)
|
|
193
|
+
|
|
194
|
+
row = rows[row_num - 2] # Convert to 0-indexed, skip header
|
|
195
|
+
|
|
196
|
+
# Output shell variable assignments
|
|
197
|
+
print(f'id="{row[0] if len(row) > 0 else ""}"')
|
|
198
|
+
print(f'based_on_id="{row[1] if len(row) > 1 else ""}"')
|
|
199
|
+
print(f'description="{row[2] if len(row) > 2 else ""}"')
|
|
200
|
+
print(f'performance="{row[3] if len(row) > 3 else ""}"')
|
|
201
|
+
print(f'status="{row[4] if len(row) > 4 else ""}"')
|
|
202
|
+
|
|
203
|
+
except Exception as e:
|
|
204
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
205
|
+
sys.exit(1)
|
|
206
|
+
|
|
207
|
+
elif operation == "update_row":
|
|
208
|
+
# Args: csv_file, row_num, performance, status
|
|
209
|
+
if len(sys.argv) != 6:
|
|
210
|
+
print("Usage: csv_helper.py update_row <csv_file> <row_num> <performance> <status>", file=sys.stderr)
|
|
211
|
+
sys.exit(1)
|
|
212
|
+
|
|
213
|
+
csv_file = sys.argv[2]
|
|
214
|
+
row_num = int(sys.argv[3])
|
|
215
|
+
performance = sys.argv[4]
|
|
216
|
+
status = sys.argv[5]
|
|
217
|
+
|
|
218
|
+
try:
|
|
219
|
+
headers, rows = read_csv(csv_file)
|
|
220
|
+
|
|
221
|
+
# Update the specific row
|
|
222
|
+
if row_num < 2 or row_num > len(rows) + 1:
|
|
223
|
+
print(f"Row {row_num} out of range", file=sys.stderr)
|
|
224
|
+
sys.exit(1)
|
|
225
|
+
|
|
226
|
+
row_idx = row_num - 2 # Convert to 0-indexed, skip header
|
|
227
|
+
|
|
228
|
+
# Ensure row has enough columns
|
|
229
|
+
while len(rows[row_idx]) < 5:
|
|
230
|
+
rows[row_idx].append('')
|
|
231
|
+
|
|
232
|
+
# Update performance and status
|
|
233
|
+
rows[row_idx][3] = performance
|
|
234
|
+
rows[row_idx][4] = status
|
|
235
|
+
|
|
236
|
+
# Write back
|
|
237
|
+
write_csv(csv_file + '.tmp', headers, rows)
|
|
238
|
+
os.rename(csv_file + '.tmp', csv_file)
|
|
239
|
+
|
|
240
|
+
except Exception as e:
|
|
241
|
+
print(f"Error: {e}", file=sys.stderr)
|
|
242
|
+
sys.exit(1)
|
|
243
|
+
|
|
153
244
|
else:
|
|
154
245
|
print(f"Unknown operation: {operation}", file=sys.stderr)
|
|
155
246
|
sys.exit(1)
|