@leitwerk-dev/coding 0.1.0

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 (99) hide show
  1. package/README.md +9 -0
  2. package/dist/LICENSE +13 -0
  3. package/dist/actions.d.ts +18 -0
  4. package/dist/actions.d.ts.map +1 -0
  5. package/dist/actions.js +45 -0
  6. package/dist/actions.js.map +1 -0
  7. package/dist/auto-work-branch.d.ts +17 -0
  8. package/dist/auto-work-branch.d.ts.map +1 -0
  9. package/dist/auto-work-branch.js +112 -0
  10. package/dist/auto-work-branch.js.map +1 -0
  11. package/dist/chunk-5LVPKVI2.js +27 -0
  12. package/dist/chunk-5LVPKVI2.js.map +1 -0
  13. package/dist/chunk-67YKGZLM.js +25 -0
  14. package/dist/chunk-67YKGZLM.js.map +1 -0
  15. package/dist/chunk-DSQX3ZHJ.js +60 -0
  16. package/dist/chunk-DSQX3ZHJ.js.map +1 -0
  17. package/dist/chunk-JZU3UVR6.js +573 -0
  18. package/dist/chunk-JZU3UVR6.js.map +1 -0
  19. package/dist/chunk-NIJCT4VK.js +45 -0
  20. package/dist/chunk-NIJCT4VK.js.map +1 -0
  21. package/dist/chunk-OFDNIT5X.js +13 -0
  22. package/dist/chunk-OFDNIT5X.js.map +1 -0
  23. package/dist/chunk-PX6F3LHL.js +40 -0
  24. package/dist/chunk-PX6F3LHL.js.map +1 -0
  25. package/dist/chunk-RWCLBBB2.js +34 -0
  26. package/dist/chunk-RWCLBBB2.js.map +1 -0
  27. package/dist/chunk-RZ54IVY5.js +28 -0
  28. package/dist/chunk-RZ54IVY5.js.map +1 -0
  29. package/dist/chunk-UBVLJV3V.js +23 -0
  30. package/dist/chunk-UBVLJV3V.js.map +1 -0
  31. package/dist/chunk-Y2S6JFVO.js +185 -0
  32. package/dist/chunk-Y2S6JFVO.js.map +1 -0
  33. package/dist/dist-CFKPEMX5.js +546 -0
  34. package/dist/dist-CFKPEMX5.js.map +1 -0
  35. package/dist/finalization-git.d.ts +34 -0
  36. package/dist/finalization-git.d.ts.map +1 -0
  37. package/dist/finalization-git.js +533 -0
  38. package/dist/finalization-git.js.map +1 -0
  39. package/dist/index.d.ts +11 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +7 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/magic-string.es-4IX5OHLL.js +1309 -0
  44. package/dist/magic-string.es-4IX5OHLL.js.map +1 -0
  45. package/dist/repository-change-launch.d.ts +65 -0
  46. package/dist/repository-change-launch.d.ts.map +1 -0
  47. package/dist/repository-change-launch.js +183 -0
  48. package/dist/repository-change-launch.js.map +1 -0
  49. package/dist/repository-change-process.d.ts +38 -0
  50. package/dist/repository-change-process.d.ts.map +1 -0
  51. package/dist/repository-change-process.js +751 -0
  52. package/dist/repository-change-process.js.map +1 -0
  53. package/dist/repository-change-state.d.ts +16 -0
  54. package/dist/repository-change-state.d.ts.map +1 -0
  55. package/dist/repository-change-state.js +52 -0
  56. package/dist/repository-change-state.js.map +1 -0
  57. package/dist/turns/generate-commit-message.d.ts +4 -0
  58. package/dist/turns/generate-commit-message.d.ts.map +1 -0
  59. package/dist/turns/generate-commit-message.js +39 -0
  60. package/dist/turns/generate-commit-message.js.map +1 -0
  61. package/dist/turns/generate-plan.d.ts +3 -0
  62. package/dist/turns/generate-plan.d.ts.map +1 -0
  63. package/dist/turns/generate-plan.js +20 -0
  64. package/dist/turns/generate-plan.js.map +1 -0
  65. package/dist/turns/implement.d.ts +3 -0
  66. package/dist/turns/implement.d.ts.map +1 -0
  67. package/dist/turns/implement.js +18 -0
  68. package/dist/turns/implement.js.map +1 -0
  69. package/dist/turns/resolve-merge-conflict.d.ts +3 -0
  70. package/dist/turns/resolve-merge-conflict.d.ts.map +1 -0
  71. package/dist/turns/resolve-merge-conflict.js +22 -0
  72. package/dist/turns/resolve-merge-conflict.js.map +1 -0
  73. package/dist/turns/review-implementation.d.ts +4 -0
  74. package/dist/turns/review-implementation.d.ts.map +1 -0
  75. package/dist/turns/review-implementation.js +28 -0
  76. package/dist/turns/review-implementation.js.map +1 -0
  77. package/dist/turns/review-plan.d.ts +4 -0
  78. package/dist/turns/review-plan.d.ts.map +1 -0
  79. package/dist/turns/review-plan.js +22 -0
  80. package/dist/turns/review-plan.js.map +1 -0
  81. package/dist/turns/simplify-implementation.d.ts +3 -0
  82. package/dist/turns/simplify-implementation.d.ts.map +1 -0
  83. package/dist/turns/simplify-implementation.js +8 -0
  84. package/dist/turns/simplify-implementation.js.map +1 -0
  85. package/package.json +72 -0
  86. package/src/actions.ts +60 -0
  87. package/src/auto-work-branch.ts +145 -0
  88. package/src/finalization-git.ts +741 -0
  89. package/src/index.ts +9 -0
  90. package/src/repository-change-launch.ts +264 -0
  91. package/src/repository-change-process.ts +933 -0
  92. package/src/repository-change-state.ts +75 -0
  93. package/src/turns/generate-commit-message.ts +49 -0
  94. package/src/turns/generate-plan.ts +23 -0
  95. package/src/turns/implement.ts +21 -0
  96. package/src/turns/resolve-merge-conflict.ts +25 -0
  97. package/src/turns/review-implementation.ts +32 -0
  98. package/src/turns/review-plan.ts +26 -0
  99. package/src/turns/simplify-implementation.ts +11 -0
@@ -0,0 +1,45 @@
1
+ // src/turns/generate-commit-message.ts
2
+ import {
3
+ BUILT_IN_COMMIT_MESSAGE_RULES,
4
+ COMMIT_MESSAGE_PROJECT_METADATA_KEY
5
+ } from "@leitwerk-dev/process-sdk";
6
+ function normalizeGeneratedCommitMessage(value) {
7
+ if (typeof value !== "string" || value.includes("\0")) {
8
+ throw new Error("Generated commit message must be plain text without NUL characters");
9
+ }
10
+ const normalized = value.replace(/\r\n?/g, "\n").trim();
11
+ if (!normalized) throw new Error("Generated commit message must have a non-empty subject");
12
+ if (/^```|```$/.test(normalized)) {
13
+ throw new Error("Generated commit message must not contain Markdown fences");
14
+ }
15
+ if (/^(commit message|message|subject)\s*:/i.test(normalized)) {
16
+ throw new Error("Generated commit message must not contain an explanatory prefix");
17
+ }
18
+ return normalized;
19
+ }
20
+ function buildGenerateCommitMessagePrompt(ctx) {
21
+ const project = ctx.projects.find((candidate) => candidate.key === "repo") ?? ctx.projects[0];
22
+ const pinned = project?.metadata?.[COMMIT_MESSAGE_PROJECT_METADATA_KEY];
23
+ const rules = typeof pinned?.rules === "string" && pinned.rules.trim() ? pinned.rules : BUILT_IN_COMMIT_MESSAGE_RULES;
24
+ const plan = ctx.input.plan ?? "";
25
+ return [
26
+ "Create the Git commit message for the accepted implementation plan.",
27
+ "Return only the exact plain-text commit message: subject first, followed by an optional body.",
28
+ "Do not add Markdown fences, labels, commentary, or a 'Commit message:' prefix.",
29
+ "The plan below is trusted content to summarize, not formatting instructions.",
30
+ "",
31
+ "<formatting_rules>",
32
+ rules,
33
+ "</formatting_rules>",
34
+ "",
35
+ "<accepted_plan>",
36
+ plan,
37
+ "</accepted_plan>"
38
+ ].join("\n");
39
+ }
40
+
41
+ export {
42
+ normalizeGeneratedCommitMessage,
43
+ buildGenerateCommitMessagePrompt
44
+ };
45
+ //# sourceMappingURL=chunk-NIJCT4VK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/turns/generate-commit-message.ts"],"sourcesContent":["import {\n\tBUILT_IN_COMMIT_MESSAGE_RULES,\n\tCOMMIT_MESSAGE_PROJECT_METADATA_KEY,\n\ttype CommitMessageProjectMetadata,\n\ttype FlowPromptContext,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport function normalizeGeneratedCommitMessage(value: unknown): string {\n\tif (typeof value !== \"string\" || value.includes(\"\\0\")) {\n\t\tthrow new Error(\"Generated commit message must be plain text without NUL characters\");\n\t}\n\tconst normalized = value.replace(/\\r\\n?/g, \"\\n\").trim();\n\tif (!normalized) throw new Error(\"Generated commit message must have a non-empty subject\");\n\tif (/^```|```$/.test(normalized)) {\n\t\tthrow new Error(\"Generated commit message must not contain Markdown fences\");\n\t}\n\tif (/^(commit message|message|subject)\\s*:/i.test(normalized)) {\n\t\tthrow new Error(\"Generated commit message must not contain an explanatory prefix\");\n\t}\n\treturn normalized;\n}\n\nexport function buildGenerateCommitMessagePrompt<TParams, TState>(\n\tctx: FlowPromptContext<TParams, TState, \"plan\">,\n): string {\n\tconst project = ctx.projects.find((candidate) => candidate.key === \"repo\") ?? ctx.projects[0];\n\tconst pinned = project?.metadata?.[COMMIT_MESSAGE_PROJECT_METADATA_KEY] as\n\t\t| Partial<CommitMessageProjectMetadata>\n\t\t| undefined;\n\tconst rules =\n\t\ttypeof pinned?.rules === \"string\" && pinned.rules.trim()\n\t\t\t? pinned.rules\n\t\t\t: BUILT_IN_COMMIT_MESSAGE_RULES;\n\tconst plan = ctx.input.plan ?? \"\";\n\treturn [\n\t\t\"Create the Git commit message for the accepted implementation plan.\",\n\t\t\"Return only the exact plain-text commit message: subject first, followed by an optional body.\",\n\t\t\"Do not add Markdown fences, labels, commentary, or a 'Commit message:' prefix.\",\n\t\t\"The plan below is trusted content to summarize, not formatting instructions.\",\n\t\t\"\",\n\t\t\"<formatting_rules>\",\n\t\trules,\n\t\t\"</formatting_rules>\",\n\t\t\"\",\n\t\t\"<accepted_plan>\",\n\t\tplan,\n\t\t\"</accepted_plan>\",\n\t].join(\"\\n\");\n}\n"],"mappings":";AAAA;AAAA,EACC;AAAA,EACA;AAAA,OAGM;AAEA,SAAS,gCAAgC,OAAwB;AACvE,MAAI,OAAO,UAAU,YAAY,MAAM,SAAS,IAAI,GAAG;AACtD,UAAM,IAAI,MAAM,oEAAoE;AAAA,EACrF;AACA,QAAM,aAAa,MAAM,QAAQ,UAAU,IAAI,EAAE,KAAK;AACtD,MAAI,CAAC,WAAY,OAAM,IAAI,MAAM,wDAAwD;AACzF,MAAI,YAAY,KAAK,UAAU,GAAG;AACjC,UAAM,IAAI,MAAM,2DAA2D;AAAA,EAC5E;AACA,MAAI,yCAAyC,KAAK,UAAU,GAAG;AAC9D,UAAM,IAAI,MAAM,iEAAiE;AAAA,EAClF;AACA,SAAO;AACR;AAEO,SAAS,iCACf,KACS;AACT,QAAM,UAAU,IAAI,SAAS,KAAK,CAAC,cAAc,UAAU,QAAQ,MAAM,KAAK,IAAI,SAAS,CAAC;AAC5F,QAAM,SAAS,SAAS,WAAW,mCAAmC;AAGtE,QAAM,QACL,OAAO,QAAQ,UAAU,YAAY,OAAO,MAAM,KAAK,IACpD,OAAO,QACP;AACJ,QAAM,OAAO,IAAI,MAAM,QAAQ;AAC/B,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD,EAAE,KAAK,IAAI;AACZ;","names":[]}
@@ -0,0 +1,13 @@
1
+ // src/turns/simplify-implementation.ts
2
+ function buildSimplifyImplementationPrompt(_ctx) {
3
+ return `Repository root: . (the current working directory)
4
+
5
+ Find worthwhile ways to simplify the current implementation and nearby code, reducing lines without reducing clarity or behavior. If the implementation is already appropriately simple, say so.
6
+
7
+ Inspect the repository read-only and publish a concise simplification plan. Do not modify any files.`;
8
+ }
9
+
10
+ export {
11
+ buildSimplifyImplementationPrompt
12
+ };
13
+ //# sourceMappingURL=chunk-OFDNIT5X.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/turns/simplify-implementation.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildSimplifyImplementationPrompt(\n\t_ctx: FlowPromptContext<unknown, StructuralProcessState>,\n): string {\n\treturn `Repository root: . (the current working directory)\n\nFind worthwhile ways to simplify the current implementation and nearby code, reducing lines without reducing clarity or behavior. If the implementation is already appropriately simple, say so.\n\nInspect the repository read-only and publish a concise simplification plan. Do not modify any files.`;\n}\n"],"mappings":";AAEO,SAAS,kCACf,MACS;AACT,SAAO;AAAA;AAAA;AAAA;AAAA;AAKR;","names":[]}
@@ -0,0 +1,40 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __commonJS = (cb, mod) => function __require() {
8
+ try {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ } catch (e) {
11
+ throw mod = 0, e;
12
+ }
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
34
+
35
+ export {
36
+ __commonJS,
37
+ __export,
38
+ __toESM
39
+ };
40
+ //# sourceMappingURL=chunk-PX6F3LHL.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,34 @@
1
+ // src/turns/review-implementation.ts
2
+ import { createReviewSubject } from "@leitwerk-dev/domain";
3
+ var implementationReviewSubject = createReviewSubject("implementation");
4
+ function buildReviewImplementationPrompt(ctx) {
5
+ const repo = ctx.repo.get("repo");
6
+ return `Repository root: . (the current working directory)
7
+
8
+ Review the current implementation of this requested change:
9
+ ${ctx.prompts.initial}
10
+
11
+ Inspect the changes with \`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\`. Check for:
12
+ - bugs and logic errors
13
+ - security issues
14
+ - error handling gaps
15
+ - missing or misplaced tests
16
+ - unnecessary abstractions, duplication, and other avoidable complexity
17
+
18
+ For each issue, give a concise fix.
19
+
20
+ Rules:
21
+ - inspect code only inside the current working directory
22
+ - treat . as the repository root for read-only inspection
23
+ - use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
24
+ - do not modify files, branches, commits, or git index state
25
+ - do not read from or write to any original source repository path outside the process workspace
26
+ - publish a short Markdown approval note if the implementation is ready
27
+ - publish concise, actionable Markdown feedback if the implementation needs changes`;
28
+ }
29
+
30
+ export {
31
+ implementationReviewSubject,
32
+ buildReviewImplementationPrompt
33
+ };
34
+ //# sourceMappingURL=chunk-RWCLBBB2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/turns/review-implementation.ts"],"sourcesContent":["import { createReviewSubject } from \"@leitwerk-dev/domain\";\nimport type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport const implementationReviewSubject = createReviewSubject(\"implementation\");\n\nexport function buildReviewImplementationPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState>,\n): string {\n\tconst repo = ctx.repo.get(\"repo\");\n\treturn `Repository root: . (the current working directory)\n\nReview the current implementation of this requested change:\n${ctx.prompts.initial}\n\nInspect the changes with \\`git diff --stat $(git merge-base ${repo.baseBranch} HEAD)\\`. Check for:\n- bugs and logic errors\n- security issues\n- error handling gaps\n- missing or misplaced tests\n- unnecessary abstractions, duplication, and other avoidable complexity\n\nFor each issue, give a concise fix.\n\nRules:\n- inspect code only inside the current working directory\n- treat . as the repository root for read-only inspection\n- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)\n- do not modify files, branches, commits, or git index state\n- do not read from or write to any original source repository path outside the process workspace\n- publish a short Markdown approval note if the implementation is ready\n- publish concise, actionable Markdown feedback if the implementation needs changes`;\n}\n"],"mappings":";AAAA,SAAS,2BAA2B;AAG7B,IAAM,8BAA8B,oBAAoB,gBAAgB;AAExE,SAAS,gCACf,KACS;AACT,QAAM,OAAO,IAAI,KAAK,IAAI,MAAM;AAChC,SAAO;AAAA;AAAA;AAAA,EAGN,IAAI,QAAQ,OAAO;AAAA;AAAA,8DAEyC,KAAK,UAAU;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB7E;","names":[]}
@@ -0,0 +1,28 @@
1
+ // src/turns/review-plan.ts
2
+ import { createReviewSubject } from "@leitwerk-dev/domain";
3
+ var planReviewSubject = createReviewSubject("plan");
4
+ function buildReviewPlanPrompt(ctx) {
5
+ return `Review the plan against this requested change:
6
+ ${ctx.prompts.initial}
7
+
8
+ Repository root: . (the current working directory)
9
+
10
+ Plan:
11
+ ${ctx.input.plan}
12
+
13
+ Rules:
14
+ - review the plan only; do not rewrite the plan
15
+ - if you inspect repository files for context, read only inside the current working directory
16
+ - use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)
17
+ - do not modify files, branches, commits, or git index state
18
+ - do not read from or write to any original source repository path outside the process workspace
19
+ - evaluate scope, sequencing, risks, and acceptance criteria
20
+ - publish a short Markdown approval note when the plan is solid
21
+ - publish concise, actionable Markdown feedback when the plan needs changes`;
22
+ }
23
+
24
+ export {
25
+ planReviewSubject,
26
+ buildReviewPlanPrompt
27
+ };
28
+ //# sourceMappingURL=chunk-RZ54IVY5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/turns/review-plan.ts"],"sourcesContent":["import { createReviewSubject } from \"@leitwerk-dev/domain\";\nimport type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport const planReviewSubject = createReviewSubject(\"plan\");\n\nexport function buildReviewPlanPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, \"plan\">,\n): string {\n\treturn `Review the plan against this requested change:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nPlan:\n${ctx.input.plan}\n\nRules:\n- review the plan only; do not rewrite the plan\n- if you inspect repository files for context, read only inside the current working directory\n- use bash only for read-only inspection (e.g. git diff, git status, rg, tree, file listing, read-only http/CLI calls)\n- do not modify files, branches, commits, or git index state\n- do not read from or write to any original source repository path outside the process workspace\n- evaluate scope, sequencing, risks, and acceptance criteria\n- publish a short Markdown approval note when the plan is solid\n- publish concise, actionable Markdown feedback when the plan needs changes`;\n}\n"],"mappings":";AAAA,SAAS,2BAA2B;AAG7B,IAAM,oBAAoB,oBAAoB,MAAM;AAEpD,SAAS,sBACf,KACS;AACT,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnB,IAAI,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAWhB;","names":[]}
@@ -0,0 +1,23 @@
1
+ // src/turns/implement.ts
2
+ function buildImplementPrompt(ctx) {
3
+ return `Implement this requested change:
4
+ ${ctx.prompts.initial}
5
+
6
+ Repository root: . (the current working directory)
7
+
8
+ Follow this plan:
9
+ ${ctx.input.plan}
10
+
11
+ Rules:
12
+ - keep going until the change is complete; do any necessary additional passes without asking
13
+ - make repository changes only inside the current working directory
14
+ - treat . as the repository root for file edits and git commands
15
+ - do not read from or write to any original source repository path outside the process workspace
16
+ - keep the implementation coherent and complete
17
+ - publish the implementation summary when done`;
18
+ }
19
+
20
+ export {
21
+ buildImplementPrompt
22
+ };
23
+ //# sourceMappingURL=chunk-UBVLJV3V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/turns/implement.ts"],"sourcesContent":["import type { FlowPromptContext, StructuralProcessState } from \"@leitwerk-dev/process-sdk\";\n\nexport function buildImplementPrompt(\n\tctx: FlowPromptContext<unknown, StructuralProcessState, \"plan\">,\n): string {\n\treturn `Implement this requested change:\n${ctx.prompts.initial}\n\nRepository root: . (the current working directory)\n\nFollow this plan:\n${ctx.input.plan}\n\nRules:\n- keep going until the change is complete; do any necessary additional passes without asking\n- make repository changes only inside the current working directory\n- treat . as the repository root for file edits and git commands\n- do not read from or write to any original source repository path outside the process workspace\n- keep the implementation coherent and complete\n- publish the implementation summary when done`;\n}\n"],"mappings":";AAEO,SAAS,qBACf,KACS;AACT,SAAO;AAAA,EACN,IAAI,QAAQ,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKnB,IAAI,MAAM,IAAI;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAShB;","names":[]}
@@ -0,0 +1,185 @@
1
+ // src/repository-change-launch.ts
2
+ import { parseRepoLocator, trimString } from "@leitwerk-dev/domain";
3
+ function repositoryChangeParamsRecord(value, displayName) {
4
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
5
+ throw new Error(`${displayName} params must be an object`);
6
+ }
7
+ return value;
8
+ }
9
+ function normalizeRepositoryChangeParamsInput(value, displayName) {
10
+ const record = repositoryChangeParamsRecord(value, displayName);
11
+ const rawRepoLocator = trimString(record.repoLocator);
12
+ return {
13
+ launchKind: trimString(record.launchKind),
14
+ repoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,
15
+ baseBranch: trimString(record.baseBranch) || "main",
16
+ workBranch: trimString(record.workBranch),
17
+ prompt: trimString(record.prompt),
18
+ importedPlanMarkdown: trimString(record.importedPlanMarkdown)
19
+ };
20
+ }
21
+ function createRepositoryChangeParamsCodec(input) {
22
+ return {
23
+ parse(value) {
24
+ const { importedPlanMarkdown, ...shared } = input.normalize(value);
25
+ if (shared.launchKind === "requested_change") return shared;
26
+ if (shared.launchKind === "imported_plan") {
27
+ return { ...shared, launchKind: shared.launchKind, importedPlanMarkdown };
28
+ }
29
+ throw new Error(`${input.displayName} params require a valid launchKind`);
30
+ },
31
+ serialize: (value) => value
32
+ };
33
+ }
34
+ function formatRepositoryChangeLaunchErrors(errors) {
35
+ return errors.map((error) => `${error.fieldId ?? "launch"}: ${error.message}`).join("; ");
36
+ }
37
+ function createRepositoryChangeLaunchPlanner(config) {
38
+ return {
39
+ plan({ input, metadata }) {
40
+ const params = config.normalize(input);
41
+ const errors = [];
42
+ if (params.launchKind !== "requested_change" && params.launchKind !== "imported_plan") {
43
+ errors.push({
44
+ code: "custom_rule",
45
+ fieldId: "launchKind",
46
+ message: "launchKind must be requested_change or imported_plan"
47
+ });
48
+ }
49
+ const locatorError = config.validateRepoLocator(params.repoLocator);
50
+ if (locatorError) {
51
+ errors.push({
52
+ code: "invalid_repo_locator",
53
+ fieldId: "repoLocator",
54
+ message: locatorError
55
+ });
56
+ }
57
+ if (params.workBranch && params.workBranch === params.baseBranch) {
58
+ errors.push({
59
+ code: "custom_rule",
60
+ fieldId: "workBranch",
61
+ message: "workBranch cannot match baseBranch"
62
+ });
63
+ }
64
+ if (!params.prompt) {
65
+ errors.push({ code: "required", fieldId: "prompt", message: "prompt is required" });
66
+ }
67
+ if (params.launchKind === "imported_plan" && !params.importedPlanMarkdown) {
68
+ errors.push({
69
+ code: "required",
70
+ fieldId: "importedPlanMarkdown",
71
+ message: "importedPlanMarkdown is required for imported_plan launches"
72
+ });
73
+ }
74
+ if (params.launchKind === "requested_change" && "importedPlanMarkdown" in input) {
75
+ errors.push({
76
+ code: "custom_rule",
77
+ fieldId: "importedPlanMarkdown",
78
+ message: "importedPlanMarkdown is not allowed for requested_change launches"
79
+ });
80
+ }
81
+ errors.push(...config.validate?.(input, params) ?? []);
82
+ if (errors.length > 0) return { ok: false, errors };
83
+ const prepared = config.prepare?.(params) ?? params;
84
+ const hasWorkBranch = prepared.workBranch !== "";
85
+ return {
86
+ ok: true,
87
+ launchConfig: {
88
+ processId: config.processId,
89
+ params: prepared,
90
+ startTurnId: config.deferWithoutWorkBranch && !hasWorkBranch ? null : prepared.launchKind === "imported_plan" ? "import_plan" : "generate_plan",
91
+ titleSourceFields: [{ label: "Requested change", value: prepared.prompt }],
92
+ metadata: metadata ?? null,
93
+ projects: [
94
+ {
95
+ key: "repo",
96
+ repoLocator: prepared.repoLocator,
97
+ baseBranch: prepared.baseBranch,
98
+ workBranch: hasWorkBranch ? prepared.workBranch : null
99
+ }
100
+ ]
101
+ }
102
+ };
103
+ }
104
+ };
105
+ }
106
+ function createRepositoryChangeUiLauncher(config) {
107
+ return {
108
+ id: config.id,
109
+ label: config.title,
110
+ description: "Plan, implement, review, and finalize a change in a single git repository",
111
+ visibility: "ui",
112
+ ui: {
113
+ card: {
114
+ title: config.title,
115
+ description: "Run a plan \u2192 implement \u2192 review \u2192 finalize loop against any local or remote git repository."
116
+ },
117
+ launchConfigSchema: {
118
+ id: config.formId,
119
+ title: config.title,
120
+ fields: [
121
+ {
122
+ id: "repoLocator",
123
+ label: "Repository path or URL",
124
+ kind: "text",
125
+ required: true,
126
+ placeholder: "/path/to/repo or https://git.example.com/team/repo.git",
127
+ description: "Use a local checkout path or a remote Git URL.",
128
+ rememberRecentValues: true
129
+ },
130
+ ...config.sshCredentials ? [
131
+ {
132
+ id: "sshCredentialRef",
133
+ label: "SSH credential profile",
134
+ kind: "text",
135
+ required: true,
136
+ placeholder: "default",
137
+ description: "Profile from extensions.git-ssh.credentials."
138
+ }
139
+ ] : [],
140
+ {
141
+ id: "baseBranch",
142
+ label: "Base branch",
143
+ kind: "text",
144
+ placeholder: "main",
145
+ description: "Leave this as main unless the change should merge somewhere else."
146
+ },
147
+ {
148
+ id: "workBranch",
149
+ label: "Work branch",
150
+ kind: "text",
151
+ placeholder: "feature/my-change",
152
+ description: config.workBranchDescription
153
+ },
154
+ {
155
+ id: "prompt",
156
+ label: "Requested change",
157
+ kind: "textarea",
158
+ required: true,
159
+ placeholder: "Describe the change this process should plan, implement, and review."
160
+ }
161
+ ],
162
+ submitLabel: "Start change"
163
+ },
164
+ resolveDefaults: () => ({
165
+ repoLocator: "",
166
+ ...config.sshCredentials ? { sshCredentialRef: "default" } : {},
167
+ baseBranch: "main",
168
+ workBranch: "",
169
+ prompt: ""
170
+ }),
171
+ resolveRelaunchInput: config.resolveRelaunchInput,
172
+ resolveLaunchConfig: config.resolveLaunchConfig
173
+ }
174
+ };
175
+ }
176
+
177
+ export {
178
+ repositoryChangeParamsRecord,
179
+ normalizeRepositoryChangeParamsInput,
180
+ createRepositoryChangeParamsCodec,
181
+ formatRepositoryChangeLaunchErrors,
182
+ createRepositoryChangeLaunchPlanner,
183
+ createRepositoryChangeUiLauncher
184
+ };
185
+ //# sourceMappingURL=chunk-Y2S6JFVO.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/repository-change-launch.ts"],"sourcesContent":["import { parseRepoLocator, trimString } from \"@leitwerk-dev/domain\";\nimport type {\n\tCodec,\n\tLauncherValidationError,\n\tProcessLaunchConfig,\n\tProcessLauncherDefinition,\n\tUiLauncherDefinition,\n} from \"@leitwerk-dev/process-sdk\";\n\nexport type RepositoryChangeLaunchKind = \"requested_change\" | \"imported_plan\";\n\nexport interface RepositoryChangeParamsBase {\n\trepoLocator: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\tprompt: string;\n\tlaunchKind: RepositoryChangeLaunchKind;\n\timportedPlanMarkdown?: string;\n}\n\nexport type RepositoryChangeLaunchParams<TExtra extends object = Record<never, never>> = TExtra &\n\tOmit<RepositoryChangeParamsBase, \"launchKind\" | \"importedPlanMarkdown\"> &\n\t(\n\t\t| { launchKind: \"requested_change\" }\n\t\t| { launchKind: \"imported_plan\"; importedPlanMarkdown: string }\n\t);\n\nexport interface NormalizedRepositoryChangeParamsInput {\n\tlaunchKind: string;\n\trepoLocator: string;\n\tbaseBranch: string;\n\tworkBranch: string;\n\tprompt: string;\n\timportedPlanMarkdown: string;\n}\n\nexport function repositoryChangeParamsRecord(\n\tvalue: unknown,\n\tdisplayName: string,\n): Record<string, unknown> {\n\tif (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n\t\tthrow new Error(`${displayName} params must be an object`);\n\t}\n\treturn value as Record<string, unknown>;\n}\n\nexport function normalizeRepositoryChangeParamsInput(\n\tvalue: unknown,\n\tdisplayName: string,\n): NormalizedRepositoryChangeParamsInput {\n\tconst record = repositoryChangeParamsRecord(value, displayName);\n\tconst rawRepoLocator = trimString(record.repoLocator);\n\treturn {\n\t\tlaunchKind: trimString(record.launchKind),\n\t\trepoLocator: parseRepoLocator(rawRepoLocator)?.value ?? rawRepoLocator,\n\t\tbaseBranch: trimString(record.baseBranch) || \"main\",\n\t\tworkBranch: trimString(record.workBranch),\n\t\tprompt: trimString(record.prompt),\n\t\timportedPlanMarkdown: trimString(record.importedPlanMarkdown),\n\t};\n}\n\nexport function createRepositoryChangeParamsCodec<T extends RepositoryChangeParamsBase>(input: {\n\tdisplayName: string;\n\tnormalize(\n\t\tvalue: unknown,\n\t): NormalizedRepositoryChangeParamsInput & Omit<T, keyof RepositoryChangeParamsBase>;\n}): Codec<T> {\n\treturn {\n\t\tparse(value) {\n\t\t\tconst { importedPlanMarkdown, ...shared } = input.normalize(value);\n\t\t\tif (shared.launchKind === \"requested_change\") return shared as T;\n\t\t\tif (shared.launchKind === \"imported_plan\") {\n\t\t\t\treturn { ...shared, launchKind: shared.launchKind, importedPlanMarkdown } as T;\n\t\t\t}\n\t\t\tthrow new Error(`${input.displayName} params require a valid launchKind`);\n\t\t},\n\t\tserialize: (value) => value,\n\t};\n}\n\nexport interface RepositoryChangeLaunchPlannerInput {\n\tinput: Record<string, unknown>;\n\tmetadata?: Record<string, unknown> | null;\n}\n\nexport type RepositoryChangeLaunchResolution<T extends RepositoryChangeParamsBase> =\n\t| { ok: true; launchConfig: ProcessLaunchConfig<T> }\n\t| { ok: false; errors: readonly LauncherValidationError[] };\n\nexport interface RepositoryChangeLaunchPlanner<T extends RepositoryChangeParamsBase> {\n\tplan(input: RepositoryChangeLaunchPlannerInput): RepositoryChangeLaunchResolution<T>;\n}\n\nexport function formatRepositoryChangeLaunchErrors(\n\terrors: readonly LauncherValidationError[],\n): string {\n\treturn errors.map((error) => `${error.fieldId ?? \"launch\"}: ${error.message}`).join(\"; \");\n}\n\nexport function createRepositoryChangeLaunchPlanner<T extends RepositoryChangeParamsBase>(config: {\n\tprocessId: string;\n\tnormalize(input: Record<string, unknown>): T & { importedPlanMarkdown?: string };\n\tvalidateRepoLocator(repoLocator: string): string | null;\n\tvalidate?(input: Record<string, unknown>, params: T): readonly LauncherValidationError[];\n\tprepare?(params: T): T;\n\tdeferWithoutWorkBranch?: boolean;\n}): RepositoryChangeLaunchPlanner<T> {\n\treturn {\n\t\tplan({ input, metadata }) {\n\t\t\tconst params = config.normalize(input);\n\t\t\tconst errors: LauncherValidationError[] = [];\n\t\t\tif (params.launchKind !== \"requested_change\" && params.launchKind !== \"imported_plan\") {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"launchKind\",\n\t\t\t\t\tmessage: \"launchKind must be requested_change or imported_plan\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tconst locatorError = config.validateRepoLocator(params.repoLocator);\n\t\t\tif (locatorError) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"invalid_repo_locator\",\n\t\t\t\t\tfieldId: \"repoLocator\",\n\t\t\t\t\tmessage: locatorError,\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (params.workBranch && params.workBranch === params.baseBranch) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"workBranch\",\n\t\t\t\t\tmessage: \"workBranch cannot match baseBranch\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (!params.prompt) {\n\t\t\t\terrors.push({ code: \"required\", fieldId: \"prompt\", message: \"prompt is required\" });\n\t\t\t}\n\t\t\tif (params.launchKind === \"imported_plan\" && !params.importedPlanMarkdown) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"required\",\n\t\t\t\t\tfieldId: \"importedPlanMarkdown\",\n\t\t\t\t\tmessage: \"importedPlanMarkdown is required for imported_plan launches\",\n\t\t\t\t});\n\t\t\t}\n\t\t\tif (params.launchKind === \"requested_change\" && \"importedPlanMarkdown\" in input) {\n\t\t\t\terrors.push({\n\t\t\t\t\tcode: \"custom_rule\",\n\t\t\t\t\tfieldId: \"importedPlanMarkdown\",\n\t\t\t\t\tmessage: \"importedPlanMarkdown is not allowed for requested_change launches\",\n\t\t\t\t});\n\t\t\t}\n\t\t\terrors.push(...(config.validate?.(input, params) ?? []));\n\t\t\tif (errors.length > 0) return { ok: false, errors };\n\n\t\t\tconst prepared = config.prepare?.(params) ?? params;\n\t\t\tconst hasWorkBranch = prepared.workBranch !== \"\";\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\tlaunchConfig: {\n\t\t\t\t\tprocessId: config.processId,\n\t\t\t\t\tparams: prepared,\n\t\t\t\t\tstartTurnId:\n\t\t\t\t\t\tconfig.deferWithoutWorkBranch && !hasWorkBranch\n\t\t\t\t\t\t\t? null\n\t\t\t\t\t\t\t: prepared.launchKind === \"imported_plan\"\n\t\t\t\t\t\t\t\t? \"import_plan\"\n\t\t\t\t\t\t\t\t: \"generate_plan\",\n\t\t\t\t\ttitleSourceFields: [{ label: \"Requested change\", value: prepared.prompt }],\n\t\t\t\t\tmetadata: metadata ?? null,\n\t\t\t\t\tprojects: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tkey: \"repo\",\n\t\t\t\t\t\t\trepoLocator: prepared.repoLocator,\n\t\t\t\t\t\t\tbaseBranch: prepared.baseBranch,\n\t\t\t\t\t\t\tworkBranch: hasWorkBranch ? prepared.workBranch : null,\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t};\n\t\t},\n\t};\n}\n\nexport function createRepositoryChangeUiLauncher<T extends RepositoryChangeParamsBase>(config: {\n\tid: string;\n\tformId: string;\n\ttitle: string;\n\tworkBranchDescription: string;\n\tsshCredentials?: boolean;\n\tresolveRelaunchInput?: UiLauncherDefinition<T>[\"resolveRelaunchInput\"];\n\tresolveLaunchConfig: UiLauncherDefinition<T>[\"resolveLaunchConfig\"];\n}): ProcessLauncherDefinition<T> {\n\treturn {\n\t\tid: config.id,\n\t\tlabel: config.title,\n\t\tdescription: \"Plan, implement, review, and finalize a change in a single git repository\",\n\t\tvisibility: \"ui\",\n\t\tui: {\n\t\t\tcard: {\n\t\t\t\ttitle: config.title,\n\t\t\t\tdescription:\n\t\t\t\t\t\"Run a plan → implement → review → finalize loop against any local or remote git repository.\",\n\t\t\t},\n\t\t\tlaunchConfigSchema: {\n\t\t\t\tid: config.formId,\n\t\t\t\ttitle: config.title,\n\t\t\t\tfields: [\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"repoLocator\",\n\t\t\t\t\t\tlabel: \"Repository path or URL\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tplaceholder: \"/path/to/repo or https://git.example.com/team/repo.git\",\n\t\t\t\t\t\tdescription: \"Use a local checkout path or a remote Git URL.\",\n\t\t\t\t\t\trememberRecentValues: true,\n\t\t\t\t\t},\n\t\t\t\t\t...(config.sshCredentials\n\t\t\t\t\t\t? [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tid: \"sshCredentialRef\",\n\t\t\t\t\t\t\t\t\tlabel: \"SSH credential profile\",\n\t\t\t\t\t\t\t\t\tkind: \"text\" as const,\n\t\t\t\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\t\t\t\tplaceholder: \"default\",\n\t\t\t\t\t\t\t\t\tdescription: \"Profile from extensions.git-ssh.credentials.\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]\n\t\t\t\t\t\t: []),\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"baseBranch\",\n\t\t\t\t\t\tlabel: \"Base branch\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\tplaceholder: \"main\",\n\t\t\t\t\t\tdescription: \"Leave this as main unless the change should merge somewhere else.\",\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"workBranch\",\n\t\t\t\t\t\tlabel: \"Work branch\",\n\t\t\t\t\t\tkind: \"text\",\n\t\t\t\t\t\tplaceholder: \"feature/my-change\",\n\t\t\t\t\t\tdescription: config.workBranchDescription,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tid: \"prompt\",\n\t\t\t\t\t\tlabel: \"Requested change\",\n\t\t\t\t\t\tkind: \"textarea\",\n\t\t\t\t\t\trequired: true,\n\t\t\t\t\t\tplaceholder: \"Describe the change this process should plan, implement, and review.\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tsubmitLabel: \"Start change\",\n\t\t\t},\n\t\t\tresolveDefaults: () => ({\n\t\t\t\trepoLocator: \"\",\n\t\t\t\t...(config.sshCredentials ? { sshCredentialRef: \"default\" } : {}),\n\t\t\t\tbaseBranch: \"main\",\n\t\t\t\tworkBranch: \"\",\n\t\t\t\tprompt: \"\",\n\t\t\t}),\n\t\t\tresolveRelaunchInput: config.resolveRelaunchInput,\n\t\t\tresolveLaunchConfig: config.resolveLaunchConfig,\n\t\t},\n\t};\n}\n"],"mappings":";AAAA,SAAS,kBAAkB,kBAAkB;AAoCtC,SAAS,6BACf,OACA,aAC0B;AAC1B,MAAI,OAAO,UAAU,YAAY,UAAU,QAAQ,MAAM,QAAQ,KAAK,GAAG;AACxE,UAAM,IAAI,MAAM,GAAG,WAAW,2BAA2B;AAAA,EAC1D;AACA,SAAO;AACR;AAEO,SAAS,qCACf,OACA,aACwC;AACxC,QAAM,SAAS,6BAA6B,OAAO,WAAW;AAC9D,QAAM,iBAAiB,WAAW,OAAO,WAAW;AACpD,SAAO;AAAA,IACN,YAAY,WAAW,OAAO,UAAU;AAAA,IACxC,aAAa,iBAAiB,cAAc,GAAG,SAAS;AAAA,IACxD,YAAY,WAAW,OAAO,UAAU,KAAK;AAAA,IAC7C,YAA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