@leitwerk-dev/coding 0.5.10 → 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.
Files changed (32) hide show
  1. package/README.md +1 -0
  2. package/dist/{chunk-JL53OV5M.js → chunk-5M3DTAVU.js} +25 -9
  3. package/dist/chunk-5M3DTAVU.js.map +1 -0
  4. package/dist/{chunk-E3DB4TIZ.js → chunk-DVQWH5SN.js} +22 -2
  5. package/dist/chunk-DVQWH5SN.js.map +1 -0
  6. package/dist/{chunk-VG6XF3OK.js → chunk-GIWVCTYT.js} +20 -14
  7. package/dist/chunk-GIWVCTYT.js.map +1 -0
  8. package/dist/finalization-git-internal.d.ts +2 -0
  9. package/dist/finalization-git-internal.d.ts.map +1 -1
  10. package/dist/finalization-git.js +2 -2
  11. package/dist/index.js +2 -2
  12. package/dist/{repository-change-launch-internal-CP2jJJCR.d.ts → repository-change-launch-internal-D_QWCQAN.d.ts} +1 -1
  13. package/dist/{repository-change-process-DbcnkzLw.d.ts → repository-change-process-Dc-jsbCL.d.ts} +2 -0
  14. package/dist/repository-change-process.d.ts +2 -0
  15. package/dist/repository-change-process.d.ts.map +1 -1
  16. package/dist/repository-change-publication.d.ts +4 -0
  17. package/dist/repository-change-publication.d.ts.map +1 -1
  18. package/dist/repository-change-publication.js +41 -33
  19. package/dist/repository-change-publication.js.map +1 -1
  20. package/dist/repository-reconciliation.d.ts +15 -13
  21. package/dist/repository-reconciliation.d.ts.map +1 -1
  22. package/dist/submodule-staging.d.ts +11 -0
  23. package/dist/submodule-staging.d.ts.map +1 -0
  24. package/package.json +5 -5
  25. package/src/finalization-git-internal.ts +19 -17
  26. package/src/repository-change-process.ts +24 -6
  27. package/src/repository-change-publication.ts +41 -33
  28. package/src/repository-reconciliation.ts +17 -27
  29. package/src/submodule-staging.ts +27 -0
  30. package/dist/chunk-E3DB4TIZ.js.map +0 -1
  31. package/dist/chunk-JL53OV5M.js.map +0 -1
  32. package/dist/chunk-VG6XF3OK.js.map +0 -1
@@ -2,7 +2,7 @@ import {
2
2
  RemoteBranchChangedError,
3
3
  commitAndPushWorkBranch,
4
4
  repositoryHasChanges
5
- } from "./chunk-VG6XF3OK.js";
5
+ } from "./chunk-GIWVCTYT.js";
6
6
  import {
7
7
  assertReconciliationTargetSafe,
8
8
  createRepositoryChangeProcess,
@@ -11,19 +11,20 @@ import {
11
11
  recordRepositoryPublication,
12
12
  repositoryWorktreeIsDirty,
13
13
  retainConcurrentRebase
14
- } from "./chunk-JL53OV5M.js";
14
+ } from "./chunk-5M3DTAVU.js";
15
15
  import "./chunk-DNG7D77K.js";
16
16
  import "./chunk-ABQH2WZT.js";
17
17
  import "./chunk-PISZZXK4.js";
18
18
  import "./chunk-SKGB4CZS.js";
19
19
  import {
20
+ prepareSubmodules,
20
21
  pushWasRejected,
21
22
  readPublicationReceipt,
22
23
  readRepositoryBinding,
23
24
  repositoryBindingMatches,
24
25
  repositoryRecord,
25
26
  savePublicationReceipt
26
- } from "./chunk-E3DB4TIZ.js";
27
+ } from "./chunk-DVQWH5SN.js";
27
28
  import {
28
29
  conflictKey,
29
30
  validateConflict
@@ -779,7 +780,8 @@ function createRepositoryChangePublication(adapter) {
779
780
  workBranch: repo.workBranch,
780
781
  commitMessage,
781
782
  gitIdentity,
782
- expectedRemoteHead
783
+ expectedRemoteHead,
784
+ protectSubmodules: adapter.prepareSubmodules
783
785
  });
784
786
  }
785
787
  async function reconcile(ctx, current) {
@@ -790,7 +792,8 @@ function createRepositoryChangePublication(adapter) {
790
792
  workBranch: repo.workBranch,
791
793
  baseBranch: repo.baseBranch,
792
794
  baselineSha: current.workBaselineSha ?? current.headSha ?? void 0,
793
- gitIdentity: await adapter.identity(ctx)
795
+ gitIdentity: await adapter.identity(ctx),
796
+ protectSubmodules: adapter.prepareSubmodules
794
797
  });
795
798
  }
796
799
  const runRepository = async (ctx) => {
@@ -1097,24 +1100,6 @@ function createRepositoryChangePublication(adapter) {
1097
1100
  function repairReason(state, kind) {
1098
1101
  return kind === "feedback" && remote(state).repairReason === "rebase" ? "rebase" : kind;
1099
1102
  }
1100
- function revisionPrompt(kind) {
1101
- return (ctx) => {
1102
- const current = remote(ctx.state);
1103
- const repository = adapter.repositories ? `Repository: ${activeKey(ctx.state)}. Apply changes only to this checkout. ` : "";
1104
- if (asUnknownRecord(ctx.prepared)?.deferredRebase)
1105
- return `${repository}${reconciliationPrompt}
1106
- The source branch or retained local work must be reconciled before the target-branch repair. Resolve any source reconciliation, then use changes_ready. Delivery will restore and validate the result before reassessing current target conflicts.`;
1107
- if (current.reconciliationRequired)
1108
- return `${repository}${reconciliationPrompt}
1109
- Validate the reconciled repository, including any upstream target changes and retained local work, against the requested change and pending feedback: ${JSON.stringify(current.feedbackIds)}. Treat the current remote as authoritative; do not restore deliberately removed code simply to match an older plan. Use changes_ready after validation, even when no further edit is needed, so retained local changes are published. If blocked use cannot_repair.
1110
- Original request for context: ${ctx.prompts?.initial ?? "Inspect the current repository and retained request"}`;
1111
- if (repairReason(ctx.state, kind) === "rebase")
1112
- return `${rebasePrompt} Evidence: ${JSON.stringify(current.conflict)}. Call changes_ready or no_changes when verified complete, cannot_repair when blocked.`;
1113
- return `${adapter.repositories ? `Repository: ${activeKey(ctx.state)}. Apply changes only to this checkout. ` : ""}${adapter.prompt(kind, current)}
1114
-
1115
- ${reconciliationPrompt}`;
1116
- };
1117
- }
1118
1103
  function revisionTurn(id, kind) {
1119
1104
  const turn = flow.llm(id).description(kind === "feedback" ? "Address Feedback" : "Fix CI").waitFor(({ state }) => {
1120
1105
  const current = remote(state);
@@ -1124,9 +1109,13 @@ ${reconciliationPrompt}`;
1124
1109
  ).prepare(async (ctx) => {
1125
1110
  const project = ctx.repo.get(activeKey(ctx.state) ?? "repo");
1126
1111
  const current = remote(ctx.state);
1112
+ const prepareDependencies = () => adapter.prepareSubmodules ? prepareSubmodules(project, ctx) : void 0;
1113
+ const prepareRebase2 = async () => {
1114
+ startRebase(rebaseInput(ctx));
1115
+ return { deferredRebase: false, submoduleWarning: await prepareDependencies() };
1116
+ };
1127
1117
  const targetRebase = repairReason(ctx.state, kind) === "rebase" && !current.reconciliationRequired;
1128
- if (targetRebase && hasPreparedRebase(rebaseInput(ctx)))
1129
- return { rebase: startRebase(rebaseInput(ctx)) };
1118
+ if (targetRebase && hasPreparedRebase(rebaseInput(ctx))) return prepareRebase2();
1130
1119
  const report = (label, status) => ctx.reportProgress({
1131
1120
  title: "Repository reconciliation",
1132
1121
  steps: [{ id: "reconcile_source", label, status }]
@@ -1136,13 +1125,30 @@ ${reconciliationPrompt}`;
1136
1125
  if (reconciliation.status === "conflicts")
1137
1126
  report("Resolve reconciliation conflicts", "in_progress");
1138
1127
  else report("Repository reconciled", "completed");
1139
- if (targetRebase) {
1140
- if (reconciliation.status !== "unchanged" || reconciliation.headSha !== current.conflict?.headSha || repositoryWorktreeIsDirty({ projectKey: project.key, repoPath: project.fsPath }))
1141
- return { reconciliation, deferredRebase: true };
1142
- return { rebase: startRebase(rebaseInput(ctx)) };
1143
- }
1144
- return { reconciliation };
1145
- }).freshPrimary().prompt(revisionPrompt(kind));
1128
+ if (targetRebase && reconciliation.status === "unchanged" && reconciliation.headSha === current.conflict?.headSha && !repositoryWorktreeIsDirty({ projectKey: project.key, repoPath: project.fsPath }))
1129
+ return prepareRebase2();
1130
+ return {
1131
+ deferredRebase: targetRebase,
1132
+ submoduleWarning: reconciliation.status !== "conflicts" ? await prepareDependencies() : void 0
1133
+ };
1134
+ }).freshPrimary().buildPrompt((ctx) => {
1135
+ const current = remote(ctx.state);
1136
+ const repository = adapter.repositories ? `Repository: ${activeKey(ctx.state)}. Apply changes only to this checkout. ` : "";
1137
+ let prompt;
1138
+ if (ctx.prepared?.deferredRebase)
1139
+ prompt = `${repository}${reconciliationPrompt}
1140
+ The source branch or retained local work must be reconciled before the target-branch repair. Resolve any source reconciliation, then use changes_ready. Delivery will restore and validate the result before reassessing current target conflicts.`;
1141
+ else if (current.reconciliationRequired)
1142
+ prompt = `${repository}${reconciliationPrompt}
1143
+ Validate the reconciled repository, including any upstream target changes and retained local work, against the requested change and pending feedback: ${JSON.stringify(current.feedbackIds)}. Treat the current remote as authoritative; do not restore deliberately removed code simply to match an older plan. Use changes_ready after validation, even when no further edit is needed, so retained local changes are published. If blocked use cannot_repair.
1144
+ Original request for context: ${ctx.prompts.initial || "Inspect the current repository and retained request"}`;
1145
+ else if (repairReason(ctx.state, kind) === "rebase")
1146
+ prompt = `${rebasePrompt} Evidence: ${JSON.stringify(current.conflict)}. Call changes_ready or no_changes when verified complete, cannot_repair when blocked.`;
1147
+ else prompt = `${repository}${adapter.prompt(kind, current)}
1148
+
1149
+ ${reconciliationPrompt}`;
1150
+ return [prompt, ctx.prepared?.submoduleWarning].filter(Boolean).join("\n\n");
1151
+ });
1146
1152
  for (const [name, description] of [
1147
1153
  ["changes_ready", "Repository changes are ready to publish"],
1148
1154
  ["no_changes", "No repository change is required"]
@@ -1227,7 +1233,9 @@ ${reconciliationPrompt}`;
1227
1233
  /** @public */
1228
1234
  fragment: publication,
1229
1235
  /** @public */
1230
- happyPath: [ids.deliver]
1236
+ happyPath: [ids.deliver],
1237
+ /** @internal */
1238
+ prepareSubmodules: adapter.prepareSubmodules
1231
1239
  };
1232
1240
  }
1233
1241
  export {