@leitwerk-dev/forgejo-repo-change 0.2.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 +25 -4
- package/dist/index.d.ts +15 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +28 -38
- package/dist/index.js.map +1 -1
- package/dist/launcher.d.ts +19 -0
- package/dist/launcher.d.ts.map +1 -1
- package/dist/params.d.ts +21 -0
- package/dist/params.d.ts.map +1 -1
- package/dist/process.d.ts +2 -1
- package/dist/process.d.ts.map +1 -1
- package/dist/profile-bindings.d.ts +6 -1
- package/dist/profile-bindings.d.ts.map +1 -1
- package/package.json +8 -8
- package/src/index.ts +25 -19
- package/src/launcher.ts +23 -0
- package/src/params.ts +21 -0
- package/src/process.ts +1 -0
- package/src/profile-bindings.ts +6 -1
- package/src/routing.test-fixture.ts +14 -0
package/dist/launcher.d.ts
CHANGED
|
@@ -4,26 +4,45 @@ import { type LaunchPreparationCheck, type ProcessLaunchConfig, type ProcessLaun
|
|
|
4
4
|
import type { WoodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
5
5
|
import { type ForgejoRepoChangeParams } from "./params.js";
|
|
6
6
|
import { type ProfileBindings } from "./profile-bindings.js";
|
|
7
|
+
/** @internal */
|
|
7
8
|
export declare const forgejoRepoChangeUiLauncherId: "forgejo_repo_change_process.ui_launcher";
|
|
9
|
+
/** @internal */
|
|
8
10
|
export declare function forgejoRepoChangeParams(repository: ForgejoRepository, input: {
|
|
11
|
+
/** @internal */
|
|
9
12
|
profile: string;
|
|
13
|
+
/** @internal */
|
|
10
14
|
woodpeckerProfile: string;
|
|
15
|
+
/** @internal */
|
|
11
16
|
sshCredentialRef: string;
|
|
17
|
+
/** @internal */
|
|
12
18
|
prompt: string;
|
|
19
|
+
/** @internal */
|
|
13
20
|
workBranch: string;
|
|
14
21
|
}): ForgejoRepoChangeParams;
|
|
22
|
+
/** @internal */
|
|
15
23
|
export declare function forgejoRepoChangeLaunchConfig(params: ForgejoRepoChangeParams, title: string, gitIdentity: ForgejoGitIdentity): ProcessLaunchConfig<ForgejoRepoChangeParams>;
|
|
24
|
+
/** @internal */
|
|
16
25
|
export interface LauncherDependencies {
|
|
26
|
+
/** @internal */
|
|
17
27
|
forgejo: ForgejoIntegration;
|
|
28
|
+
/** @internal */
|
|
18
29
|
gitSsh: GitSshIntegration;
|
|
30
|
+
/** @internal */
|
|
19
31
|
woodpecker: WoodpeckerIntegration;
|
|
32
|
+
/** @internal */
|
|
20
33
|
profileBindings?: ProfileBindings;
|
|
21
34
|
}
|
|
35
|
+
/** @internal */
|
|
22
36
|
export declare function createForgejoRepoChangeLauncher(): {
|
|
37
|
+
/** @internal */
|
|
23
38
|
configure: (value: LauncherDependencies | null) => void;
|
|
39
|
+
/** @internal */
|
|
24
40
|
preparationChecks: (_input: unknown, { params }: ProcessLaunchConfig<ForgejoRepoChangeParams>) => readonly LaunchPreparationCheck<ForgejoRepoChangeParams>[];
|
|
41
|
+
/** @internal */
|
|
25
42
|
resolveProfiles: (profile: string) => import("./profile-bindings.js").ProfileBinding;
|
|
43
|
+
/** @internal */
|
|
26
44
|
resolveGitIdentity: (profile: string) => Promise<ForgejoGitIdentity>;
|
|
45
|
+
/** @internal */
|
|
27
46
|
launcher: ProcessLauncherDefinition<ForgejoRepoChangeParams>;
|
|
28
47
|
};
|
|
29
48
|
//# sourceMappingURL=launcher.d.ts.map
|
package/dist/launcher.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../src/launcher.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAEN,KAAK,sBAAsB,EAC3B,KAAK,mBAAmB,EACxB,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F,gBAAgB;;EAGjB"}
|
package/dist/params.d.ts
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
1
|
import { type RepositoryChangeLaunchParams } from "@leitwerk-dev/coding/repository-change-launch";
|
|
2
|
+
/** @public */
|
|
2
3
|
interface ForgejoRepoChangeCommonParams {
|
|
4
|
+
/** @internal */
|
|
3
5
|
forgejoProfile: string;
|
|
6
|
+
/** @internal */
|
|
4
7
|
woodpeckerProfile: string;
|
|
8
|
+
/** @internal */
|
|
5
9
|
sshCredentialRef: string;
|
|
10
|
+
/** @internal */
|
|
6
11
|
owner: string;
|
|
12
|
+
/** @internal */
|
|
7
13
|
repo: string;
|
|
8
14
|
}
|
|
15
|
+
/** @public */
|
|
9
16
|
export interface ForgejoIssueOriginParams {
|
|
17
|
+
/** @internal */
|
|
10
18
|
origin: "issue";
|
|
19
|
+
/** @internal */
|
|
11
20
|
issueNumber: number;
|
|
21
|
+
/** @internal */
|
|
12
22
|
issueUrl: string;
|
|
23
|
+
/** @internal */
|
|
13
24
|
triggerLabel: string;
|
|
25
|
+
/** @internal */
|
|
14
26
|
doneLabel: string;
|
|
15
27
|
}
|
|
28
|
+
/** @public */
|
|
16
29
|
export interface ForgejoUiOriginParams {
|
|
30
|
+
/** @internal */
|
|
17
31
|
origin: "ui";
|
|
32
|
+
/** @internal */
|
|
18
33
|
issueNumber: null;
|
|
34
|
+
/** @internal */
|
|
19
35
|
issueUrl: null;
|
|
36
|
+
/** @internal */
|
|
20
37
|
triggerLabel: null;
|
|
38
|
+
/** @internal */
|
|
21
39
|
doneLabel: null;
|
|
22
40
|
}
|
|
41
|
+
/** @public */
|
|
23
42
|
export type ForgejoRepoChangeParams = RepositoryChangeLaunchParams<ForgejoRepoChangeCommonParams & (ForgejoIssueOriginParams | ForgejoUiOriginParams)>;
|
|
43
|
+
/** @internal */
|
|
24
44
|
export declare function isIssueOrigin(params: ForgejoRepoChangeParams): params is ForgejoRepoChangeParams & ForgejoIssueOriginParams;
|
|
45
|
+
/** @internal */
|
|
25
46
|
export declare const forgejoRepoChangeParamsCodec: import("@leitwerk-dev/process-sdk").Codec<ForgejoRepoChangeParams>;
|
|
26
47
|
export {};
|
|
27
48
|
//# sourceMappingURL=params.d.ts.map
|
package/dist/params.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,4BAA4B,EAEjC,MAAM,+CAA+C,CAAC;AAGvD,UAAU,6BAA6B;IACtC,cAAc,EAAE,MAAM,CAAC;IACvB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,wBAAwB;IACxC,MAAM,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,qBAAqB;IACrC,MAAM,EAAE,IAAI,CAAC;IACb,WAAW,EAAE,IAAI,CAAC;IAClB,QAAQ,EAAE,IAAI,CAAC;IACf,YAAY,EAAE,IAAI,CAAC;IACnB,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,CACjE,6BAA6B,GAAG,CAAC,wBAAwB,GAAG,qBAAqB,CAAC,CAClF,CAAC;AAEF,wBAAgB,aAAa,CAC5B,MAAM,EAAE,uBAAuB,GAC7B,MAAM,IAAI,uBAAuB,GAAG,wBAAwB,CAE9D;AAED,eAAO,MAAM,4BAA4B,oEAkDtC,CAAC"}
|
|
1
|
+
{"version":3,"file":"params.d.ts","sourceRoot":"","sources":["../src/params.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,KAAK,4BAA4B,EAEjC,MAAM,+CAA+C,CAAC;AAGvD,cAAc;AACd,UAAU,6BAA6B;IACtC,gBAAgB;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB;IAChB,gBAAgB,EAAE,MAAM,CAAC;IACzB,gBAAgB;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;CACb;AAED,cAAc;AACd,MAAM,WAAW,wBAAwB;IACxC,gBAAgB;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB;IAChB,SAAS,EAAE,MAAM,CAAC;CAClB;AAED,cAAc;AACd,MAAM,WAAW,qBAAqB;IACrC,gBAAgB;IAChB,MAAM,EAAE,IAAI,CAAC;IACb,gBAAgB;IAChB,WAAW,EAAE,IAAI,CAAC;IAClB,gBAAgB;IAChB,QAAQ,EAAE,IAAI,CAAC;IACf,gBAAgB;IAChB,YAAY,EAAE,IAAI,CAAC;IACnB,gBAAgB;IAChB,SAAS,EAAE,IAAI,CAAC;CAChB;AAED,cAAc;AACd,MAAM,MAAM,uBAAuB,GAAG,4BAA4B,CACjE,6BAA6B,GAAG,CAAC,wBAAwB,GAAG,qBAAqB,CAAC,CAClF,CAAC;AAEF,gBAAgB;AAChB,wBAAgB,aAAa,CAC5B,MAAM,EAAE,uBAAuB,GAC7B,MAAM,IAAI,uBAAuB,GAAG,wBAAwB,CAE9D;AAED,gBAAgB;AAChB,eAAO,MAAM,4BAA4B,oEAkDtC,CAAC"}
|
package/dist/process.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { RepositoryChangeState } from "@leitwerk-dev/coding/repository-change-state";
|
|
2
2
|
import { type createForgejoRepoChangeLauncher } from "./launcher.js";
|
|
3
3
|
import { type ForgejoRepoChangeParams } from "./params.js";
|
|
4
|
-
|
|
4
|
+
/** @internal */
|
|
5
|
+
export declare function createForgejoRepoChangeProcess(launcher: ReturnType<typeof createForgejoRepoChangeLauncher>, docker: boolean): import("@leitwerk-dev/process-sdk").ExtensionProcessDefinition<ForgejoRepoChangeParams, RepositoryChangeState>;
|
|
5
6
|
//# sourceMappingURL=process.d.ts.map
|
package/dist/process.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAiB1F,OAAO,EACN,KAAK,+BAA+B,EAGpC,MAAM,eAAe,CAAC;AACvB,OAAO,EAEN,KAAK,uBAAuB,EAG5B,MAAM,aAAa,CAAC;AAiNrB,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EAC5D,MAAM,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"process.d.ts","sourceRoot":"","sources":["../src/process.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAiB1F,OAAO,EACN,KAAK,+BAA+B,EAGpC,MAAM,eAAe,CAAC;AACvB,OAAO,EAEN,KAAK,uBAAuB,EAG5B,MAAM,aAAa,CAAC;AAiNrB,gBAAgB;AAChB,wBAAgB,8BAA8B,CAC7C,QAAQ,EAAE,UAAU,CAAC,OAAO,+BAA+B,CAAC,EAC5D,MAAM,EAAE,OAAO,kHAsgBf"}
|
|
@@ -1,9 +1,14 @@
|
|
|
1
|
-
/** Server-owned, non-secret wiring for future launches. */
|
|
1
|
+
/** Server-owned, non-secret wiring for future launches. @internal */
|
|
2
2
|
export interface ProfileBinding {
|
|
3
|
+
/** @internal */
|
|
3
4
|
woodpeckerProfile: string;
|
|
5
|
+
/** @internal */
|
|
4
6
|
sshCredentialRef: string;
|
|
5
7
|
}
|
|
8
|
+
/** @internal */
|
|
6
9
|
export type ProfileBindings = Readonly<Record<string, Readonly<ProfileBinding>>>;
|
|
10
|
+
/** @internal */
|
|
7
11
|
export declare function parseProfileBindings(raw: unknown): ProfileBindings;
|
|
12
|
+
/** @internal */
|
|
8
13
|
export declare function resolveProfileBinding(bindings: ProfileBindings, profile: string): ProfileBinding;
|
|
9
14
|
//# sourceMappingURL=profile-bindings.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile-bindings.d.ts","sourceRoot":"","sources":["../src/profile-bindings.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"profile-bindings.d.ts","sourceRoot":"","sources":["../src/profile-bindings.ts"],"names":[],"mappings":"AAAA,qEAAqE;AACrE,MAAM,WAAW,cAAc;IAC9B,gBAAgB;IAChB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB;IAChB,gBAAgB,EAAE,MAAM,CAAC;CACzB;AACD,gBAAgB;AAChB,MAAM,MAAM,eAAe,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC;AAajF,gBAAgB;AAChB,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,eAAe,CA8BlE;AACD,gBAAgB;AAChB,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,cAAc,CAIhG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leitwerk-dev/forgejo-repo-change",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"leitwerk": {
|
|
6
6
|
"extension": {
|
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
"build": "tsup && tsc -p tsconfig.tsup.json --emitDeclarationOnly"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@leitwerk-dev/coding": "0.2.
|
|
24
|
-
"@leitwerk-dev/external-writes": "0.2.
|
|
25
|
-
"@leitwerk-dev/git-ssh": "0.2.
|
|
26
|
-
"@leitwerk-dev/process-sdk": "0.2.
|
|
27
|
-
"@leitwerk-dev/forgejo": "0.2.
|
|
28
|
-
"@leitwerk-dev/woodpecker": "0.2.
|
|
29
|
-
"@leitwerk-dev/repository-rebase": "0.2.
|
|
23
|
+
"@leitwerk-dev/coding": "0.2.1",
|
|
24
|
+
"@leitwerk-dev/external-writes": "0.2.1",
|
|
25
|
+
"@leitwerk-dev/git-ssh": "0.2.1",
|
|
26
|
+
"@leitwerk-dev/process-sdk": "0.2.1",
|
|
27
|
+
"@leitwerk-dev/forgejo": "0.2.1",
|
|
28
|
+
"@leitwerk-dev/woodpecker": "0.2.1",
|
|
29
|
+
"@leitwerk-dev/repository-rebase": "0.2.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"tsup": "^8.5.1"
|
package/src/index.ts
CHANGED
|
@@ -3,17 +3,27 @@ import { gitSshIntegration } from "@leitwerk-dev/git-ssh";
|
|
|
3
3
|
import type { LeitwerkExtensionModule } from "@leitwerk-dev/process-sdk";
|
|
4
4
|
import { woodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
5
5
|
import { createForgejoRepoChangeLauncher } from "./launcher.js";
|
|
6
|
+
|
|
7
|
+
export { forgejoRepoChangeLaunchConfig, forgejoRepoChangeParams } from "./launcher.js";
|
|
8
|
+
|
|
6
9
|
import { createForgejoRepoChangeProcess } from "./process.js";
|
|
7
10
|
import { parseProfileBindings } from "./profile-bindings.js";
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
/** @internal */
|
|
13
|
+
const manifest = {
|
|
14
|
+
/** @internal */
|
|
10
15
|
id: "forgejo-repo-change",
|
|
16
|
+
/** @internal */
|
|
11
17
|
version: "0.1.9",
|
|
18
|
+
/** @internal */
|
|
12
19
|
requires: ["forgejo", "woodpecker", "coding", "git-ssh"],
|
|
13
20
|
} as const;
|
|
14
21
|
|
|
15
|
-
/** Load exactly one variant per catalog. Only trusted composition code selects Docker. */
|
|
16
|
-
export function createForgejoRepoChange(options: {
|
|
22
|
+
/** Load exactly one variant per catalog. Only trusted composition code selects Docker. @public */
|
|
23
|
+
export function createForgejoRepoChange(options: {
|
|
24
|
+
/** @public */
|
|
25
|
+
docker: boolean;
|
|
26
|
+
}) {
|
|
17
27
|
if (typeof options.docker !== "boolean") throw new Error("docker must be a boolean");
|
|
18
28
|
const launcher = createForgejoRepoChangeLauncher();
|
|
19
29
|
const process = createForgejoRepoChangeProcess(launcher, options.docker);
|
|
@@ -37,22 +47,18 @@ export function createForgejoRepoChange(options: { docker: boolean }) {
|
|
|
37
47
|
api.onStop(() => launcher.configure(null));
|
|
38
48
|
},
|
|
39
49
|
};
|
|
40
|
-
return {
|
|
50
|
+
return {
|
|
51
|
+
/** @public */
|
|
52
|
+
extension,
|
|
53
|
+
/** @public */
|
|
54
|
+
process,
|
|
55
|
+
/** @internal */
|
|
56
|
+
launcher,
|
|
57
|
+
};
|
|
41
58
|
}
|
|
42
59
|
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
export const {
|
|
48
|
-
extension: defaultExtension,
|
|
49
|
-
process: forgejoRepoChangeProcess,
|
|
50
|
-
launcher: defaultForgejoRepoChangeLauncher,
|
|
51
|
-
} = createForgejoRepoChange({ docker: true });
|
|
52
|
-
export const {
|
|
53
|
-
configure: configureForgejoRepoChangeLauncher,
|
|
54
|
-
preparationChecks: forgejoRepositoryPreparationChecks,
|
|
55
|
-
resolveGitIdentity: resolveForgejoGitIdentity,
|
|
56
|
-
launcher: forgejoRepoChangeUiLauncher,
|
|
57
|
-
} = defaultForgejoRepoChangeLauncher;
|
|
60
|
+
export type { ForgejoRepoChangeParams } from "./params.js";
|
|
61
|
+
|
|
62
|
+
/** @internal */
|
|
63
|
+
const { extension: defaultExtension } = createForgejoRepoChange({ docker: true });
|
|
58
64
|
export default defaultExtension;
|
package/src/launcher.ts
CHANGED
|
@@ -17,15 +17,22 @@ import type { WoodpeckerIntegration } from "@leitwerk-dev/woodpecker";
|
|
|
17
17
|
import { type ForgejoRepoChangeParams, isIssueOrigin } from "./params.js";
|
|
18
18
|
import { type ProfileBindings, resolveProfileBinding } from "./profile-bindings.js";
|
|
19
19
|
|
|
20
|
+
/** @internal */
|
|
20
21
|
export const forgejoRepoChangeUiLauncherId = "forgejo_repo_change_process.ui_launcher" as const;
|
|
21
22
|
|
|
23
|
+
/** @internal */
|
|
22
24
|
export function forgejoRepoChangeParams(
|
|
23
25
|
repository: ForgejoRepository,
|
|
24
26
|
input: {
|
|
27
|
+
/** @internal */
|
|
25
28
|
profile: string;
|
|
29
|
+
/** @internal */
|
|
26
30
|
woodpeckerProfile: string;
|
|
31
|
+
/** @internal */
|
|
27
32
|
sshCredentialRef: string;
|
|
33
|
+
/** @internal */
|
|
28
34
|
prompt: string;
|
|
35
|
+
/** @internal */
|
|
29
36
|
workBranch: string;
|
|
30
37
|
},
|
|
31
38
|
): ForgejoRepoChangeParams {
|
|
@@ -48,6 +55,7 @@ export function forgejoRepoChangeParams(
|
|
|
48
55
|
};
|
|
49
56
|
}
|
|
50
57
|
|
|
58
|
+
/** @internal */
|
|
51
59
|
export function forgejoRepoChangeLaunchConfig(
|
|
52
60
|
params: ForgejoRepoChangeParams,
|
|
53
61
|
title: string,
|
|
@@ -83,16 +91,23 @@ export function forgejoRepoChangeLaunchConfig(
|
|
|
83
91
|
};
|
|
84
92
|
}
|
|
85
93
|
|
|
94
|
+
/** @internal */
|
|
86
95
|
export interface LauncherDependencies {
|
|
96
|
+
/** @internal */
|
|
87
97
|
forgejo: ForgejoIntegration;
|
|
98
|
+
/** @internal */
|
|
88
99
|
gitSsh: GitSshIntegration;
|
|
100
|
+
/** @internal */
|
|
89
101
|
woodpecker: WoodpeckerIntegration;
|
|
102
|
+
/** @internal */
|
|
90
103
|
profileBindings?: ProfileBindings;
|
|
91
104
|
}
|
|
92
105
|
|
|
106
|
+
/** @internal */
|
|
93
107
|
export function createForgejoRepoChangeLauncher() {
|
|
94
108
|
let dependencies: LauncherDependencies | null = null;
|
|
95
109
|
|
|
110
|
+
/** @internal */
|
|
96
111
|
function configureForgejoRepoChangeLauncher(value: LauncherDependencies | null): void {
|
|
97
112
|
dependencies = value;
|
|
98
113
|
}
|
|
@@ -129,6 +144,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
129
144
|
};
|
|
130
145
|
}
|
|
131
146
|
|
|
147
|
+
/** @internal */
|
|
132
148
|
function forgejoRepositoryPreparationChecks(
|
|
133
149
|
_input: unknown,
|
|
134
150
|
{ params }: ProcessLaunchConfig<ForgejoRepoChangeParams>,
|
|
@@ -165,6 +181,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
165
181
|
return { code, fieldId, message };
|
|
166
182
|
}
|
|
167
183
|
|
|
184
|
+
/** @internal */
|
|
168
185
|
function resolveProfiles(profile: string) {
|
|
169
186
|
const { forgejo, woodpecker, gitSsh, profileBindings = {} } = requireDependencies();
|
|
170
187
|
if (!forgejo.profiles().includes(profile)) throw new Error("Forgejo profile is not available");
|
|
@@ -179,6 +196,7 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
179
196
|
return binding;
|
|
180
197
|
}
|
|
181
198
|
|
|
199
|
+
/** @internal */
|
|
182
200
|
async function resolveForgejoGitIdentity(profile: string): Promise<ForgejoGitIdentity> {
|
|
183
201
|
if (!profile) throw new Error("A Forgejo profile is required to resolve Git identity");
|
|
184
202
|
return requireDependencies().forgejo.client(profile).resolveGitIdentity(profile);
|
|
@@ -310,10 +328,15 @@ export function createForgejoRepoChangeLauncher() {
|
|
|
310
328
|
};
|
|
311
329
|
|
|
312
330
|
return {
|
|
331
|
+
/** @internal */
|
|
313
332
|
configure: configureForgejoRepoChangeLauncher,
|
|
333
|
+
/** @internal */
|
|
314
334
|
preparationChecks: forgejoRepositoryPreparationChecks,
|
|
335
|
+
/** @internal */
|
|
315
336
|
resolveProfiles,
|
|
337
|
+
/** @internal */
|
|
316
338
|
resolveGitIdentity: resolveForgejoGitIdentity,
|
|
339
|
+
/** @internal */
|
|
317
340
|
launcher: forgejoRepoChangeUiLauncher,
|
|
318
341
|
};
|
|
319
342
|
}
|
package/src/params.ts
CHANGED
|
@@ -6,40 +6,61 @@ import {
|
|
|
6
6
|
} from "@leitwerk-dev/coding/repository-change-launch";
|
|
7
7
|
import { trimString } from "@leitwerk-dev/domain";
|
|
8
8
|
|
|
9
|
+
/** @public */
|
|
9
10
|
interface ForgejoRepoChangeCommonParams {
|
|
11
|
+
/** @internal */
|
|
10
12
|
forgejoProfile: string;
|
|
13
|
+
/** @internal */
|
|
11
14
|
woodpeckerProfile: string;
|
|
15
|
+
/** @internal */
|
|
12
16
|
sshCredentialRef: string;
|
|
17
|
+
/** @internal */
|
|
13
18
|
owner: string;
|
|
19
|
+
/** @internal */
|
|
14
20
|
repo: string;
|
|
15
21
|
}
|
|
16
22
|
|
|
23
|
+
/** @public */
|
|
17
24
|
export interface ForgejoIssueOriginParams {
|
|
25
|
+
/** @internal */
|
|
18
26
|
origin: "issue";
|
|
27
|
+
/** @internal */
|
|
19
28
|
issueNumber: number;
|
|
29
|
+
/** @internal */
|
|
20
30
|
issueUrl: string;
|
|
31
|
+
/** @internal */
|
|
21
32
|
triggerLabel: string;
|
|
33
|
+
/** @internal */
|
|
22
34
|
doneLabel: string;
|
|
23
35
|
}
|
|
24
36
|
|
|
37
|
+
/** @public */
|
|
25
38
|
export interface ForgejoUiOriginParams {
|
|
39
|
+
/** @internal */
|
|
26
40
|
origin: "ui";
|
|
41
|
+
/** @internal */
|
|
27
42
|
issueNumber: null;
|
|
43
|
+
/** @internal */
|
|
28
44
|
issueUrl: null;
|
|
45
|
+
/** @internal */
|
|
29
46
|
triggerLabel: null;
|
|
47
|
+
/** @internal */
|
|
30
48
|
doneLabel: null;
|
|
31
49
|
}
|
|
32
50
|
|
|
51
|
+
/** @public */
|
|
33
52
|
export type ForgejoRepoChangeParams = RepositoryChangeLaunchParams<
|
|
34
53
|
ForgejoRepoChangeCommonParams & (ForgejoIssueOriginParams | ForgejoUiOriginParams)
|
|
35
54
|
>;
|
|
36
55
|
|
|
56
|
+
/** @internal */
|
|
37
57
|
export function isIssueOrigin(
|
|
38
58
|
params: ForgejoRepoChangeParams,
|
|
39
59
|
): params is ForgejoRepoChangeParams & ForgejoIssueOriginParams {
|
|
40
60
|
return params.origin === "issue";
|
|
41
61
|
}
|
|
42
62
|
|
|
63
|
+
/** @internal */
|
|
43
64
|
export const forgejoRepoChangeParamsCodec =
|
|
44
65
|
createRepositoryChangeParamsCodec<ForgejoRepoChangeParams>({
|
|
45
66
|
displayName: "Forgejo Repo Change",
|
package/src/process.ts
CHANGED
package/src/profile-bindings.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
|
-
/** Server-owned, non-secret wiring for future launches. */
|
|
1
|
+
/** Server-owned, non-secret wiring for future launches. @internal */
|
|
2
2
|
export interface ProfileBinding {
|
|
3
|
+
/** @internal */
|
|
3
4
|
woodpeckerProfile: string;
|
|
5
|
+
/** @internal */
|
|
4
6
|
sshCredentialRef: string;
|
|
5
7
|
}
|
|
8
|
+
/** @internal */
|
|
6
9
|
export type ProfileBindings = Readonly<Record<string, Readonly<ProfileBinding>>>;
|
|
7
10
|
|
|
8
11
|
function record(value: unknown, label: string): Record<string, unknown> {
|
|
@@ -16,6 +19,7 @@ function field(value: unknown, fallback: string, label: string): string {
|
|
|
16
19
|
throw new Error(`${label} must be a non-empty string`);
|
|
17
20
|
return value.trim();
|
|
18
21
|
}
|
|
22
|
+
/** @internal */
|
|
19
23
|
export function parseProfileBindings(raw: unknown): ProfileBindings {
|
|
20
24
|
const config = raw === undefined ? {} : record(raw, "forgejo-repo-change configuration");
|
|
21
25
|
if (config.profile_bindings === undefined) return Object.freeze({});
|
|
@@ -47,6 +51,7 @@ export function parseProfileBindings(raw: unknown): ProfileBindings {
|
|
|
47
51
|
});
|
|
48
52
|
return Object.freeze(Object.fromEntries(entries));
|
|
49
53
|
}
|
|
54
|
+
/** @internal */
|
|
50
55
|
export function resolveProfileBinding(bindings: ProfileBindings, profile: string): ProfileBinding {
|
|
51
56
|
return Object.hasOwn(bindings, profile)
|
|
52
57
|
? { ...bindings[profile] }
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { forgejoRepoChangeProcess as process } from "./testing/default-process.js";
|
|
2
|
+
|
|
3
|
+
export function deliveryTurn() {
|
|
4
|
+
const turn = process.turns.get("deliver_change")?.definition;
|
|
5
|
+
if (turn?.kind !== "automatic") throw new Error("Missing delivery turn");
|
|
6
|
+
return turn;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function routingState(
|
|
10
|
+
forgejoRepoChange: Record<string, unknown>,
|
|
11
|
+
extensionState: Record<string, unknown> = {},
|
|
12
|
+
) {
|
|
13
|
+
return process.stateCodec.parse({ extensionState: { ...extensionState, forgejoRepoChange } });
|
|
14
|
+
}
|