@leitwerk-dev/worker 0.5.11 → 0.5.12
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/{chunk-OJ2YL4ZP.js → chunk-CY5MQV4X.js} +98 -147
- package/dist/chunk-CY5MQV4X.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/runtime/bootstrap.d.ts.map +1 -1
- package/dist/runtime/index.d.ts.map +1 -1
- package/dist/worker-entry.js +1 -1
- package/dist/workspace/checkout-tool.d.ts +2 -2
- package/dist/workspace/checkout-tool.d.ts.map +1 -1
- package/dist/workspace/manifest.d.ts +0 -7
- package/dist/workspace/manifest.d.ts.map +1 -1
- package/dist/workspace/node-run-root-git-ops.d.ts +4 -2
- package/dist/workspace/node-run-root-git-ops.d.ts.map +1 -1
- package/dist/workspace/run-root.d.ts +12 -13
- package/dist/workspace/run-root.d.ts.map +1 -1
- package/package.json +7 -7
- package/src/runtime/bootstrap.ts +10 -8
- package/src/runtime/index.ts +4 -0
- package/src/workspace/checkout-tool.ts +12 -13
- package/src/workspace/manifest.ts +0 -45
- package/src/workspace/node-run-root-git-ops.ts +45 -18
- package/src/workspace/run-root.ts +73 -112
- package/dist/chunk-OJ2YL4ZP.js.map +0 -1
|
@@ -2921,32 +2921,6 @@ function deserializeManifest(content) {
|
|
|
2921
2921
|
}
|
|
2922
2922
|
return { ok: true, manifest: result.output };
|
|
2923
2923
|
}
|
|
2924
|
-
function diffManifest(existing, serverProjects) {
|
|
2925
|
-
const stale = [];
|
|
2926
|
-
const missing = [];
|
|
2927
|
-
const extra = [];
|
|
2928
|
-
const unchanged = [];
|
|
2929
|
-
const byKey = new Map(existing.components.map((c) => [c.key, c]));
|
|
2930
|
-
const serverByKey = new Map(serverProjects.map((p) => [p.key, p]));
|
|
2931
|
-
for (const p of serverProjects) {
|
|
2932
|
-
const m = byKey.get(p.key);
|
|
2933
|
-
if (!m) {
|
|
2934
|
-
missing.push(p.key);
|
|
2935
|
-
continue;
|
|
2936
|
-
}
|
|
2937
|
-
if (m.repoLocator === p.repoLocator && m.baseBranch === p.baseBranch && m.workBranch === p.workBranch) {
|
|
2938
|
-
unchanged.push(p.key);
|
|
2939
|
-
} else {
|
|
2940
|
-
stale.push(p.key);
|
|
2941
|
-
}
|
|
2942
|
-
}
|
|
2943
|
-
for (const c of existing.components) {
|
|
2944
|
-
if (!serverByKey.has(c.key)) {
|
|
2945
|
-
extra.push(c.key);
|
|
2946
|
-
}
|
|
2947
|
-
}
|
|
2948
|
-
return { stale, missing, extra, unchanged };
|
|
2949
|
-
}
|
|
2950
2924
|
|
|
2951
2925
|
// src/workspace/resource-aggregator.ts
|
|
2952
2926
|
function formatProvenanceMarker(componentKey, filePath) {
|
|
@@ -3004,11 +2978,12 @@ function skillIdFromSkillPath(filePath) {
|
|
|
3004
2978
|
const m = normalized.match(/\.cursor\/skills\/([^/]+)\/SKILL\.md$/);
|
|
3005
2979
|
return m?.[1] ?? null;
|
|
3006
2980
|
}
|
|
3007
|
-
function planRunRoot(workspaceRoot, instanceId, projectSnapshots) {
|
|
2981
|
+
function planRunRoot(workspaceRoot, instanceId, projectSnapshots, submodules) {
|
|
3008
2982
|
return {
|
|
3009
2983
|
workspaceRoot,
|
|
3010
2984
|
instanceId,
|
|
3011
|
-
components: projectSnapshots.map((p) => ({ ...p }))
|
|
2985
|
+
components: projectSnapshots.map((p) => ({ ...p })),
|
|
2986
|
+
...submodules ? { submodules } : {}
|
|
3012
2987
|
};
|
|
3013
2988
|
}
|
|
3014
2989
|
async function materializeComponentEntry(plan, comp, git) {
|
|
@@ -3028,19 +3003,19 @@ async function materializeComponentEntry(plan, comp, git) {
|
|
|
3028
3003
|
headSha: await git.getHeadSha(dir)
|
|
3029
3004
|
};
|
|
3030
3005
|
}
|
|
3031
|
-
async function collectMaterializedEntries(plan, git, errors,
|
|
3006
|
+
async function collectMaterializedEntries(plan, git, errors, existing, pin) {
|
|
3032
3007
|
const entries = [];
|
|
3033
3008
|
for (const comp of plan.components) {
|
|
3034
3009
|
try {
|
|
3035
|
-
const retained =
|
|
3036
|
-
|
|
3010
|
+
const retained = existing?.get(comp.key);
|
|
3011
|
+
const entry = retained?.repoLocator === comp.repoLocator && retained.baseBranch === comp.baseBranch && retained.workBranch === comp.workBranch ? retained : await materializeComponentEntry(plan, comp, git);
|
|
3012
|
+
const revision = pin?.projectKey === comp.key ? pin.revision : entry.revision;
|
|
3013
|
+
if (revision) {
|
|
3037
3014
|
if (!git.checkoutRevision) throw new Error("Pinned repository checkout is unavailable");
|
|
3038
3015
|
const dir = componentDir(plan.workspaceRoot, comp.key);
|
|
3039
|
-
await git.checkoutRevision(dir,
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
}
|
|
3043
|
-
entries.push(retained ?? await materializeComponentEntry(plan, comp, git));
|
|
3016
|
+
const headSha = await git.checkoutRevision(dir, revision, !!plan.submodules);
|
|
3017
|
+
entries.push({ ...entry, headSha, revision });
|
|
3018
|
+
} else entries.push(entry);
|
|
3044
3019
|
} catch (e) {
|
|
3045
3020
|
errors.push(`${comp.key}: ${e instanceof Error ? e.message : String(e)}`);
|
|
3046
3021
|
}
|
|
@@ -3050,37 +3025,22 @@ async function collectMaterializedEntries(plan, git, errors, reusable = /* @__PU
|
|
|
3050
3025
|
async function gatherAgentsAndSkills(plan, git) {
|
|
3051
3026
|
const agentSources = [];
|
|
3052
3027
|
const skillSources = [];
|
|
3053
|
-
const aggregatedAgentsMdSources = [];
|
|
3054
3028
|
for (const comp of plan.components) {
|
|
3055
3029
|
const root = componentDir(plan.workspaceRoot, comp.key);
|
|
3056
|
-
const
|
|
3057
|
-
const sortedAgentPaths = [...agentPaths].sort((a, b) => a.localeCompare(b));
|
|
3058
|
-
for (const p of sortedAgentPaths) {
|
|
3059
|
-
const content = await git.readFile(root, p);
|
|
3060
|
-
if (content !== null) {
|
|
3061
|
-
agentSources.push({
|
|
3062
|
-
componentKey: comp.key,
|
|
3063
|
-
filePath: p,
|
|
3064
|
-
content
|
|
3065
|
-
});
|
|
3066
|
-
aggregatedAgentsMdSources.push(`${comp.key}/${p}`);
|
|
3067
|
-
}
|
|
3068
|
-
}
|
|
3069
|
-
const skillPaths = await git.listFiles(root, SKILL_GLOB);
|
|
3070
|
-
for (const p of skillPaths) {
|
|
3071
|
-
const skillId = skillIdFromSkillPath(p);
|
|
3072
|
-
if (!skillId) {
|
|
3073
|
-
continue;
|
|
3074
|
-
}
|
|
3030
|
+
for (const p of await git.listFiles(root, [AGENTS_GLOB, SKILL_GLOB], !!plan.submodules)) {
|
|
3075
3031
|
const content = await git.readFile(root, p);
|
|
3076
|
-
if (content
|
|
3077
|
-
|
|
3032
|
+
if (content === null) continue;
|
|
3033
|
+
if (path5.posix.basename(p) === "AGENTS.md") {
|
|
3034
|
+
agentSources.push({ componentKey: comp.key, filePath: p, content });
|
|
3035
|
+
} else {
|
|
3036
|
+
const skillId = skillIdFromSkillPath(p);
|
|
3037
|
+
if (skillId) skillSources.push({ componentKey: comp.key, skillId, content });
|
|
3078
3038
|
}
|
|
3079
3039
|
}
|
|
3080
3040
|
}
|
|
3081
3041
|
const agentsMd = aggregateAgentsMd(agentSources);
|
|
3082
3042
|
const skillsMap = collectSkills(skillSources);
|
|
3083
|
-
aggregatedAgentsMdSources.sort((a, b) => a.localeCompare(b));
|
|
3043
|
+
const aggregatedAgentsMdSources = agentSources.map(({ componentKey, filePath }) => `${componentKey}/${filePath}`).sort((a, b) => a.localeCompare(b));
|
|
3084
3044
|
return { aggregatedAgentsMdSources, agentsMd, skillsMap };
|
|
3085
3045
|
}
|
|
3086
3046
|
async function writeAggregatedArtifacts(plan, git, manifest, agentsMd, skillsMap) {
|
|
@@ -3099,10 +3059,24 @@ async function finalizeRunRoot(plan, git, entries, errors) {
|
|
|
3099
3059
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
3100
3060
|
components: entries
|
|
3101
3061
|
};
|
|
3062
|
+
const submoduleWarnings = [];
|
|
3063
|
+
if (plan.submodules && errors.length === 0) {
|
|
3064
|
+
for (const { key } of entries) {
|
|
3065
|
+
const dir = componentDir(plan.workspaceRoot, key);
|
|
3066
|
+
const warning = await git.prepareSubmodules(key, dir, plan.submodules.signal);
|
|
3067
|
+
if (warning) submoduleWarnings.push(warning);
|
|
3068
|
+
}
|
|
3069
|
+
}
|
|
3102
3070
|
const { aggregatedAgentsMdSources, agentsMd, skillsMap } = await gatherAgentsAndSkills(plan, git);
|
|
3071
|
+
const instructions = submoduleWarnings.length ? `${agentsMd}
|
|
3072
|
+
|
|
3073
|
+
## Workspace preparation warnings
|
|
3074
|
+
|
|
3075
|
+
${submoduleWarnings.map((warning) => `- ${warning}`).join("\n")}
|
|
3076
|
+
` : agentsMd;
|
|
3103
3077
|
const loadedSkills = [...skillsMap.keys()].sort((a, b) => a.localeCompare(b));
|
|
3104
3078
|
try {
|
|
3105
|
-
await writeAggregatedArtifacts(plan, git, manifest,
|
|
3079
|
+
await writeAggregatedArtifacts(plan, git, manifest, instructions, skillsMap);
|
|
3106
3080
|
} catch (e) {
|
|
3107
3081
|
errors.push(`write: ${e instanceof Error ? e.message : String(e)}`);
|
|
3108
3082
|
}
|
|
@@ -3114,82 +3088,45 @@ async function finalizeRunRoot(plan, git, entries, errors) {
|
|
|
3114
3088
|
return {
|
|
3115
3089
|
manifest,
|
|
3116
3090
|
aggregatedAgentsMdSources,
|
|
3117
|
-
loadedSkills
|
|
3091
|
+
loadedSkills,
|
|
3092
|
+
...submoduleWarnings.length ? { submoduleWarnings } : {}
|
|
3118
3093
|
};
|
|
3119
3094
|
}
|
|
3120
|
-
async function materializeRunRoot(plan, git) {
|
|
3121
|
-
const errors = [];
|
|
3122
|
-
const entries = await collectMaterializedEntries(plan, git, errors);
|
|
3123
|
-
return finalizeRunRoot(plan, git, entries, errors);
|
|
3124
|
-
}
|
|
3125
3095
|
async function prepareOnDemandRunRoot(plan, git, projectKey, revision) {
|
|
3126
3096
|
if (revision !== void 0 && (!projectKey || !/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(revision)))
|
|
3127
3097
|
throw new Error("Use a captured full commit SHA");
|
|
3128
3098
|
if (projectKey !== void 0 && !plan.components.some((component) => component.key === projectKey))
|
|
3129
3099
|
throw new Error("Repository is outside this process's authorized scope");
|
|
3130
|
-
const
|
|
3131
|
-
const existingKeys = new Set(
|
|
3132
|
-
validation.existingManifest?.components.map((component) => component.key) ?? []
|
|
3133
|
-
);
|
|
3100
|
+
const existing = await readManifestEntries(plan.workspaceRoot, git);
|
|
3134
3101
|
const selected = {
|
|
3135
3102
|
...plan,
|
|
3136
3103
|
components: plan.components.filter(
|
|
3137
|
-
(component) =>
|
|
3104
|
+
(component) => existing.has(component.key) || component.key === projectKey
|
|
3138
3105
|
)
|
|
3139
3106
|
};
|
|
3140
|
-
const
|
|
3141
|
-
|
|
3142
|
-
if (!git.checkoutRevision) throw new Error("Pinned repository checkout is unavailable");
|
|
3143
|
-
const dir = componentDir(plan.workspaceRoot, projectKey);
|
|
3144
|
-
await git.checkoutRevision(dir, revision);
|
|
3145
|
-
const headSha = await git.getHeadSha(dir);
|
|
3146
|
-
if (headSha.toLowerCase() !== revision.toLowerCase())
|
|
3147
|
-
throw new Error("Checkout HEAD does not match captured commit");
|
|
3148
|
-
return finalizeRunRoot(
|
|
3149
|
-
selected,
|
|
3150
|
-
git,
|
|
3151
|
-
result.manifest.components.map(
|
|
3152
|
-
(entry) => entry.key === projectKey ? { ...entry, headSha, revision } : entry
|
|
3153
|
-
),
|
|
3154
|
-
[]
|
|
3155
|
-
);
|
|
3156
|
-
}
|
|
3157
|
-
return result;
|
|
3107
|
+
const pin = projectKey && revision ? { projectKey, revision } : void 0;
|
|
3108
|
+
return materializeSelection(selected, git, existing, pin);
|
|
3158
3109
|
}
|
|
3159
|
-
async function
|
|
3110
|
+
async function readManifestEntries(workspaceRoot, git) {
|
|
3160
3111
|
const raw = await git.readFile(workspaceRoot, MANIFEST_REL);
|
|
3161
3112
|
const parsed = raw === null ? null : deserializeManifest(raw);
|
|
3162
|
-
|
|
3163
|
-
return {
|
|
3164
|
-
valid: false,
|
|
3165
|
-
diff: {
|
|
3166
|
-
stale: [],
|
|
3167
|
-
missing: serverProjects.map((p) => p.key),
|
|
3168
|
-
extra: [],
|
|
3169
|
-
unchanged: []
|
|
3170
|
-
},
|
|
3171
|
-
existingManifest: null
|
|
3172
|
-
};
|
|
3173
|
-
}
|
|
3174
|
-
const diff = diffManifest(parsed.manifest, serverProjects);
|
|
3175
|
-
const valid = diff.stale.length === 0 && diff.missing.length === 0 && diff.extra.length === 0;
|
|
3176
|
-
return {
|
|
3177
|
-
valid,
|
|
3178
|
-
diff,
|
|
3179
|
-
existingManifest: parsed.manifest
|
|
3180
|
-
};
|
|
3113
|
+
return new Map(parsed?.ok ? parsed.manifest.components.map((entry) => [entry.key, entry]) : []);
|
|
3181
3114
|
}
|
|
3182
|
-
async function
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3115
|
+
async function materializeRunRoot(plan, git, resume = false) {
|
|
3116
|
+
return materializeSelection(
|
|
3117
|
+
plan,
|
|
3118
|
+
git,
|
|
3119
|
+
resume ? await readManifestEntries(plan.workspaceRoot, git) : void 0
|
|
3186
3120
|
);
|
|
3187
|
-
|
|
3188
|
-
|
|
3121
|
+
}
|
|
3122
|
+
async function materializeSelection(plan, git, existing, pin) {
|
|
3123
|
+
const errors = [];
|
|
3124
|
+
const entries = await collectMaterializedEntries(plan, git, errors, existing, pin);
|
|
3125
|
+
return finalizeRunRoot(plan, git, entries, errors);
|
|
3189
3126
|
}
|
|
3190
3127
|
|
|
3191
3128
|
// src/workspace/checkout-tool.ts
|
|
3192
|
-
function createCheckoutTool(workspaceRoot, instanceId, projects, git) {
|
|
3129
|
+
function createCheckoutTool(workspaceRoot, instanceId, projects, git, submodules) {
|
|
3193
3130
|
return {
|
|
3194
3131
|
name: "checkout_repository",
|
|
3195
3132
|
description: "Materialize a full clone for one authorized project and return its checked-out revision. Repeated calls reuse the checkout. Inspect only; do not publish changes.",
|
|
@@ -3208,7 +3145,7 @@ function createCheckoutTool(workspaceRoot, instanceId, projects, git) {
|
|
|
3208
3145
|
executionMode: "sequential",
|
|
3209
3146
|
async execute(args) {
|
|
3210
3147
|
if (typeof args.projectKey !== "string") throw new Error("projectKey is required");
|
|
3211
|
-
if (args.revision !== void 0 &&
|
|
3148
|
+
if (args.revision !== void 0 && typeof args.revision !== "string")
|
|
3212
3149
|
throw new Error("Use a captured full commit SHA");
|
|
3213
3150
|
const plan = planRunRoot(
|
|
3214
3151
|
workspaceRoot,
|
|
@@ -3218,14 +3155,10 @@ function createCheckoutTool(workspaceRoot, instanceId, projects, git) {
|
|
|
3218
3155
|
repoLocator: project.repoLocator,
|
|
3219
3156
|
baseBranch: project.baseBranch,
|
|
3220
3157
|
workBranch: project.workBranch || project.baseBranch
|
|
3221
|
-
}))
|
|
3222
|
-
|
|
3223
|
-
const result = await prepareOnDemandRunRoot(
|
|
3224
|
-
plan,
|
|
3225
|
-
git,
|
|
3226
|
-
args.projectKey,
|
|
3227
|
-
args.revision
|
|
3158
|
+
})),
|
|
3159
|
+
submodules
|
|
3228
3160
|
);
|
|
3161
|
+
const result = await prepareOnDemandRunRoot(plan, git, args.projectKey, args.revision);
|
|
3229
3162
|
const entry = result.manifest.components.find(
|
|
3230
3163
|
(component) => component.key === args.projectKey
|
|
3231
3164
|
);
|
|
@@ -3233,8 +3166,9 @@ function createCheckoutTool(workspaceRoot, instanceId, projects, git) {
|
|
|
3233
3166
|
const repositoryPath = path6.join(workspaceRoot, entry.key);
|
|
3234
3167
|
return {
|
|
3235
3168
|
...entry,
|
|
3236
|
-
headSha: await git.getHeadSha(repositoryPath),
|
|
3169
|
+
headSha: entry.revision ? entry.headSha : await git.getHeadSha(repositoryPath),
|
|
3237
3170
|
path: repositoryPath,
|
|
3171
|
+
...result.submoduleWarnings ? { warnings: result.submoduleWarnings } : {},
|
|
3238
3172
|
instructions: "Read this repository's AGENTS.md before inspection; revalidate any wiki guidance against this revision. This checkout is retained, not automatically updated to the remote head."
|
|
3239
3173
|
};
|
|
3240
3174
|
}
|
|
@@ -4147,13 +4081,16 @@ async function bootstrapWorkerRuntime(deps) {
|
|
|
4147
4081
|
baseBranch: project.baseBranch,
|
|
4148
4082
|
workBranch: project.workBranch ?? ""
|
|
4149
4083
|
}));
|
|
4150
|
-
const plan = planRunRoot(
|
|
4084
|
+
const plan = planRunRoot(
|
|
4085
|
+
workspaceRoot,
|
|
4086
|
+
deps.instanceId,
|
|
4087
|
+
runRootProjects,
|
|
4088
|
+
resolvedWorkerProcess?.runtime?.repositorySubmodules === "best_effort" ? { signal: deps.toolPreparationSignal } : void 0
|
|
4089
|
+
);
|
|
4151
4090
|
const runRootPreparation = resolvedWorkerProcess?.runtime?.repositoryCheckout === "none" ? mkdir5(workspaceRoot, { recursive: true }).then(() => ({
|
|
4152
4091
|
aggregatedAgentsMdSources: [],
|
|
4153
4092
|
loadedSkills: []
|
|
4154
|
-
})) : resolvedWorkerProcess?.runtime?.repositoryCheckout === "on_demand" ? prepareOnDemandRunRoot(plan, deps.gitOps) :
|
|
4155
|
-
(validation) => repairRunRoot(validation, plan, deps.gitOps)
|
|
4156
|
-
) : materializeRunRoot(plan, deps.gitOps);
|
|
4093
|
+
})) : resolvedWorkerProcess?.runtime?.repositoryCheckout === "on_demand" ? prepareOnDemandRunRoot(plan, deps.gitOps) : materializeRunRoot(plan, deps.gitOps, deps.payload.resume);
|
|
4157
4094
|
const resolvedPiConfig = llmPayload ? resolveProcessPiConfig({
|
|
4158
4095
|
processId,
|
|
4159
4096
|
processPiConfig: resolvedWorkerProcess?.piConfig,
|
|
@@ -4175,6 +4112,7 @@ async function bootstrapWorkerRuntime(deps) {
|
|
|
4175
4112
|
let loadedSkillFiles = [];
|
|
4176
4113
|
let receipt;
|
|
4177
4114
|
const runRoot = await runRootPreparation;
|
|
4115
|
+
if ("submoduleWarnings" in runRoot) diagnostics.push(...runRoot.submoduleWarnings ?? []);
|
|
4178
4116
|
let preparedTools;
|
|
4179
4117
|
if (resolvedWorkerProcess?.runtime?.developmentTools) {
|
|
4180
4118
|
if (!deps.payload.developmentTools) {
|
|
@@ -8167,7 +8105,8 @@ function createWorkerRuntime(options) {
|
|
|
8167
8105
|
command.session.workspaceRoot,
|
|
8168
8106
|
command.session.processSnapshot.id,
|
|
8169
8107
|
command.session.projectSnapshots,
|
|
8170
|
-
adapters.gitOps
|
|
8108
|
+
adapters.gitOps,
|
|
8109
|
+
command.session.resolvedWorkerProcess.runtime?.repositorySubmodules === "best_effort" ? { signal } : void 0
|
|
8171
8110
|
)
|
|
8172
8111
|
] : []
|
|
8173
8112
|
],
|
|
@@ -8939,6 +8878,7 @@ import path13 from "path";
|
|
|
8939
8878
|
import {
|
|
8940
8879
|
clearRepositoryGitHttpsHelpers,
|
|
8941
8880
|
clearRepositoryGitSshWrappers,
|
|
8881
|
+
prepareRepositorySubmodules,
|
|
8942
8882
|
repositoryGitArgs,
|
|
8943
8883
|
repositoryGitSubprocessEnv,
|
|
8944
8884
|
repositoryHttpsUrl as repositoryHttpsUrl2,
|
|
@@ -9035,13 +8975,24 @@ exec ssh -F /dev/null -o IdentitiesOnly=yes -o IdentityFile="${key}" -o UserKnow
|
|
|
9035
8975
|
path13.basename(absoluteTargetDir)
|
|
9036
8976
|
);
|
|
9037
8977
|
}
|
|
8978
|
+
prepareSubmodules = prepareRepositorySubmodules;
|
|
9038
8979
|
async checkout(repoDir, branch) {
|
|
9039
|
-
await this.runGit(["checkout", branch], repoDir);
|
|
8980
|
+
await this.runGit(["checkout", "--no-recurse-submodules", branch], repoDir);
|
|
9040
8981
|
}
|
|
9041
|
-
async checkoutRevision(repoDir, revision) {
|
|
8982
|
+
async checkoutRevision(repoDir, revision, preserveSubmodules = false) {
|
|
9042
8983
|
if (!/^(?:[a-f0-9]{40}|[a-f0-9]{64})$/i.test(revision))
|
|
9043
8984
|
throw new Error("Use a captured full commit SHA");
|
|
9044
|
-
|
|
8985
|
+
const status = await this.runGit(
|
|
8986
|
+
[
|
|
8987
|
+
"status",
|
|
8988
|
+
"--porcelain",
|
|
8989
|
+
"--untracked-files=all",
|
|
8990
|
+
...preserveSubmodules ? ["--ignore-submodules=all"] : []
|
|
8991
|
+
],
|
|
8992
|
+
repoDir
|
|
8993
|
+
);
|
|
8994
|
+
const staged = preserveSubmodules ? await this.runGit(["diff", "--cached", "--name-only", "--ignore-submodules=none"], repoDir) : "";
|
|
8995
|
+
if (status.trim() || staged.trim())
|
|
9045
8996
|
throw new Error(
|
|
9046
8997
|
"Repository has local changes; preserve or remove them before retrying inspection"
|
|
9047
8998
|
);
|
|
@@ -9050,9 +9001,11 @@ exec ssh -F /dev/null -o IdentitiesOnly=yes -o IdentityFile="${key}" -o UserKnow
|
|
|
9050
9001
|
} catch {
|
|
9051
9002
|
await this.runGit(["fetch", "origin", revision], repoDir, path13.basename(repoDir));
|
|
9052
9003
|
}
|
|
9053
|
-
await this.runGit(["checkout", "--detach", revision], repoDir);
|
|
9054
|
-
|
|
9004
|
+
await this.runGit(["checkout", "--no-recurse-submodules", "--detach", revision], repoDir);
|
|
9005
|
+
const head = await this.getHeadSha(repoDir);
|
|
9006
|
+
if (head.toLowerCase() !== revision.toLowerCase())
|
|
9055
9007
|
throw new Error("Checkout HEAD does not match captured commit");
|
|
9008
|
+
return head;
|
|
9056
9009
|
}
|
|
9057
9010
|
async createBranch(repoDir, branchName, startPoint) {
|
|
9058
9011
|
await this.runGit(["branch", branchName, startPoint], repoDir);
|
|
@@ -9071,17 +9024,15 @@ exec ssh -F /dev/null -o IdentitiesOnly=yes -o IdentityFile="${key}" -o UserKnow
|
|
|
9071
9024
|
async getHeadSha(repoDir) {
|
|
9072
9025
|
return (await this.runGit(["rev-parse", "HEAD"], repoDir)).trim();
|
|
9073
9026
|
}
|
|
9074
|
-
async listFiles(repoDir,
|
|
9075
|
-
const
|
|
9076
|
-
if (!existsSync4(
|
|
9077
|
-
|
|
9078
|
-
|
|
9079
|
-
|
|
9080
|
-
|
|
9081
|
-
|
|
9082
|
-
|
|
9083
|
-
ignore: ["**/.git/**"]
|
|
9084
|
-
})).sort((a, b) => a.localeCompare(b));
|
|
9027
|
+
async listFiles(repoDir, patterns, excludeSubmodules = false) {
|
|
9028
|
+
const cwd = path13.resolve(repoDir);
|
|
9029
|
+
if (!existsSync4(cwd)) return [];
|
|
9030
|
+
const files = await fg(patterns, { cwd, dot: true, onlyFiles: true, ignore: ["**/.git/**"] });
|
|
9031
|
+
const index = excludeSubmodules ? await this.runGit(["ls-files", "--stage", "-z"], cwd) : "";
|
|
9032
|
+
const gitlinks = index.split("\0").flatMap(
|
|
9033
|
+
(entry) => entry.startsWith("160000 ") ? [`${entry.slice(entry.indexOf(" ") + 1)}/`] : []
|
|
9034
|
+
);
|
|
9035
|
+
return files.filter((file) => !gitlinks.some((link) => file.startsWith(link))).sort((a, b) => a.localeCompare(b));
|
|
9085
9036
|
}
|
|
9086
9037
|
};
|
|
9087
9038
|
var HTTPS_CREDENTIAL_HELPER = `const fs = require('node:fs');
|
|
@@ -9253,4 +9204,4 @@ export {
|
|
|
9253
9204
|
createWorkerRuntime,
|
|
9254
9205
|
createWorkerEntryRuntime
|
|
9255
9206
|
};
|
|
9256
|
-
//# sourceMappingURL=chunk-
|
|
9207
|
+
//# sourceMappingURL=chunk-CY5MQV4X.js.map
|