@leitwerk-dev/forgejo-repo-change 0.0.0-bootstrap.0 → 0.2.1

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/README.md CHANGED
@@ -1 +1,123 @@
1
- Registration placeholder only. Not a usable Leitwerk release.
1
+ # Forgejo repository change
2
+
3
+ `@leitwerk-dev/forgejo-repo-change` plans, implements, and delivers repository
4
+ changes through a Forgejo pull request. It is opt-in and requires the `forgejo`,
5
+ `woodpecker`, `coding`, and `git-ssh` extensions. Enable `ticket-creation` when the
6
+ Forgejo integration's ticket feature is enabled.
7
+
8
+ ## Configuration and launching
9
+
10
+ Configure server-owned profiles in the Forgejo, Woodpecker, and Git SSH extensions.
11
+ The UI launcher lists repositories visible to the selected Forgejo profile and
12
+ checks repository visibility, SSH read access, and dry-run SSH write access before
13
+ launching. The `use_leitwerk` watcher launches labeled source issues through the
14
+ same admission checks. Configure its profile, trigger/done labels, repositories,
15
+ and polling interval under `process_configs.forgejo_repo_change_process.watchers`.
16
+ See the [Forgejo integration](../forgejo/README.md) for provider configuration.
17
+
18
+ By default the selected Forgejo profile also names the Woodpecker and Git SSH
19
+ profiles. Override this wiring in non-secret workflow configuration:
20
+
21
+ ```yaml
22
+ extensions:
23
+ forgejo-repo-change:
24
+ profile_bindings:
25
+ forgejo-team:
26
+ woodpecker_profile: ci-team
27
+ ssh_credential_ref: repository-writer
28
+ ```
29
+
30
+ Omitted entries and fields use the Forgejo profile name. Present fields must be
31
+ nonempty strings; malformed mappings fail startup. Both launch paths validate all
32
+ three profiles. Launcher input cannot override CI, SSH, or runtime selection.
33
+ New projects record typed `forgejo` and `woodpecker` metadata plus the pinned Git
34
+ identity. Stored parameters retain their resolved profiles after configuration
35
+ changes; mappings affect future launches.
36
+
37
+ The UI starts without a source issue. Each replay generates a new work branch.
38
+ Issue launches retain their external issue identity and `leitwerk/issue-N` branch.
39
+ Plans and implementations require operator approval. Optional review,
40
+ simplification, and imported-plan routes share the coding process contracts.
41
+
42
+ ## Delivery and recovery
43
+
44
+ The automatic `deliver_change` turn commits with the server-pinned Forgejo Git
45
+ identity, pushes a feature branch, and creates or reconciles one pull request.
46
+ It records delivery progress, feedback acknowledgements/replies, and provider
47
+ write receipts. External writes are durable and safe to retry.
48
+
49
+ Delivery waits for Forgejo feedback and terminal events and Woodpecker results.
50
+ Feedback settles for two minutes before revision in a fresh turn; polling defaults
51
+ to 30 seconds. Only pipeline failures matching the current head trigger repair.
52
+ Push pipelines must also match the work branch; pull-request pipelines may report
53
+ the target branch. After three automatic CI cycles an operator must retry, resume
54
+ waiting, or abort. The budget is cumulative: publication, operator retry, and
55
+ resume waiting do not reset it. Success keeps delivery waiting for the PR outcome. Conflict evidence
56
+ permits one automatic repair per repository, PR, head, and base; publication uses
57
+ the original-head lease after completing and verifying the rebase.
58
+
59
+ Merge completes delivery. A source issue loses its trigger label, gains the done
60
+ label, receives a comment, and closes. Closing an unmerged PR aborts delivery and
61
+ leaves its source issue open after removing the trigger and commenting. Closing
62
+ the source issue or removing its trigger aborts waiting delivery directly.
63
+ UI-origin deliveries never require source issue access.
64
+
65
+ Feedback that needs no change receives a reply without a new commit. Feedback
66
+ that cannot be repaired waits for operator action with its evidence retained.
67
+ Repair publication updates the existing PR. Source cancellation leaves it open.
68
+
69
+ Restart resumes delivery from retained state. Consumed feedback and completed
70
+ external writes are not repeated. A merge that occurs while the server is
71
+ offline is reconciled when delivery resumes.
72
+
73
+ At operator action, **Retry repair** retains the pending evidence. **Resume waiting**
74
+ dismisses the pending feedback and adjustment, retaining accepted feedback cursors
75
+ and remote delivery state while waiting for new evidence.
76
+
77
+ ## Composition and compatibility
78
+
79
+ The default extension and `forgejoRepoChangeProcess` require Docker at runtime.
80
+ For a composition without Docker, use:
81
+
82
+ ```ts
83
+ import { createForgejoRepoChange } from "@leitwerk-dev/forgejo-repo-change";
84
+ const { extension, process } = createForgejoRepoChange({ docker: false });
85
+ ```
86
+
87
+ Load exactly one variant per catalog. Each factory call owns a fresh process
88
+ and launcher configuration, cleared when its server stops. Both variants retain
89
+ the same process ID, turns, and state codec. The server controls runtime admission; repository content and launch parameters
90
+ cannot enable Docker. Credentials stay with their owning integrations.
91
+
92
+ Stored process IDs, turn IDs, state under `extensionState.forgejoRepoChange`,
93
+ subscriptions, project metadata, and external-write keys remain compatible with
94
+ existing deliveries. Legacy issue parameters without `origin` remain readable.
95
+ Forgejo and Woodpecker retain their documented persisted protocol identifiers.
96
+ The separate `remote-repo-change` extension continues direct base-branch delivery.
97
+ At operator action, **Retry repair** retains the pending evidence. **Resume waiting**
98
+ dismisses the pending feedback and adjustment, retaining accepted feedback cursors
99
+ and remote delivery state while waiting for new evidence.
100
+
101
+ ## Integration tests
102
+
103
+ The composed workflow tests copy a pristine Git seed into an independent repository
104
+ per scenario and use in-memory SQLite. They retain real Git, HTTP actions and worker
105
+ IPC without repeating repository initialization. Failures report process and turn
106
+ state before cleanup. File-backed persistence is covered separately below.
107
+
108
+ ## Restart verification
109
+
110
+ The provider sandbox's file-backed restart fixtures retain legacy issue/UI params,
111
+ Forgejo-only project metadata, completed write receipts and waiting subscriptions.
112
+ They reopen feedback, CI, conflict, operator and terminal deliveries, compare project,
113
+ turn and session identities, and verify that changed profile mappings do not rebind
114
+ existing work. A remote merge while the server is stopped completes after rearming.
115
+ Lost PR responses and publication retries reconcile one PR without duplicate comments.
116
+
117
+ ## API support
118
+
119
+ The following exported declarations are `@public`:
120
+
121
+ - `@leitwerk-dev/forgejo-repo-change`: `ForgejoRepoChangeParams`, `createForgejoRepoChange`, `default`.
122
+
123
+ See the [SDK compatibility policy](../../docs/process-sdk.md#api-compatibility) for member classifications and support guarantees.
package/dist/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright 2026 Leitwerk contributors.
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,30 @@
1
+ import type { LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
2
+ export { forgejoRepoChangeLaunchConfig, forgejoRepoChangeParams } from "./launcher.js";
3
+ /** Load exactly one variant per catalog. Only trusted composition code selects Docker. @public */
4
+ export declare function createForgejoRepoChange(options: {
5
+ /** @public */
6
+ docker: boolean;
7
+ }): {
8
+ /** @public */
9
+ extension: LeitwerkExtensionModule;
10
+ /** @public */
11
+ process: import("@leitwerk-dev/process-sdk").ExtensionProcessDefinition<import("./params.js").ForgejoRepoChangeParams, import("@leitwerk-dev/coding/repository-change-state").RepositoryChangeState>;
12
+ /** @internal */
13
+ launcher: {
14
+ /** @internal */
15
+ configure: (value: import("./launcher.js").LauncherDependencies | null) => void;
16
+ /** @internal */
17
+ preparationChecks: (_input: unknown, { params }: import("@leitwerk-dev/process-sdk").ProcessLaunchConfig<import("./params.js").ForgejoRepoChangeParams>) => readonly import("@leitwerk-dev/process-sdk").LaunchPreparationCheck<import("./params.js").ForgejoRepoChangeParams>[];
18
+ /** @internal */
19
+ resolveProfiles: (profile: string) => import("./profile-bindings.js").ProfileBinding;
20
+ /** @internal */
21
+ resolveGitIdentity: (profile: string) => Promise<import("@leitwerk-dev/forgejo").ForgejoGitIdentity>;
22
+ /** @internal */
23
+ launcher: import("@leitwerk-dev/process-sdk").ProcessLauncherDefinition<import("./params.js").ForgejoRepoChangeParams>;
24
+ };
25
+ };
26
+ export type { ForgejoRepoChangeParams } from "./params.js";
27
+ /** @internal */
28
+ declare const defaultExtension: LeitwerkExtensionModule;
29
+ export default defaultExtension;
30
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAIzE,OAAO,EAAE,6BAA6B,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAevF,kGAAkG;AAClG,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAChD,cAAc;IACd,MAAM,EAAE,OAAO,CAAC;CAChB;IAyBC,cAAc;;IAEd,cAAc;;IAEd,gBAAgB;;;;;;;;;;;;;EAGjB;AAED,YAAY,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAE3D,gBAAgB;AAChB,QAAA,MAAmB,gBAAgB,yBAA8C,CAAC;AAClF,eAAe,gBAAgB,CAAC"}