@leitwerk-dev/forgejo-repo-change 0.0.0-bootstrap.0 → 0.2.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.
- package/README.md +102 -1
- package/dist/LICENSE +13 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1402 -0
- package/dist/index.js.map +1 -0
- package/dist/launcher.d.ts +29 -0
- package/dist/launcher.d.ts.map +1 -0
- package/dist/params.d.ts +27 -0
- package/dist/params.d.ts.map +1 -0
- package/dist/process.d.ts +5 -0
- package/dist/process.d.ts.map +1 -0
- package/dist/profile-bindings.d.ts +9 -0
- package/dist/profile-bindings.d.ts.map +1 -0
- package/package.json +52 -14
- package/src/index.ts +58 -0
- package/src/launcher.ts +319 -0
- package/src/params.ts +93 -0
- package/src/process.ts +759 -0
- package/src/profile-bindings.ts +54 -0
package/README.md
CHANGED
|
@@ -1 +1,102 @@
|
|
|
1
|
-
|
|
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 branch and head trigger
|
|
52
|
+
repair. After three automatic CI cycles an operator must retry, resume waiting,
|
|
53
|
+
or abort. Success keeps delivery waiting for the PR outcome. Conflict evidence
|
|
54
|
+
permits one automatic repair per repository, PR, head, and base; publication uses
|
|
55
|
+
the original-head lease after completing and verifying the rebase.
|
|
56
|
+
|
|
57
|
+
Merge completes delivery. A source issue loses its trigger label, gains the done
|
|
58
|
+
label, receives a comment, and closes. Closing an unmerged PR aborts delivery and
|
|
59
|
+
leaves its source issue open after removing the trigger and commenting. Closing
|
|
60
|
+
the source issue or removing its trigger aborts waiting delivery directly.
|
|
61
|
+
UI-origin deliveries never require source issue access.
|
|
62
|
+
|
|
63
|
+
## Composition and compatibility
|
|
64
|
+
|
|
65
|
+
The default extension and `forgejoRepoChangeProcess` require Docker at runtime.
|
|
66
|
+
For a composition without Docker, use:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
import { createForgejoRepoChange } from "@leitwerk-dev/forgejo-repo-change";
|
|
70
|
+
const { extension, process } = createForgejoRepoChange({ docker: false });
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Load exactly one variant per catalog. Each factory call owns a fresh process
|
|
74
|
+
and launcher configuration, cleared when its server stops. Both variants retain
|
|
75
|
+
the same process ID, turns, and state codec. The server controls runtime admission; repository content and launch parameters
|
|
76
|
+
cannot enable Docker. Credentials stay with their owning integrations.
|
|
77
|
+
|
|
78
|
+
Stored process IDs, turn IDs, state under `extensionState.forgejoRepoChange`,
|
|
79
|
+
subscriptions, project metadata, and external-write keys remain compatible with
|
|
80
|
+
existing deliveries. Legacy issue parameters without `origin` remain readable.
|
|
81
|
+
Forgejo and Woodpecker retain their documented persisted protocol identifiers.
|
|
82
|
+
The separate `remote-repo-change` extension continues direct base-branch delivery.
|
|
83
|
+
|
|
84
|
+
At operator action, **Retry repair** retains the pending evidence. **Resume waiting**
|
|
85
|
+
dismisses the pending feedback and adjustment, retaining accepted feedback cursors
|
|
86
|
+
and remote delivery state while waiting for new evidence.
|
|
87
|
+
|
|
88
|
+
## Integration tests
|
|
89
|
+
|
|
90
|
+
The composed workflow tests copy a pristine Git seed into an independent repository
|
|
91
|
+
per scenario and use in-memory SQLite. They retain real Git, HTTP actions and worker
|
|
92
|
+
IPC without repeating repository initialization. Failures report process and turn
|
|
93
|
+
state before cleanup. File-backed persistence is covered separately below.
|
|
94
|
+
|
|
95
|
+
## Restart verification
|
|
96
|
+
|
|
97
|
+
The provider sandbox's file-backed restart fixtures retain legacy issue/UI params,
|
|
98
|
+
Forgejo-only project metadata, completed write receipts and waiting subscriptions.
|
|
99
|
+
They reopen feedback, CI, conflict, operator and terminal deliveries, compare project,
|
|
100
|
+
turn and session identities, and verify that changed profile mappings do not rebind
|
|
101
|
+
existing work. A remote merge while the server is stopped completes after rearming.
|
|
102
|
+
Lost PR responses and publication retries reconcile one PR without duplicate comments.
|
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.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
|
|
2
|
+
export declare const manifest: {
|
|
3
|
+
readonly id: "forgejo-repo-change";
|
|
4
|
+
readonly version: "0.1.9";
|
|
5
|
+
readonly requires: readonly ["forgejo", "woodpecker", "coding", "git-ssh"];
|
|
6
|
+
};
|
|
7
|
+
/** Load exactly one variant per catalog. Only trusted composition code selects Docker. */
|
|
8
|
+
export declare function createForgejoRepoChange(options: {
|
|
9
|
+
docker: boolean;
|
|
10
|
+
}): {
|
|
11
|
+
extension: LeitwerkExtensionModule;
|
|
12
|
+
process: import("@leitwerk-dev/process-sdk").ProcessDefinition<import("./params.js").ForgejoRepoChangeParams, import("@leitwerk-dev/coding/repository-change-state").RepositoryChangeState>;
|
|
13
|
+
launcher: {
|
|
14
|
+
configure: (value: import("./launcher.js").LauncherDependencies | null) => void;
|
|
15
|
+
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>[];
|
|
16
|
+
resolveProfiles: (profile: string) => import("./profile-bindings.js").ProfileBinding;
|
|
17
|
+
resolveGitIdentity: (profile: string) => Promise<import("@leitwerk-dev/forgejo").ForgejoGitIdentity>;
|
|
18
|
+
launcher: import("@leitwerk-dev/process-sdk").ProcessLauncherDefinition<import("./params.js").ForgejoRepoChangeParams>;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
export * from "./launcher.js";
|
|
22
|
+
export * from "./params.js";
|
|
23
|
+
export * from "./process.js";
|
|
24
|
+
export * from "./profile-bindings.js";
|
|
25
|
+
export declare const defaultExtension: LeitwerkExtensionModule, forgejoRepoChangeProcess: import("@leitwerk-dev/process-sdk").ProcessDefinition<import("./params.js").ForgejoRepoChangeParams, import("@leitwerk-dev/coding/repository-change-state").RepositoryChangeState>, defaultForgejoRepoChangeLauncher: {
|
|
26
|
+
configure: (value: import("./launcher.js").LauncherDependencies | null) => void;
|
|
27
|
+
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>[];
|
|
28
|
+
resolveProfiles: (profile: string) => import("./profile-bindings.js").ProfileBinding;
|
|
29
|
+
resolveGitIdentity: (profile: string) => Promise<import("@leitwerk-dev/forgejo").ForgejoGitIdentity>;
|
|
30
|
+
launcher: import("@leitwerk-dev/process-sdk").ProcessLauncherDefinition<import("./params.js").ForgejoRepoChangeParams>;
|
|
31
|
+
};
|
|
32
|
+
export declare const configureForgejoRepoChangeLauncher: (value: import("./launcher.js").LauncherDependencies | null) => void, forgejoRepositoryPreparationChecks: (_input: unknown, { params }: import("@leitwerk-dev/process-sdk").ProcessLaunchConfig<import("./params.js").ForgejoRepoChangeParams>) => readonly import("@leitwerk-dev/process-sdk").LaunchPreparationCheck<import("./params.js").ForgejoRepoChangeParams>[], resolveForgejoGitIdentity: (profile: string) => Promise<import("@leitwerk-dev/forgejo").ForgejoGitIdentity>, forgejoRepoChangeUiLauncher: import("@leitwerk-dev/process-sdk").ProcessLauncherDefinition<import("./params.js").ForgejoRepoChangeParams>;
|
|
33
|
+
export default defaultExtension;
|
|
34
|
+
//# 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;AAMzE,eAAO,MAAM,QAAQ;;;;CAIX,CAAC;AAEX,0FAA0F;AAC1F,wBAAgB,uBAAuB,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE;;;;;;;;;;EAyBnE;AAED,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,eAAO,MACK,gBAAgB,2BAClB,wBAAwB,sLACvB,gCAAgC;;;;;;CACE,CAAC;AAC9C,eAAO,MACK,kCAAkC,wEAC1B,kCAAkC,iQACjC,yBAAyB,oFACnC,2BAA2B,8GACF,CAAC;AACrC,eAAe,gBAAgB,CAAC"}
|