kiro-spec-engine 1.47.9 → 1.47.10

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.
@@ -4062,6 +4062,46 @@ function resolvePerGoalMaxParallel(requestedGoalMaxParallel, agentBudget, effect
4062
4062
  return Math.max(1, Math.min(requestedGoalMaxParallel, budgetBased));
4063
4063
  }
4064
4064
 
4065
+ function parseSpecPrefixFromId(specId) {
4066
+ const match = `${specId || ''}`.match(/^(\d+)-\d{2}-/);
4067
+ if (!match) {
4068
+ return null;
4069
+ }
4070
+ const parsed = Number(match[1]);
4071
+ return Number.isInteger(parsed) && parsed > 0 ? parsed : null;
4072
+ }
4073
+
4074
+ async function resolveNextBatchGoalPrefix(projectPath) {
4075
+ const specs = await readSpecSessionEntries(projectPath);
4076
+ let maxPrefix = 0;
4077
+ for (const spec of specs) {
4078
+ const parsed = parseSpecPrefixFromId(spec && spec.id);
4079
+ if (parsed !== null && parsed > maxPrefix) {
4080
+ maxPrefix = parsed;
4081
+ }
4082
+ }
4083
+ return maxPrefix + 1;
4084
+ }
4085
+
4086
+ async function allocateBatchGoalPrefixes(projectPath, goalCount, prefixCandidate) {
4087
+ if (!Number.isInteger(goalCount) || goalCount <= 0) {
4088
+ return [];
4089
+ }
4090
+
4091
+ let startPrefix;
4092
+ if (prefixCandidate !== undefined && prefixCandidate !== null) {
4093
+ const parsed = Number(prefixCandidate);
4094
+ if (!Number.isInteger(parsed) || parsed < 1) {
4095
+ throw new Error('--prefix must be a positive integer');
4096
+ }
4097
+ startPrefix = parsed;
4098
+ } else {
4099
+ startPrefix = await resolveNextBatchGoalPrefix(projectPath);
4100
+ }
4101
+
4102
+ return Array.from({ length: goalCount }, (_item, index) => startPrefix + index);
4103
+ }
4104
+
4065
4105
  function buildBatchResourcePlan(context) {
4066
4106
  const weights = context.goalPlans.map(plan => plan.scheduling_weight);
4067
4107
  const complexityWeights = context.goalPlans.map(plan => plan.complexity_weight);
@@ -4220,6 +4260,9 @@ async function runCloseLoopBatchGoals(goals, options) {
4220
4260
  const batchAttempt = Number.isInteger(options.batchAttempt) && options.batchAttempt > 0
4221
4261
  ? options.batchAttempt
4222
4262
  : 1;
4263
+ const projectPath = typeof options.projectPath === 'string' && options.projectPath.trim()
4264
+ ? options.projectPath
4265
+ : process.cwd();
4223
4266
  const requestedGoalMaxParallel = resolveRequestedGoalMaxParallel(runOptions);
4224
4267
  const slotBudget = agentBudget === null ? Number.POSITIVE_INFINITY : agentBudget;
4225
4268
  const goalPlans = buildGoalExecutionPlans(
@@ -4235,10 +4278,18 @@ async function runCloseLoopBatchGoals(goals, options) {
4235
4278
  if (perGoalMaxParallel !== null) {
4236
4279
  effectiveRunOptions.maxParallel = perGoalMaxParallel;
4237
4280
  }
4281
+ const allocatedPrefixes = await allocateBatchGoalPrefixes(
4282
+ projectPath,
4283
+ goalPlans.length,
4284
+ effectiveRunOptions.prefix
4285
+ );
4238
4286
  const goalPlansByIndex = goalPlans.map(plan => ({
4239
4287
  ...plan,
4240
4288
  attempt: batchAttempt,
4241
- run_options: { ...effectiveRunOptions }
4289
+ run_options: {
4290
+ ...effectiveRunOptions,
4291
+ prefix: allocatedPrefixes[plan.index]
4292
+ }
4242
4293
  }));
4243
4294
  const resourcePlan = buildBatchResourcePlan({
4244
4295
  goalPlans: goalPlansByIndex,
@@ -4687,6 +4738,7 @@ async function executeCloseLoopBatch(goalsResult, options, projectPath, mode = '
4687
4738
  const effectiveBatchOptions = batchAutonomousPolicy.options;
4688
4739
  const batchParallel = normalizeBatchParallel(effectiveBatchOptions.batchParallel);
4689
4740
  const batchRun = await runCloseLoopBatchWithRetries(goalsResult.goals, {
4741
+ projectPath,
4690
4742
  continueOnError: Boolean(effectiveBatchOptions.continueOnError),
4691
4743
  batchParallel,
4692
4744
  batchAgentBudget: effectiveBatchOptions.batchAgentBudget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-spec-engine",
3
- "version": "1.47.9",
3
+ "version": "1.47.10",
4
4
  "description": "kiro-spec-engine (kse) - A CLI tool and npm package for spec-driven development with AI coding assistants. NOT the Kiro IDE desktop application.",
5
5
  "main": "index.js",
6
6
  "bin": {