executant 1.4.4 → 1.4.5

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/dist/index.js +15 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1295,6 +1295,13 @@ async function runPass3Judge(description, workflow2) {
1295
1295
  function isNumericSequence(arr) {
1296
1296
  return arr.every((item, i) => item === String(i + 1));
1297
1297
  }
1298
+ function isLabeledSequence(arr) {
1299
+ if (arr.length < 2) return null;
1300
+ const m = arr[0].match(/^(.+\s)(\d+)$/);
1301
+ if (!m) return null;
1302
+ const prefix = m[1];
1303
+ return arr.every((item, i) => item === `${prefix}${i + 1}`) ? arr.length : null;
1304
+ }
1298
1305
  function parseSeqCommand(cmd) {
1299
1306
  const t = cmd.trim();
1300
1307
  const shorthand = t.match(/^seq\s+(\d+)$/);
@@ -1309,9 +1316,14 @@ function extractCountFromName(name) {
1309
1316
  }
1310
1317
  function normalizeWorkflow(workflow2) {
1311
1318
  const steps = workflow2.steps.map((step) => {
1312
- if (Array.isArray(step.forEach) && isNumericSequence(step.forEach)) {
1313
- const { forEach, ...rest } = step;
1314
- return { ...rest, repeat: forEach.length };
1319
+ if (Array.isArray(step.forEach)) {
1320
+ const arr = step.forEach;
1321
+ const isNumeric = isNumericSequence(arr);
1322
+ const labeledN = !isNumeric ? isLabeledSequence(arr) : null;
1323
+ if (isNumeric || labeledN !== null) {
1324
+ const { forEach, ...rest } = step;
1325
+ return { ...rest, repeat: isNumeric ? arr.length : labeledN };
1326
+ }
1315
1327
  }
1316
1328
  if (typeof step.forEach === "string") {
1317
1329
  const n = parseSeqCommand(step.forEach);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "executant",
3
- "version": "1.4.4",
3
+ "version": "1.4.5",
4
4
  "description": "Harness for YAML-defined workflows that enables stepping through Claude sessions and bash commands",
5
5
  "repository": {
6
6
  "type": "git",