@rosthq/cli 0.7.39 → 0.7.40
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.
|
@@ -36,6 +36,7 @@ export declare function prepareForgeWorkspace(options: PrepareForgeWorkspaceOpti
|
|
|
36
36
|
export declare function pushChangeset(ws: ForgeWorkspace, credential: ForgeCredential): Promise<{
|
|
37
37
|
commitSha: string;
|
|
38
38
|
} | null>;
|
|
39
|
+
export declare function computeChangedPaths(ws: ForgeWorkspace): Promise<string[]>;
|
|
39
40
|
export type OpenDraftPullRequestOptions = {
|
|
40
41
|
repo: {
|
|
41
42
|
owner: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forge-workspace.d.ts","sourceRoot":"","sources":["../src/forge-workspace.ts"],"names":[],"mappings":"AAmDA,eAAO,MAAM,yBAAyB,gFAQ5B,CAAC;AAEX,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAAC,UAAU,CAW7E;AAID,MAAM,MAAM,eAAe,GAAG;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAG3B,QAAQ,EAAE,MAAM,CAAC;IAGjB,WAAW,EAAE,MAAM,CAAC;IAGpB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,OAAO,CAAC;IAKlB,OAAO,EAAE,MAAM,CAAC;IAIhB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvD,MAAM,MAAM,4BAA4B,GAAG;IAEzC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM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AAc,CAAC,CAmC1G;AA8CD,wBAAsB,aAAa,CACjC,EAAE,EAAE,cAAc,EAClB,UAAU,EAAE,eAAe,GAC1B,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAAC,CA4BvC;AAsBD,wBAAsB,mBAAmB,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiC/E;AAcD,MAAM,MAAM,2BAA2B,GAAG;IACxC,IAAI,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAA;KAAE,CAAC;IAE9D,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,eAAe,CAAC;IAG5B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,OAAO,KAAK,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAE7B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IAGf,OAAO,EAAE,OAAO,CAAC;CAClB,CAAC;AAoGF,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAkC1G;AAiBD,wBAAsB,eAAe,CAAC,EAAE,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAOvE"}
|
package/dist/index.js
CHANGED
|
@@ -52060,6 +52060,36 @@ async function pushChangeset(ws, credential) {
|
|
|
52060
52060
|
});
|
|
52061
52061
|
return { commitSha: head2 };
|
|
52062
52062
|
}
|
|
52063
|
+
async function computeChangedPaths(ws) {
|
|
52064
|
+
if (ws.readOnly || ws.branch.length === 0) {
|
|
52065
|
+
return [];
|
|
52066
|
+
}
|
|
52067
|
+
const raw = await runGit(
|
|
52068
|
+
["diff", "--name-status", "-M", "-z", `${ws.baseSha}..HEAD`],
|
|
52069
|
+
ws.worktreeDir
|
|
52070
|
+
);
|
|
52071
|
+
const tokens = raw.split("\0").filter((token) => token.length > 0);
|
|
52072
|
+
const paths = /* @__PURE__ */ new Set();
|
|
52073
|
+
let i = 0;
|
|
52074
|
+
while (i < tokens.length) {
|
|
52075
|
+
const status = tokens[i] ?? "";
|
|
52076
|
+
i += 1;
|
|
52077
|
+
const isRenameOrCopy = status.startsWith("R") || status.startsWith("C");
|
|
52078
|
+
const src = tokens[i];
|
|
52079
|
+
if (src !== void 0) {
|
|
52080
|
+
paths.add(src);
|
|
52081
|
+
i += 1;
|
|
52082
|
+
}
|
|
52083
|
+
if (isRenameOrCopy) {
|
|
52084
|
+
const dst = tokens[i];
|
|
52085
|
+
if (dst !== void 0) {
|
|
52086
|
+
paths.add(dst);
|
|
52087
|
+
i += 1;
|
|
52088
|
+
}
|
|
52089
|
+
}
|
|
52090
|
+
}
|
|
52091
|
+
return [...paths];
|
|
52092
|
+
}
|
|
52063
52093
|
var GITHUB_API_BASE_URL = "https://api.github.com";
|
|
52064
52094
|
var PR_OPEN_RETRY_ATTEMPTS = 3;
|
|
52065
52095
|
var PR_OPEN_RETRY_BASE_DELAY_MS = 500;
|
|
@@ -52946,7 +52976,8 @@ async function executeClaimedUnit(fetchImpl, appUrl2, state, config2, io, runtim
|
|
|
52946
52976
|
...result.prUrl ? { pr_url: result.prUrl } : {},
|
|
52947
52977
|
...result.branch ? { branch: result.branch } : {},
|
|
52948
52978
|
...result.commitSha ? { commit_sha: result.commitSha } : {},
|
|
52949
|
-
...result.evidence && result.evidence.length > 0 ? { evidence: result.evidence } : {}
|
|
52979
|
+
...result.evidence && result.evidence.length > 0 ? { evidence: result.evidence } : {},
|
|
52980
|
+
...result.changedPaths && result.changedPaths.length > 0 ? { changed_paths: result.changedPaths } : {}
|
|
52950
52981
|
}, state.runner_secret);
|
|
52951
52982
|
if (reported.status !== 200) {
|
|
52952
52983
|
throw new Error(`${claimedUnitLabel(input.kind)} result failed ${reported.status}: ${redactForLog(JSON.stringify(reported.json))}`);
|
|
@@ -53132,6 +53163,12 @@ async function prepareForgeTurn(ctx, workOrder, execution) {
|
|
|
53132
53163
|
}
|
|
53133
53164
|
};
|
|
53134
53165
|
}
|
|
53166
|
+
var FORGE_MAX_CHANGED_PATHS = 2e3;
|
|
53167
|
+
var FORGE_MAX_CHANGED_PATH_LENGTH = 500;
|
|
53168
|
+
function forgeChangedPathsField(changedPaths) {
|
|
53169
|
+
const withinCaps = changedPaths.length > 0 && changedPaths.length <= FORGE_MAX_CHANGED_PATHS && changedPaths.every((path7) => path7.length >= 1 && path7.length <= FORGE_MAX_CHANGED_PATH_LENGTH);
|
|
53170
|
+
return withinCaps ? { changedPaths: [...changedPaths] } : {};
|
|
53171
|
+
}
|
|
53135
53172
|
async function finalizeForgeBuildPush(prep, result) {
|
|
53136
53173
|
const credential = { token: prep.credential.token, expiresAt: prep.credential.expiresAt };
|
|
53137
53174
|
let pushed;
|
|
@@ -53149,6 +53186,13 @@ async function finalizeForgeBuildPush(prep, result) {
|
|
|
53149
53186
|
return { ...result, summary: `${result.summary}
|
|
53150
53187
|
[forge] no changes to push`.slice(0, 12e3) };
|
|
53151
53188
|
}
|
|
53189
|
+
let changedPaths = [];
|
|
53190
|
+
try {
|
|
53191
|
+
changedPaths = await computeChangedPaths(prep.workspace);
|
|
53192
|
+
} catch {
|
|
53193
|
+
changedPaths = [];
|
|
53194
|
+
}
|
|
53195
|
+
const changedPathsField = forgeChangedPathsField(changedPaths);
|
|
53152
53196
|
try {
|
|
53153
53197
|
const pr = await openDraftPullRequest({
|
|
53154
53198
|
repo: prep.repo,
|
|
@@ -53167,6 +53211,7 @@ async function finalizeForgeBuildPush(prep, result) {
|
|
|
53167
53211
|
branch: prep.workspace.branch,
|
|
53168
53212
|
commitSha: pushed.commitSha,
|
|
53169
53213
|
evidence,
|
|
53214
|
+
...changedPathsField,
|
|
53170
53215
|
summary: `${result.summary}
|
|
53171
53216
|
[forge] pushed ${pushed.commitSha} to ${prep.workspace.branch}; ${pr.adopted ? "adopted" : "opened"} draft PR ${pr.url}`.slice(0, 12e3)
|
|
53172
53217
|
};
|
|
@@ -53178,6 +53223,7 @@ async function finalizeForgeBuildPush(prep, result) {
|
|
|
53178
53223
|
// rather than advancing a headless push. Re-entry re-pushes (no-op) and re-opens (adopt).
|
|
53179
53224
|
branch: prep.workspace.branch,
|
|
53180
53225
|
commitSha: pushed.commitSha,
|
|
53226
|
+
...changedPathsField,
|
|
53181
53227
|
summary: `${result.summary}
|
|
53182
53228
|
[forge] pushed ${pushed.commitSha} to ${prep.workspace.branch}; draft PR open failed: ${redactForLog(error51 instanceof Error ? error51.message : String(error51))}`.slice(0, 12e3)
|
|
53183
53229
|
};
|