@xn-intenton-z2a/agentic-lib 7.4.16 → 7.4.17
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/bin/agentic-lib.js
CHANGED
package/package.json
CHANGED
|
@@ -579,8 +579,61 @@ async function executeDispatch(octokit, repo, actionName, params, ctx) {
|
|
|
579
579
|
}
|
|
580
580
|
|
|
581
581
|
async function executeCreateIssue(octokit, repo, params, ctx) {
|
|
582
|
-
|
|
583
|
-
|
|
582
|
+
// Derive title: use params.title, fall back to first line of body, fall back to feature name
|
|
583
|
+
let title = (params.title || "").trim();
|
|
584
|
+
const bodyText = (params.body || params.details || "").trim();
|
|
585
|
+
const feature = (params.feature || "").trim();
|
|
586
|
+
|
|
587
|
+
if (!title && bodyText) {
|
|
588
|
+
// Extract title from body: use first heading or first non-empty line
|
|
589
|
+
const headingMatch = bodyText.match(/^#+ (.+)/m);
|
|
590
|
+
const titleMatch = bodyText.match(/^Title:\s*(.+)/im);
|
|
591
|
+
if (titleMatch) {
|
|
592
|
+
title = titleMatch[1].trim();
|
|
593
|
+
} else if (headingMatch) {
|
|
594
|
+
title = headingMatch[1].trim();
|
|
595
|
+
} else {
|
|
596
|
+
// Use first line, truncated
|
|
597
|
+
title = bodyText.split("\n")[0].substring(0, 120).trim();
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
if (!title && feature) {
|
|
601
|
+
title = `feat: implement ${feature}`;
|
|
602
|
+
}
|
|
603
|
+
if (!title) {
|
|
604
|
+
core.warning("create-issue: no title, body, or feature provided — skipping");
|
|
605
|
+
return "skipped:no-title";
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
const rawLabels = params.labels;
|
|
609
|
+
const labels = Array.isArray(rawLabels)
|
|
610
|
+
? rawLabels.map((l) => String(l).trim()).filter(Boolean)
|
|
611
|
+
: typeof rawLabels === "string"
|
|
612
|
+
? rawLabels.split(",").map((l) => l.trim()).filter(Boolean)
|
|
613
|
+
: ["automated"];
|
|
614
|
+
if (!labels.includes("automated")) labels.push("automated");
|
|
615
|
+
|
|
616
|
+
// Build rich issue body with context
|
|
617
|
+
const bodyParts = [];
|
|
618
|
+
if (bodyText) {
|
|
619
|
+
bodyParts.push(bodyText);
|
|
620
|
+
}
|
|
621
|
+
if (feature) {
|
|
622
|
+
bodyParts.push("");
|
|
623
|
+
bodyParts.push(`## Related Feature`);
|
|
624
|
+
bodyParts.push(`Feature spec: \`features/${feature}.md\``);
|
|
625
|
+
}
|
|
626
|
+
// Add mission context from MISSION.md
|
|
627
|
+
const missionText = ctx?.mission || "";
|
|
628
|
+
if (missionText) {
|
|
629
|
+
const missionHeading = missionText.match(/^#\s+(.+)/m);
|
|
630
|
+
const missionName = missionHeading ? missionHeading[1].trim() : "MISSION.md";
|
|
631
|
+
bodyParts.push("");
|
|
632
|
+
bodyParts.push(`## Context`);
|
|
633
|
+
bodyParts.push(`Mission: ${missionName}`);
|
|
634
|
+
bodyParts.push(`Created by: agentic-step supervisor`);
|
|
635
|
+
}
|
|
636
|
+
const body = bodyParts.join("\n");
|
|
584
637
|
|
|
585
638
|
// Dedup guard: skip if a similarly-titled issue was closed in the last hour
|
|
586
639
|
// Exclude issues closed before the init timestamp (cross-scenario protection)
|
|
@@ -610,13 +663,18 @@ async function executeCreateIssue(octokit, repo, params, ctx) {
|
|
|
610
663
|
}
|
|
611
664
|
|
|
612
665
|
core.info(`Creating issue: ${title}`);
|
|
613
|
-
const { data: issue } = await octokit.rest.issues.create({ ...repo, title, labels });
|
|
666
|
+
const { data: issue } = await octokit.rest.issues.create({ ...repo, title, body, labels });
|
|
614
667
|
return `created-issue:#${issue.number}`;
|
|
615
668
|
}
|
|
616
669
|
|
|
617
670
|
async function executeLabelIssue(octokit, repo, params) {
|
|
618
671
|
const issueNumber = Number(params["issue-number"]);
|
|
619
|
-
const
|
|
672
|
+
const rawLabels = params.labels;
|
|
673
|
+
const labels = Array.isArray(rawLabels)
|
|
674
|
+
? rawLabels.map((l) => String(l).trim()).filter(Boolean)
|
|
675
|
+
: typeof rawLabels === "string"
|
|
676
|
+
? rawLabels.split(",").map((l) => l.trim()).filter(Boolean)
|
|
677
|
+
: [];
|
|
620
678
|
if (issueNumber && labels.length > 0) {
|
|
621
679
|
core.info(`Labelling issue #${issueNumber}: ${labels.join(", ")}`);
|
|
622
680
|
await octokit.rest.issues.addLabels({ ...repo, issue_number: issueNumber, labels });
|
|
@@ -58,6 +58,14 @@ runs:
|
|
|
58
58
|
sleep $((attempt * 2))
|
|
59
59
|
continue
|
|
60
60
|
}
|
|
61
|
+
# After rebase, check if our changes survived (rebase may drop empty commits)
|
|
62
|
+
LOCAL_SHA=$(git rev-parse HEAD)
|
|
63
|
+
REMOTE_SHA=$(git rev-parse "origin/$REF" 2>/dev/null || echo "")
|
|
64
|
+
if [ "$LOCAL_SHA" = "$REMOTE_SHA" ]; then
|
|
65
|
+
echo "Rebase dropped local commit (already on remote) — nothing to push"
|
|
66
|
+
PUSH_SUCCESS="true"
|
|
67
|
+
break
|
|
68
|
+
fi
|
|
61
69
|
fi
|
|
62
70
|
# Use HEAD:refs/heads/$REF to handle detached HEAD state
|
|
63
71
|
# (actions/checkout with a SHA puts us in detached HEAD, so
|