lee-spec-kit 0.6.31 → 0.6.32

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 CHANGED
@@ -6777,6 +6777,9 @@ function detectFromBranch(branchName, features) {
6777
6777
  (f) => f.slug.toLowerCase() === detected.toLowerCase() || f.folderName.toLowerCase() === detected.toLowerCase()
6778
6778
  );
6779
6779
  }
6780
+ function detectFromExpectedFeatureBranch(features) {
6781
+ return features.filter((feature) => feature.git.onExpectedBranch);
6782
+ }
6780
6783
  function toSelectionStatus(features, selectionMode, openFeatures, targetFeatures) {
6781
6784
  const isNoOpen = selectionMode === "open" && features.length > 0 && openFeatures.length === 0;
6782
6785
  if (features.length === 0) return "no_features";
@@ -6813,7 +6816,12 @@ async function resolveContextSelection(config, featureName, options) {
6813
6816
  );
6814
6817
  selectionMode = "explicit";
6815
6818
  } else {
6816
- if (config.projectType === "single") {
6819
+ const expectedBranchMatches = detectFromExpectedFeatureBranch(scopedFeatures);
6820
+ if (expectedBranchMatches.length === 1) {
6821
+ targetFeatures = expectedBranchMatches;
6822
+ selectionMode = "branch";
6823
+ selectionFallback = "none";
6824
+ } else if (config.projectType === "single") {
6817
6825
  const branchName = branches.project.single || "";
6818
6826
  targetFeatures = detectFromBranch(branchName, scopedFeatures);
6819
6827
  } else if (selectedComponent) {
@@ -6884,16 +6892,6 @@ async function resolveContextSelection(config, featureName, options) {
6884
6892
  }
6885
6893
 
6886
6894
  // src/utils/context/approval-reply.ts
6887
- function isAffirmativeApprovalReply(input) {
6888
- const raw = input.trim();
6889
- if (!raw) return false;
6890
- if (/\b(?:no|don'?t|do not|stop|cancel|hold|wait|아니|취소|중지|보류)\b/i.test(raw)) {
6891
- return false;
6892
- }
6893
- return /(?:^|[\s`"'([{<])(?:ok|okay|yes|y|go|proceed|continue|run|execute|approve(?:d)?|진행(?:해|하세요)?|수행(?:해|하세요)?|실행(?:해|하세요)?|승인(?:해|하세요)?|해줘|해주세요|오케이)(?:$|[\s`"')\]}>.!?,])/i.test(
6894
- raw
6895
- );
6896
- }
6897
6895
  function normalizeRequestText(raw) {
6898
6896
  return raw.replace(/^[\s,;:]+/, "").trim();
6899
6897
  }
@@ -6916,9 +6914,6 @@ function parseApprovalReply(input, validLabels) {
6916
6914
  for (const token of tokens) {
6917
6915
  if (validSet.has(token)) return { label: token };
6918
6916
  }
6919
- if (normalizedLabels.length === 1 && isAffirmativeApprovalReply(input)) {
6920
- return { label: normalizedLabels[0] };
6921
- }
6922
6917
  return null;
6923
6918
  }
6924
6919
  var LEGACY_APPROVAL_TICKET_FILENAME = ".lee-spec-kit.approval-tickets.json";
@@ -7284,9 +7279,10 @@ function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable, autoRunC
7284
7279
  const delegation = shouldDelegateCurrentAction(actionOptions);
7285
7280
  const primaryOption = actionOptions[0];
7286
7281
  const delegatedCommandOption = primaryOption && primaryOption.action.type === "command" && delegation.shouldDelegate ? primaryOption : null;
7287
- const handoffMode = delegatedCommandOption ? "command" : autoRunAvailable ? "auto_run" : null;
7288
- const handoffCwd = delegatedCommandOption?.action.cwd || (autoRunAvailable ? process.cwd() : null);
7289
- const handoffCmd = delegatedCommandOption?.action.cmd || (autoRunAvailable ? autoRunCommand : null);
7282
+ const shouldDelegateAutoRunNow = autoRunAvailable && actionOptions.length === 0;
7283
+ const handoffMode = delegatedCommandOption ? "command" : shouldDelegateAutoRunNow ? "auto_run" : null;
7284
+ const handoffCwd = delegatedCommandOption?.action.cwd || (shouldDelegateAutoRunNow ? process.cwd() : null);
7285
+ const handoffCmd = delegatedCommandOption?.action.cmd || (shouldDelegateAutoRunNow ? autoRunCommand : null);
7290
7286
  const handoffRequired = !!handoffMode && !!handoffCwd && !!handoffCmd;
7291
7287
  const verifyCacheKey = handoffRequired ? createHash("sha1").update(
7292
7288
  [
@@ -7304,7 +7300,8 @@ function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable, autoRunC
7304
7300
  fallbackToMainAgentWhenSubAgentUnavailable: true,
7305
7301
  longRunningCategories: [...LONG_RUNNING_DELEGATION_CATEGORIES],
7306
7302
  currentActionShouldDelegate: delegation.shouldDelegate,
7307
- autoRunShouldDelegate: autoRunAvailable,
7303
+ autoRunDelegationAvailable: autoRunAvailable,
7304
+ autoRunShouldDelegate: shouldDelegateAutoRunNow,
7308
7305
  currentActionCategory: delegation.category,
7309
7306
  mainAgentResponsibilities: [
7310
7307
  "Keep user conversation state and approval boundaries",
@@ -7332,7 +7329,7 @@ function buildAgentOrchestrationPolicy(actionOptions, autoRunAvailable, autoRunC
7332
7329
  required: handoffRequired,
7333
7330
  mode: handoffMode,
7334
7331
  featureRef,
7335
- category: delegation.category,
7332
+ category: handoffMode === "command" ? delegation.category : null,
7336
7333
  cwd: handoffCwd,
7337
7334
  cmd: handoffCmd,
7338
7335
  verify: handoffRequired ? {
@@ -7682,16 +7679,16 @@ function getListLabel(f, stepsMap, lang, workflowPolicy, prePrReviewPolicy) {
7682
7679
  if (workflowPolicy.requirePr && !f.pr.link) {
7683
7680
  return tr(lang, "cli", "context.list.recordPrLink");
7684
7681
  }
7685
- if (workflowPolicy.requireReview && !f.pr.status) {
7682
+ if (workflowPolicy.requireMerge && !f.pr.status) {
7686
7683
  return tr(lang, "cli", "context.list.setPrStatus");
7687
7684
  }
7688
- if (workflowPolicy.requireReview && f.pr.status === "Review" && (!f.docs.prReviewEvidenceFieldExists || !f.prReview.evidenceProvided)) {
7685
+ if (workflowPolicy.requireMerge && workflowPolicy.requireReview && f.pr.status === "Review" && (!f.docs.prReviewEvidenceFieldExists || !f.prReview.evidenceProvided)) {
7689
7686
  return tr(lang, "cli", "context.list.addPrReviewEvidence");
7690
7687
  }
7691
- if (workflowPolicy.requireReview && f.pr.status === "Review" && (!f.docs.prReviewDecisionFieldExists || !f.prReview.decisionProvided)) {
7688
+ if (workflowPolicy.requireMerge && workflowPolicy.requireReview && f.pr.status === "Review" && (!f.docs.prReviewDecisionFieldExists || !f.prReview.decisionProvided)) {
7692
7689
  return tr(lang, "cli", "context.list.addPrReviewDecision");
7693
7690
  }
7694
- if (workflowPolicy.requireReview && f.pr.status !== "Approved") {
7691
+ if (workflowPolicy.requireMerge && f.pr.status !== "Approved") {
7695
7692
  return tr(lang, "cli", "context.list.prStatusToApproved", {
7696
7693
  status: f.pr.status
7697
7694
  });
@@ -8056,7 +8053,7 @@ async function runContext(featureName, options) {
8056
8053
  "actionOptions[].detail",
8057
8054
  "actionOptions[].approvalPrompt"
8058
8055
  ] : [],
8059
- recommendation: "Before asking for approval, show only `actionOptions[].approvalPrompt` lines and `approvalRequest.finalPrompt` to the user. Keep `requiredDocs`, `checkPolicy`, and raw execution commands as internal guidance. For commit actions, include scope (`docs`/`project`) and commit message in the visible prompt. User replies should include the label token (e.g. `A`, `A OK`, `A proceed`, `A \uC9C4\uD589\uD574`). For command execution, prefer one-shot `npx lee-spec-kit flow <featureRef> --approve <LABEL> --execute` to avoid session mismatch after context compression/reset. Use ticket-based `context --execute --ticket` only when explicitly needed. Use main-agent orchestration: keep short steps in main agent, and delegate only long-running command/auto loops to sub-agents.",
8056
+ recommendation: 'Before asking for approval, show only `actionOptions[].approvalPrompt` lines and `approvalRequest.finalPrompt` to the user. Keep `requiredDocs`, `checkPolicy`, and raw execution commands as internal guidance. For commit actions, include scope (`docs`/`project`) and commit message in the visible prompt. User replies should include the label token (e.g. `A`, `A OK`, `A proceed`, `A \uC9C4\uD589\uD574`). For command execution, prefer one-shot `npx lee-spec-kit flow <featureRef> --approve <LABEL> --execute` to avoid session mismatch after context compression/reset. Use ticket-based `context --execute --ticket` only when explicitly needed. Use main-agent orchestration: keep short steps in main agent. Delegate command runs only when `agentOrchestration.currentActionShouldDelegate=true`, and delegate auto-run only when `agentOrchestration.subAgentHandoff.required=true` with `mode="auto_run"`.',
8060
8057
  oneApprovalPerAction: approvalRequired,
8061
8058
  requireFreshContext: true,
8062
8059
  contextVersion: state.contextVersion,
@@ -8070,10 +8067,10 @@ async function runContext(featureName, options) {
8070
8067
  command: autoRunPlan.command,
8071
8068
  untilCategories: autoRunPlan.untilCategories,
8072
8069
  unknownCategories: autoRunPlan.unknownCategories,
8073
- guidance: "Use auto-run only when `autoRun.available=true`. Stop and request approval when `approvalRequest.required=true` or when auto mode reaches configured gate categories."
8070
+ guidance: 'Use auto-run only when `autoRun.available=true`. Do not treat `autoRun.available` alone as a delegation trigger; use `agentOrchestration.subAgentHandoff.required` + `mode="auto_run"` for actual delegation. Stop and request approval when `approvalRequest.required=true` or when auto mode reaches configured gate categories.'
8074
8071
  },
8075
8072
  approvalRequest: {
8076
- guidance: "User-facing output must include only approval prompts (`A: ...`) and `finalPrompt`. Do not expose `requiredDocs`, `checkPolicy`, or raw `cmd` unless explicitly requested. For approved command actions, prefer one-shot `flow --approve <LABEL> --execute`. Keep short steps in main agent and delegate only long-running command/auto loops to sub-agents.",
8073
+ guidance: 'User-facing output must include only approval prompts (`A: ...`) and `finalPrompt`. Do not expose `requiredDocs`, `checkPolicy`, or raw `cmd` unless explicitly requested. For approved command actions, prefer one-shot `flow --approve <LABEL> --execute`. Keep short steps in main agent. Delegate command runs only when `agentOrchestration.currentActionShouldDelegate=true`, and delegate auto-run only when `agentOrchestration.subAgentHandoff.required=true` with `mode="auto_run"`.',
8077
8074
  required: approvalRequired,
8078
8075
  finalPrompt: finalApprovalPrompt,
8079
8076
  userFacingLines: approvalUserFacingLines,
@@ -8331,12 +8328,14 @@ async function runContext(featureName, options) {
8331
8328
  const actionOptions = state.actionOptions;
8332
8329
  const hasCommandOption = actionOptions.some((option) => option.action.type === "command");
8333
8330
  const longRunningDelegation = shouldDelegateCurrentAction(actionOptions);
8331
+ const showOptionLabels = hasCheckAction;
8334
8332
  console.log(chalk6.green(chalk6.bold("\u{1F449} Next Options (Atomic):")));
8335
8333
  let hasDocsCommand = false;
8336
8334
  actionOptions.forEach((option) => {
8337
8335
  const requiresCheck = option.action.requiresUserCheck;
8338
8336
  const detail = option.detail;
8339
- console.log(` ${option.label}. ${checkTag(requiresCheck)}${detail}`);
8337
+ const prefix = showOptionLabels ? `${option.label}. ` : "- ";
8338
+ console.log(` ${prefix}${checkTag(requiresCheck)}${detail}`);
8340
8339
  if (option.action.type === "command" && option.action.scope === "docs") {
8341
8340
  hasDocsCommand = true;
8342
8341
  }