lee-spec-kit 0.6.29 → 0.6.30
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/dist/index.js +74 -9
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/templates/en/common/agents/agents.md +2 -0
- package/templates/en/common/agents/skills/execute-task.md +2 -0
- package/templates/ko/common/agents/agents.md +2 -0
- package/templates/ko/common/agents/skills/execute-task.md +2 -0
package/dist/index.js
CHANGED
|
@@ -7243,17 +7243,38 @@ var LONG_RUNNING_DELEGATION_CATEGORIES = [
|
|
|
7243
7243
|
"review_fix_commit",
|
|
7244
7244
|
"pre_pr_review"
|
|
7245
7245
|
];
|
|
7246
|
+
function isTaskExecuteProjectCommitCommand(option) {
|
|
7247
|
+
if (!option || option.action.type !== "command") return false;
|
|
7248
|
+
if (option.action.category !== "task_execute") return false;
|
|
7249
|
+
if (option.action.scope !== "project") return false;
|
|
7250
|
+
return /\bgit\s+commit\b/i.test(option.action.cmd);
|
|
7251
|
+
}
|
|
7246
7252
|
function shouldDelegateCurrentAction(actionOptions) {
|
|
7247
|
-
const
|
|
7253
|
+
const primaryOption = actionOptions[0];
|
|
7254
|
+
const primaryCategory = primaryOption?.action?.category || null;
|
|
7248
7255
|
const longRunningSet = new Set(LONG_RUNNING_DELEGATION_CATEGORIES);
|
|
7249
|
-
const shouldDelegate = !!primaryCategory && longRunningSet.has(primaryCategory);
|
|
7256
|
+
const shouldDelegate = !!primaryCategory && longRunningSet.has(primaryCategory) && !isTaskExecuteProjectCommitCommand(primaryOption);
|
|
7250
7257
|
return {
|
|
7251
7258
|
shouldDelegate,
|
|
7252
7259
|
category: primaryCategory
|
|
7253
7260
|
};
|
|
7254
7261
|
}
|
|
7255
|
-
function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable) {
|
|
7262
|
+
function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable, autoRunCommand, featureRef) {
|
|
7256
7263
|
const delegation = shouldDelegateCurrentAction(actionOptions);
|
|
7264
|
+
const primaryOption = actionOptions[0];
|
|
7265
|
+
const delegatedCommandOption = primaryOption && primaryOption.action.type === "command" && delegation.shouldDelegate ? primaryOption : null;
|
|
7266
|
+
const handoffMode = delegatedCommandOption ? "command" : autoRunAvailable ? "auto_run" : null;
|
|
7267
|
+
const handoffCwd = delegatedCommandOption?.action.cwd || (autoRunAvailable ? process.cwd() : null);
|
|
7268
|
+
const handoffCmd = delegatedCommandOption?.action.cmd || (autoRunAvailable ? autoRunCommand : null);
|
|
7269
|
+
const handoffRequired = !!handoffMode && !!handoffCwd && !!handoffCmd;
|
|
7270
|
+
const verifyCacheKey = handoffRequired ? createHash("sha1").update(
|
|
7271
|
+
[
|
|
7272
|
+
handoffMode,
|
|
7273
|
+
featureRef || "",
|
|
7274
|
+
handoffCwd || "",
|
|
7275
|
+
handoffCmd || ""
|
|
7276
|
+
].join("|")
|
|
7277
|
+
).digest("hex").slice(0, 12) : "";
|
|
7257
7278
|
return {
|
|
7258
7279
|
mode: "main_orchestrates_subagent_execution",
|
|
7259
7280
|
delegationPolicy: "prefer_main_delegate_long_running_fallback_main",
|
|
@@ -7285,7 +7306,23 @@ function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable) {
|
|
|
7285
7306
|
"flow --resume <RUN_ID>",
|
|
7286
7307
|
"autoRun.resume.flowCommand",
|
|
7287
7308
|
"context --json-compact"
|
|
7288
|
-
]
|
|
7309
|
+
],
|
|
7310
|
+
subAgentHandoff: {
|
|
7311
|
+
required: handoffRequired,
|
|
7312
|
+
mode: handoffMode,
|
|
7313
|
+
featureRef,
|
|
7314
|
+
category: delegation.category,
|
|
7315
|
+
cwd: handoffCwd,
|
|
7316
|
+
cmd: handoffCmd,
|
|
7317
|
+
verify: handoffRequired ? {
|
|
7318
|
+
runOncePerSession: true,
|
|
7319
|
+
cacheKey: verifyCacheKey,
|
|
7320
|
+
expectedCwd: handoffCwd,
|
|
7321
|
+
commands: ["pwd", "git rev-parse --show-toplevel"],
|
|
7322
|
+
onMismatch: "stop_and_report",
|
|
7323
|
+
collectDetailedLogsOnMismatchOnly: true
|
|
7324
|
+
} : null
|
|
7325
|
+
}
|
|
7289
7326
|
};
|
|
7290
7327
|
}
|
|
7291
7328
|
async function resolveContextState(config, featureName, options) {
|
|
@@ -7837,7 +7874,9 @@ async function runContext(featureName, options) {
|
|
|
7837
7874
|
);
|
|
7838
7875
|
const agentOrchestration = buildAgentOrchestrationPolicy(
|
|
7839
7876
|
state.actionOptions,
|
|
7840
|
-
autoRunPlan.available
|
|
7877
|
+
autoRunPlan.available,
|
|
7878
|
+
autoRunPlan.command,
|
|
7879
|
+
state.matchedFeature?.folderName || null
|
|
7841
7880
|
);
|
|
7842
7881
|
if (options.approve || options.execute) {
|
|
7843
7882
|
await runApprovedOption(
|
|
@@ -9657,8 +9696,12 @@ function toFlowRunStatus(status) {
|
|
|
9657
9696
|
return "failed";
|
|
9658
9697
|
}
|
|
9659
9698
|
}
|
|
9660
|
-
function buildAgentOrchestrationPolicy2(autoRun) {
|
|
9699
|
+
function buildAgentOrchestrationPolicy2(autoRun, featureRef) {
|
|
9661
9700
|
const preferredResumeCommand = autoRun?.run?.resumeCommand || autoRun?.resume?.flowCommand || null;
|
|
9701
|
+
const handoffRequired = !!autoRun && !!preferredResumeCommand;
|
|
9702
|
+
const verifyCacheKey = handoffRequired ? `${(featureRef || "unknown").toLowerCase()}|${Buffer.from(
|
|
9703
|
+
preferredResumeCommand
|
|
9704
|
+
).toString("base64").slice(0, 12)}` : "";
|
|
9662
9705
|
return {
|
|
9663
9706
|
mode: "main_orchestrates_subagent_execution",
|
|
9664
9707
|
delegationPolicy: "prefer_main_delegate_long_running_fallback_main",
|
|
@@ -9683,7 +9726,23 @@ function buildAgentOrchestrationPolicy2(autoRun) {
|
|
|
9683
9726
|
"AUTO_MANUAL_REQUIRED",
|
|
9684
9727
|
"command execution error"
|
|
9685
9728
|
],
|
|
9686
|
-
preferredResumeCommand
|
|
9729
|
+
preferredResumeCommand,
|
|
9730
|
+
subAgentHandoff: {
|
|
9731
|
+
required: handoffRequired,
|
|
9732
|
+
mode: handoffRequired ? "auto_run" : null,
|
|
9733
|
+
featureRef,
|
|
9734
|
+
category: null,
|
|
9735
|
+
cwd: handoffRequired ? process.cwd() : null,
|
|
9736
|
+
cmd: handoffRequired ? preferredResumeCommand : null,
|
|
9737
|
+
verify: handoffRequired ? {
|
|
9738
|
+
runOncePerSession: true,
|
|
9739
|
+
cacheKey: verifyCacheKey,
|
|
9740
|
+
expectedCwd: process.cwd(),
|
|
9741
|
+
commands: ["pwd", "git rev-parse --show-toplevel"],
|
|
9742
|
+
onMismatch: "stop_and_report",
|
|
9743
|
+
collectDetailedLogsOnMismatchOnly: true
|
|
9744
|
+
} : null
|
|
9745
|
+
}
|
|
9687
9746
|
};
|
|
9688
9747
|
}
|
|
9689
9748
|
function getFeatureRef2(feature) {
|
|
@@ -10334,7 +10393,10 @@ async function runFlow(featureName, options) {
|
|
|
10334
10393
|
const jsonMode = !!options.json || !!options.jsonCompact;
|
|
10335
10394
|
if (jsonMode) {
|
|
10336
10395
|
const autoRunFailed = !!(autoRun && isAutoRunFailureStatus(autoRun.status));
|
|
10337
|
-
const agentOrchestration2 = buildAgentOrchestrationPolicy2(
|
|
10396
|
+
const agentOrchestration2 = buildAgentOrchestrationPolicy2(
|
|
10397
|
+
autoRun,
|
|
10398
|
+
resolvedFeatureName || null
|
|
10399
|
+
);
|
|
10338
10400
|
const status = autoRunFailed ? "error" : "ok";
|
|
10339
10401
|
const reasonCode = autoRunFailed ? autoRun?.reasonCode || "AUTO_EXECUTION_FAILED" : "FLOW_SUMMARY";
|
|
10340
10402
|
if (options.jsonCompact) {
|
|
@@ -10429,7 +10491,10 @@ async function runFlow(featureName, options) {
|
|
|
10429
10491
|
console.log(chalk6.gray(`- Resume with: ${autoRun.run.resumeCommand}`));
|
|
10430
10492
|
}
|
|
10431
10493
|
}
|
|
10432
|
-
const agentOrchestration = buildAgentOrchestrationPolicy2(
|
|
10494
|
+
const agentOrchestration = buildAgentOrchestrationPolicy2(
|
|
10495
|
+
autoRun,
|
|
10496
|
+
resolvedFeatureName || null
|
|
10497
|
+
);
|
|
10433
10498
|
console.log(
|
|
10434
10499
|
chalk6.gray(
|
|
10435
10500
|
`- Orchestration: ${agentOrchestration.mode}, delegate long-running loops to sub-agent`
|