@papi-ai/server 0.7.48 → 0.7.50
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/backfill-cycle-metrics.js +16 -0
- package/dist/index.js +36 -14
- package/package.json +3 -3
|
@@ -30,6 +30,7 @@ __export(git_exports, {
|
|
|
30
30
|
getCurrentBranch: () => getCurrentBranch,
|
|
31
31
|
getDocPathsTouchedOnBranch: () => getDocPathsTouchedOnBranch,
|
|
32
32
|
getFilesChangedBetween: () => getFilesChangedBetween,
|
|
33
|
+
getFilesChangedForTask: () => getFilesChangedForTask,
|
|
33
34
|
getFilesChangedFromBase: () => getFilesChangedFromBase,
|
|
34
35
|
getHeadCommitSha: () => getHeadCommitSha,
|
|
35
36
|
getHeadCommitSubject: () => getHeadCommitSubject,
|
|
@@ -980,6 +981,21 @@ function getFilesChangedBetween(cwd, fromRef, toRef) {
|
|
|
980
981
|
return [];
|
|
981
982
|
}
|
|
982
983
|
}
|
|
984
|
+
function getFilesChangedForTask(cwd, baseBranch, taskId) {
|
|
985
|
+
try {
|
|
986
|
+
const mergeBase = execFileSync("git", ["merge-base", baseBranch, "HEAD"], { cwd, encoding: "utf-8" }).trim();
|
|
987
|
+
const output = execFileSync(
|
|
988
|
+
"git",
|
|
989
|
+
["log", `${mergeBase}..HEAD`, "-E", `--grep=${taskId}($|[^0-9])`, "--pretty=format:", "--name-only"],
|
|
990
|
+
{ cwd, encoding: "utf-8" }
|
|
991
|
+
).trim();
|
|
992
|
+
if (!output) return [];
|
|
993
|
+
const files = output.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
994
|
+
return Array.from(new Set(files));
|
|
995
|
+
} catch {
|
|
996
|
+
return [];
|
|
997
|
+
}
|
|
998
|
+
}
|
|
983
999
|
function getLastCommitFiles(cwd) {
|
|
984
1000
|
try {
|
|
985
1001
|
const output = execFileSync(
|
package/dist/index.js
CHANGED
|
@@ -31,6 +31,7 @@ __export(git_exports, {
|
|
|
31
31
|
getCurrentBranch: () => getCurrentBranch,
|
|
32
32
|
getDocPathsTouchedOnBranch: () => getDocPathsTouchedOnBranch,
|
|
33
33
|
getFilesChangedBetween: () => getFilesChangedBetween,
|
|
34
|
+
getFilesChangedForTask: () => getFilesChangedForTask,
|
|
34
35
|
getFilesChangedFromBase: () => getFilesChangedFromBase,
|
|
35
36
|
getHeadCommitSha: () => getHeadCommitSha,
|
|
36
37
|
getHeadCommitSubject: () => getHeadCommitSubject,
|
|
@@ -981,6 +982,21 @@ function getFilesChangedBetween(cwd, fromRef, toRef) {
|
|
|
981
982
|
return [];
|
|
982
983
|
}
|
|
983
984
|
}
|
|
985
|
+
function getFilesChangedForTask(cwd, baseBranch, taskId) {
|
|
986
|
+
try {
|
|
987
|
+
const mergeBase = execFileSync("git", ["merge-base", baseBranch, "HEAD"], { cwd, encoding: "utf-8" }).trim();
|
|
988
|
+
const output = execFileSync(
|
|
989
|
+
"git",
|
|
990
|
+
["log", `${mergeBase}..HEAD`, "-E", `--grep=${taskId}($|[^0-9])`, "--pretty=format:", "--name-only"],
|
|
991
|
+
{ cwd, encoding: "utf-8" }
|
|
992
|
+
).trim();
|
|
993
|
+
if (!output) return [];
|
|
994
|
+
const files = output.split("\n").map((l) => l.trim()).filter(Boolean);
|
|
995
|
+
return Array.from(new Set(files));
|
|
996
|
+
} catch {
|
|
997
|
+
return [];
|
|
998
|
+
}
|
|
999
|
+
}
|
|
984
1000
|
function getLastCommitFiles(cwd) {
|
|
985
1001
|
try {
|
|
986
1002
|
const output = execFileSync(
|
|
@@ -20771,7 +20787,13 @@ async function completeBuild(adapter2, config2, taskId, input, options = {}, cli
|
|
|
20771
20787
|
const changed = getFilesChangedFromBase(config2.projectRoot, baseBranch);
|
|
20772
20788
|
if (changed.length > 0) report.filesChanged = changed;
|
|
20773
20789
|
const startSha = taskStartShaMap.get(taskId);
|
|
20774
|
-
|
|
20790
|
+
let driftChanged;
|
|
20791
|
+
if (startSha) {
|
|
20792
|
+
driftChanged = getFilesChangedBetween(config2.projectRoot, startSha, "HEAD");
|
|
20793
|
+
} else {
|
|
20794
|
+
const taskScoped = getFilesChangedForTask(config2.projectRoot, baseBranch, taskId);
|
|
20795
|
+
driftChanged = taskScoped.length > 0 ? taskScoped : changed;
|
|
20796
|
+
}
|
|
20775
20797
|
const drift = computeScopeDriftSignal(task.buildHandoff?.filesLikelyTouched, driftChanged);
|
|
20776
20798
|
if (drift) report.scopeDriftSignal = drift;
|
|
20777
20799
|
}
|
|
@@ -23680,19 +23702,19 @@ function mergeAfterAccept(config2, taskId) {
|
|
|
23680
23702
|
return { merged: false, skipped: false, message: `PR merge failed: ${merge.message}`, details };
|
|
23681
23703
|
}
|
|
23682
23704
|
details.push(merge.message);
|
|
23683
|
-
|
|
23684
|
-
|
|
23685
|
-
|
|
23686
|
-
|
|
23687
|
-
|
|
23688
|
-
|
|
23689
|
-
|
|
23690
|
-
|
|
23691
|
-
|
|
23692
|
-
|
|
23693
|
-
|
|
23694
|
-
details
|
|
23695
|
-
}
|
|
23705
|
+
const trackedDirty = getTrackedModifiedFiles(config2.projectRoot);
|
|
23706
|
+
if (trackedDirty.length > 0) {
|
|
23707
|
+
const shown = trackedDirty.slice(0, 5).join(", ");
|
|
23708
|
+
const more = trackedDirty.length > 5 ? ` (+${trackedDirty.length - 5} more)` : "";
|
|
23709
|
+
details.push(
|
|
23710
|
+
`Local branch switch skipped: the working tree has uncommitted tracked changes on '${featureBranch}' (possibly another session's in-progress work) that a checkout to '${baseBranch}' would revert. Commit or stash them, then run \`git checkout ${baseBranch} && git pull\` to finish. Dirty: ${shown}${more}.`
|
|
23711
|
+
);
|
|
23712
|
+
return {
|
|
23713
|
+
merged: true,
|
|
23714
|
+
skipped: false,
|
|
23715
|
+
message: `PR merged: \`${featureBranch}\` \u2192 \`${baseBranch}\`. Local switch skipped \u2014 tracked-dirty tree preserved.`,
|
|
23716
|
+
details
|
|
23717
|
+
};
|
|
23696
23718
|
}
|
|
23697
23719
|
const checkout = checkoutBranch(config2.projectRoot, baseBranch);
|
|
23698
23720
|
if (checkout.success) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@papi-ai/server",
|
|
3
|
-
"version": "0.7.
|
|
4
|
-
"description": "PAPI MCP server
|
|
3
|
+
"version": "0.7.50",
|
|
4
|
+
"description": "PAPI MCP server — AI-powered sprint planning, build execution, and strategy review for software projects",
|
|
5
5
|
"license": "Elastic-2.0",
|
|
6
6
|
"mcpName": "io.github.getpapi/papi",
|
|
7
7
|
"type": "module",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
],
|
|
43
43
|
"repository": {
|
|
44
44
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/
|
|
45
|
+
"url": "https://github.com/getpapi/papi.git",
|
|
46
46
|
"directory": "packages/server"
|
|
47
47
|
},
|
|
48
48
|
"engines": {
|