runcastle 1.0.10 → 1.0.11
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/runcastle.js +10 -3
- package/index.js +10 -3
- package/package.json +1 -1
package/bin/runcastle.js
CHANGED
|
@@ -2139,6 +2139,9 @@ function researchBranchName(slug, waypointSeq, unique) {
|
|
|
2139
2139
|
function ticketBranchName(slug, ticketSeq, unique) {
|
|
2140
2140
|
return `${TICKET_BRANCH_PREFIX}${tempBranchSlugSegment(slug)}/${ticketSeq}-${unique}`;
|
|
2141
2141
|
}
|
|
2142
|
+
async function allowPushToCheckedOutBranches(repoPath) {
|
|
2143
|
+
await git(repoPath).addConfig("receive.denyCurrentBranch", "updateInstead");
|
|
2144
|
+
}
|
|
2142
2145
|
async function mergeTempBranch(repoPath, featureBranchName, tempBranch) {
|
|
2143
2146
|
const g = git(repoPath);
|
|
2144
2147
|
let branches;
|
|
@@ -2705,7 +2708,7 @@ function resolveBurnWorkspaceMode(config2, platform = process.platform) {
|
|
|
2705
2708
|
function buildIsolatedSetupCommand(tempBranch, setupCommand) {
|
|
2706
2709
|
const hookFile = `${ISOLATED_REPO_PATH}/.git/hooks/post-commit`;
|
|
2707
2710
|
const parts = [
|
|
2708
|
-
`git
|
|
2711
|
+
`git config --global --add safe.directory '*'`,
|
|
2709
2712
|
`git clone ${SANDBOX_WORKSPACE_PATH} ${ISOLATED_REPO_PATH}`,
|
|
2710
2713
|
`printf '#!/bin/sh\\nexec git push --quiet origin HEAD:%s\\n' '${tempBranch}' > ${hookFile}`,
|
|
2711
2714
|
`chmod +x ${hookFile}`
|
|
@@ -3014,10 +3017,12 @@ function selectSandbox(config2, mounts = []) {
|
|
|
3014
3017
|
return noSandbox();
|
|
3015
3018
|
}
|
|
3016
3019
|
}
|
|
3017
|
-
async function realExecuteTicketRun(ctx, ticket, config2, token, model, land) {
|
|
3020
|
+
async function realExecuteTicketRun(ctx, ticket, config2, token, model, land, ensureIsolatedPushTarget) {
|
|
3018
3021
|
const { project, feature } = ctx;
|
|
3019
3022
|
const tempBranch = ticketBranchName(feature.slug, ticket.seq, newId("b").slice(2, 10));
|
|
3020
3023
|
const workspaceMode = resolveBurnWorkspaceMode(config2);
|
|
3024
|
+
if (workspaceMode === "isolated")
|
|
3025
|
+
await ensureIsolatedPushTarget();
|
|
3021
3026
|
const template = readFileSync4(burnerTemplatePath(), "utf8");
|
|
3022
3027
|
const prompt = renderTicketPrompt(template, {
|
|
3023
3028
|
TICKET_JSON: buildTicketJson(ticket),
|
|
@@ -3131,11 +3136,13 @@ function resolveBurnDeps(ctx) {
|
|
|
3131
3136
|
const token = readTokenFromEnvFile(envPath());
|
|
3132
3137
|
const model = resolveModel("implement", config2, ctx.project, ctx.modelOverride);
|
|
3133
3138
|
const land = createSerialQueue();
|
|
3139
|
+
let pushTargetReady;
|
|
3140
|
+
const ensureIsolatedPushTarget = () => pushTargetReady ??= allowPushToCheckedOutBranches(ctx.project.repoPath);
|
|
3134
3141
|
return {
|
|
3135
3142
|
config: config2,
|
|
3136
3143
|
hasAuthToken: token !== undefined,
|
|
3137
3144
|
concurrency: config2.burnConcurrency,
|
|
3138
|
-
executeTicketRun: (c, ticket) => realExecuteTicketRun(c, ticket, config2, token, model, land)
|
|
3145
|
+
executeTicketRun: (c, ticket) => realExecuteTicketRun(c, ticket, config2, token, model, land, ensureIsolatedPushTarget)
|
|
3139
3146
|
};
|
|
3140
3147
|
}
|
|
3141
3148
|
function readTokenFromEnvFile(path) {
|
package/index.js
CHANGED
|
@@ -2138,6 +2138,9 @@ function researchBranchName(slug, waypointSeq, unique) {
|
|
|
2138
2138
|
function ticketBranchName(slug, ticketSeq, unique) {
|
|
2139
2139
|
return `${TICKET_BRANCH_PREFIX}${tempBranchSlugSegment(slug)}/${ticketSeq}-${unique}`;
|
|
2140
2140
|
}
|
|
2141
|
+
async function allowPushToCheckedOutBranches(repoPath) {
|
|
2142
|
+
await git(repoPath).addConfig("receive.denyCurrentBranch", "updateInstead");
|
|
2143
|
+
}
|
|
2141
2144
|
async function mergeTempBranch(repoPath, featureBranchName, tempBranch) {
|
|
2142
2145
|
const g = git(repoPath);
|
|
2143
2146
|
let branches;
|
|
@@ -2704,7 +2707,7 @@ function resolveBurnWorkspaceMode(config2, platform = process.platform) {
|
|
|
2704
2707
|
function buildIsolatedSetupCommand(tempBranch, setupCommand) {
|
|
2705
2708
|
const hookFile = `${ISOLATED_REPO_PATH}/.git/hooks/post-commit`;
|
|
2706
2709
|
const parts = [
|
|
2707
|
-
`git
|
|
2710
|
+
`git config --global --add safe.directory '*'`,
|
|
2708
2711
|
`git clone ${SANDBOX_WORKSPACE_PATH} ${ISOLATED_REPO_PATH}`,
|
|
2709
2712
|
`printf '#!/bin/sh\\nexec git push --quiet origin HEAD:%s\\n' '${tempBranch}' > ${hookFile}`,
|
|
2710
2713
|
`chmod +x ${hookFile}`
|
|
@@ -3013,10 +3016,12 @@ function selectSandbox(config2, mounts = []) {
|
|
|
3013
3016
|
return noSandbox();
|
|
3014
3017
|
}
|
|
3015
3018
|
}
|
|
3016
|
-
async function realExecuteTicketRun(ctx, ticket, config2, token, model, land) {
|
|
3019
|
+
async function realExecuteTicketRun(ctx, ticket, config2, token, model, land, ensureIsolatedPushTarget) {
|
|
3017
3020
|
const { project, feature } = ctx;
|
|
3018
3021
|
const tempBranch = ticketBranchName(feature.slug, ticket.seq, newId("b").slice(2, 10));
|
|
3019
3022
|
const workspaceMode = resolveBurnWorkspaceMode(config2);
|
|
3023
|
+
if (workspaceMode === "isolated")
|
|
3024
|
+
await ensureIsolatedPushTarget();
|
|
3020
3025
|
const template = readFileSync4(burnerTemplatePath(), "utf8");
|
|
3021
3026
|
const prompt = renderTicketPrompt(template, {
|
|
3022
3027
|
TICKET_JSON: buildTicketJson(ticket),
|
|
@@ -3130,11 +3135,13 @@ function resolveBurnDeps(ctx) {
|
|
|
3130
3135
|
const token = readTokenFromEnvFile(envPath());
|
|
3131
3136
|
const model = resolveModel("implement", config2, ctx.project, ctx.modelOverride);
|
|
3132
3137
|
const land = createSerialQueue();
|
|
3138
|
+
let pushTargetReady;
|
|
3139
|
+
const ensureIsolatedPushTarget = () => pushTargetReady ??= allowPushToCheckedOutBranches(ctx.project.repoPath);
|
|
3133
3140
|
return {
|
|
3134
3141
|
config: config2,
|
|
3135
3142
|
hasAuthToken: token !== undefined,
|
|
3136
3143
|
concurrency: config2.burnConcurrency,
|
|
3137
|
-
executeTicketRun: (c, ticket) => realExecuteTicketRun(c, ticket, config2, token, model, land)
|
|
3144
|
+
executeTicketRun: (c, ticket) => realExecuteTicketRun(c, ticket, config2, token, model, land, ensureIsolatedPushTarget)
|
|
3138
3145
|
};
|
|
3139
3146
|
}
|
|
3140
3147
|
function readTokenFromEnvFile(path) {
|