@ticatec/omniflow 0.1.5

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.

Potentially problematic release.


This version of @ticatec/omniflow might be problematic. Click here for more details.

Files changed (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +476 -0
  3. package/dist/cli/commands/run.d.ts +7 -0
  4. package/dist/cli/commands/run.d.ts.map +1 -0
  5. package/dist/cli/commands/run.js +242 -0
  6. package/dist/cli/commands/run.js.map +1 -0
  7. package/dist/cli/index.d.ts +3 -0
  8. package/dist/cli/index.d.ts.map +1 -0
  9. package/dist/cli/index.js +211 -0
  10. package/dist/cli/index.js.map +1 -0
  11. package/dist/config/index.d.ts +2 -0
  12. package/dist/config/index.d.ts.map +1 -0
  13. package/dist/config/index.js +3 -0
  14. package/dist/config/index.js.map +1 -0
  15. package/dist/config/omniflow.d.ts +115 -0
  16. package/dist/config/omniflow.d.ts.map +1 -0
  17. package/dist/config/omniflow.js +451 -0
  18. package/dist/config/omniflow.js.map +1 -0
  19. package/dist/core/git.d.ts +22 -0
  20. package/dist/core/git.d.ts.map +1 -0
  21. package/dist/core/git.js +164 -0
  22. package/dist/core/git.js.map +1 -0
  23. package/dist/core/strategies/BaseMergeRequest.d.ts +58 -0
  24. package/dist/core/strategies/BaseMergeRequest.d.ts.map +1 -0
  25. package/dist/core/strategies/BaseMergeRequest.js +57 -0
  26. package/dist/core/strategies/BaseMergeRequest.js.map +1 -0
  27. package/dist/core/strategies/ForgejoRequest.d.ts +35 -0
  28. package/dist/core/strategies/ForgejoRequest.d.ts.map +1 -0
  29. package/dist/core/strategies/ForgejoRequest.js +82 -0
  30. package/dist/core/strategies/ForgejoRequest.js.map +1 -0
  31. package/dist/core/strategies/GitHubRequest.d.ts +34 -0
  32. package/dist/core/strategies/GitHubRequest.d.ts.map +1 -0
  33. package/dist/core/strategies/GitHubRequest.js +84 -0
  34. package/dist/core/strategies/GitHubRequest.js.map +1 -0
  35. package/dist/core/strategies/GitLabRequest.d.ts +25 -0
  36. package/dist/core/strategies/GitLabRequest.d.ts.map +1 -0
  37. package/dist/core/strategies/GitLabRequest.js +70 -0
  38. package/dist/core/strategies/GitLabRequest.js.map +1 -0
  39. package/dist/core/strategies/index.d.ts +36 -0
  40. package/dist/core/strategies/index.d.ts.map +1 -0
  41. package/dist/core/strategies/index.js +50 -0
  42. package/dist/core/strategies/index.js.map +1 -0
  43. package/dist/core/strategies/types.d.ts +22 -0
  44. package/dist/core/strategies/types.d.ts.map +1 -0
  45. package/dist/core/strategies/types.js +5 -0
  46. package/dist/core/strategies/types.js.map +1 -0
  47. package/dist/index.d.ts +2 -0
  48. package/dist/index.d.ts.map +1 -0
  49. package/dist/index.js +3 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/types/config.d.ts +63 -0
  52. package/dist/types/config.d.ts.map +1 -0
  53. package/dist/types/config.js +3 -0
  54. package/dist/types/config.js.map +1 -0
  55. package/package.json +88 -0
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Base class for merge request strategies
3
+ * Implements template method pattern to eliminate code duplication
4
+ */
5
+ import type { MergeRequestStrategy } from './types.js';
6
+ /**
7
+ * Abstract base class for merge request strategies
8
+ */
9
+ export default abstract class BaseMergeRequest implements MergeRequestStrategy {
10
+ abstract readonly platform: string;
11
+ protected abstract readonly idPrefix: string;
12
+ /**
13
+ * Check if a pull/merge request already exists
14
+ * @param repoInfo - Repository info
15
+ * @param source - Source branch name
16
+ * @param target - Target branch name
17
+ */
18
+ protected abstract checkExists(repoInfo: any, source: string, target: string): Promise<{
19
+ exists: boolean;
20
+ id?: string | number;
21
+ }>;
22
+ /**
23
+ * Create a new pull/merge request
24
+ * @param repoInfo - Repository info
25
+ * @param source - Source branch name
26
+ * @param target - Target branch name
27
+ */
28
+ protected abstract createRequest(repoInfo: any, source: string, target: string): Promise<{
29
+ id: string | number;
30
+ }>;
31
+ /**
32
+ * Accept and merge a PR/MR
33
+ * @param repoInfo - Repository info
34
+ * @param id - PR/MR ID
35
+ * @param method - Merge method: 'merge', 'squash', or 'rebase'
36
+ */
37
+ protected abstract acceptMergeRequest(repoInfo: any, id: string | number, method?: string): Promise<void>;
38
+ /**
39
+ * Format success message when PR/MR is created
40
+ */
41
+ protected formatSuccessMessage(id: string | number): string;
42
+ /**
43
+ * Format message when PR/MR already exists
44
+ */
45
+ protected formatExistsMessage(id: string | number): string;
46
+ /**
47
+ * Format message when PR/MR is merged
48
+ */
49
+ protected formatMergedMessage(id: string | number): string;
50
+ /**
51
+ * Create a merge request and auto-merge it (template method)
52
+ * @param repoInfo - Repository info { platform, owner, repo, serverUrl, token }
53
+ * @param source - Source branch name
54
+ * @param target - Target branch name
55
+ */
56
+ create(repoInfo: any, source: string, target: string): Promise<void>;
57
+ }
58
+ //# sourceMappingURL=BaseMergeRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseMergeRequest.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/BaseMergeRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAA;AAEpD;;GAEG;AACH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,gBAAiB,YAAW,oBAAoB;IAE1E,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAClC,SAAS,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAE5C;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,WAAW,CAC1B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAErD;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,aAAa,CAC5B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAEnC;;;;;OAKG;IACH,SAAS,CAAC,QAAQ,CAAC,kBAAkB,CACjC,QAAQ,EAAE,GAAG,EACb,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,MAAM,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAEhB;;OAEG;IACH,SAAS,CAAC,oBAAoB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAI3D;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAI1D;;OAEG;IACH,SAAS,CAAC,mBAAmB,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM;IAI1D;;;;;OAKG;IACG,MAAM,CACR,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;CAuBnB"}
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Base class for merge request strategies
3
+ * Implements template method pattern to eliminate code duplication
4
+ */
5
+ /**
6
+ * Abstract base class for merge request strategies
7
+ */
8
+ export default class BaseMergeRequest {
9
+ /**
10
+ * Format success message when PR/MR is created
11
+ */
12
+ formatSuccessMessage(id) {
13
+ return ` ✓ PR/MR created: ${this.idPrefix}${id}`;
14
+ }
15
+ /**
16
+ * Format message when PR/MR already exists
17
+ */
18
+ formatExistsMessage(id) {
19
+ return ` ℹ️ PR/MR already exists: ${this.idPrefix}${id}`;
20
+ }
21
+ /**
22
+ * Format message when PR/MR is merged
23
+ */
24
+ formatMergedMessage(id) {
25
+ return ` ✓ PR/MR merged: ${this.idPrefix}${id}`;
26
+ }
27
+ /**
28
+ * Create a merge request and auto-merge it (template method)
29
+ * @param repoInfo - Repository info { platform, owner, repo, serverUrl, token }
30
+ * @param source - Source branch name
31
+ * @param target - Target branch name
32
+ */
33
+ async create(repoInfo, source, target) {
34
+ try {
35
+ let mrId;
36
+ // Check if already exists
37
+ const checkResult = await this.checkExists(repoInfo, source, target);
38
+ if (checkResult.exists && checkResult.id) {
39
+ mrId = checkResult.id;
40
+ console.log(this.formatExistsMessage(mrId));
41
+ }
42
+ else {
43
+ // Create new
44
+ const result = await this.createRequest(repoInfo, source, target);
45
+ mrId = result.id;
46
+ console.log(this.formatSuccessMessage(mrId));
47
+ }
48
+ // Auto merge
49
+ await this.acceptMergeRequest(repoInfo, mrId);
50
+ console.log(this.formatMergedMessage(mrId));
51
+ }
52
+ catch (error) {
53
+ console.log(` ⚠️ API error: ${error.message}`);
54
+ }
55
+ }
56
+ }
57
+ //# sourceMappingURL=BaseMergeRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseMergeRequest.js","sourceRoot":"","sources":["../../../src/core/strategies/BaseMergeRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,MAAM,CAAC,OAAO,OAAgB,gBAAgB;IAyC1C;;OAEG;IACO,oBAAoB,CAAC,EAAmB;QAC9C,OAAO,sBAAsB,IAAI,CAAC,QAAQ,GAAG,EAAE,EAAE,CAAA;IACrD,CAAC;IAED;;OAEG;IACO,mBAAmB,CAAC,EAAmB;QAC7C,OAAO,+BAA+B,IAAI,CAAC,QAAQ,GAAG,EAAE,EAAE,CAAA;IAC9D,CAAC;IAED;;OAEG;IACO,mBAAmB,CAAC,EAAmB;QAC7C,OAAO,qBAAqB,IAAI,CAAC,QAAQ,GAAG,EAAE,EAAE,CAAA;IACpD,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,MAAM,CACR,QAAa,EACb,MAAc,EACd,MAAc;QAEd,IAAI,CAAC;YACD,IAAI,IAAqB,CAAA;YAEzB,0BAA0B;YAC1B,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;YACpE,IAAI,WAAW,CAAC,MAAM,IAAI,WAAW,CAAC,EAAE,EAAE,CAAC;gBACvC,IAAI,GAAG,WAAW,CAAC,EAAE,CAAA;gBACrB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAA;YAC/C,CAAC;iBAAM,CAAC;gBACJ,aAAa;gBACb,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,CAAA;gBACjE,IAAI,GAAG,MAAM,CAAC,EAAE,CAAA;gBAChB,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAA;YAChD,CAAC;YAED,aAAa;YACb,MAAM,IAAI,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;YAC7C,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAA;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CAAC,oBAAqB,KAAe,CAAC,OAAO,EAAE,CAAC,CAAA;QAC/D,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Forgejo/Gitea pull request strategy
3
+ * Handles PR creation and merge for Forgejo and Gitea instances
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging Forgejo/Gitea pull requests
8
+ * Compatible with Gitea API v1
9
+ */
10
+ export default class ForgejoRequest extends BaseMergeRequest {
11
+ readonly platform = "forgejo";
12
+ protected readonly idPrefix = "#";
13
+ /**
14
+ * Build Forgejo/Gitea API URL for the repository
15
+ */
16
+ protected buildApiUrl(repoInfo: any): string;
17
+ /**
18
+ * Check if a PR already exists on Forgejo/Gitea
19
+ */
20
+ protected checkExists(repoInfo: any, source: string, target: string): Promise<{
21
+ exists: boolean;
22
+ id?: string | number;
23
+ }>;
24
+ /**
25
+ * Create a new Forgejo/Gitea PR
26
+ */
27
+ protected createRequest(repoInfo: any, source: string, target: string): Promise<{
28
+ id: string | number;
29
+ }>;
30
+ /**
31
+ * Merge a Forgejo/Gitea PR
32
+ */
33
+ protected acceptMergeRequest(repoInfo: any, id: string | number, _method?: string): Promise<void>;
34
+ }
35
+ //# sourceMappingURL=ForgejoRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgejoRequest.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/ForgejoRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AAEpD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;IACxD,QAAQ,CAAC,QAAQ,aAAY;IAC7B,SAAS,CAAC,QAAQ,CAAC,QAAQ,OAAM;IAEjC;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM;IAI5C;;OAEG;cACa,WAAW,CACvB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAqBrD;;OAEG;cACa,aAAa,CACzB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAwBnC;;OAEG;cACa,kBAAkB,CAC9B,QAAQ,EAAE,GAAG,EACb,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,OAAO,GAAE,MAAgB,GAC1B,OAAO,CAAC,IAAI,CAAC;CAiBnB"}
@@ -0,0 +1,82 @@
1
+ /**
2
+ * Forgejo/Gitea pull request strategy
3
+ * Handles PR creation and merge for Forgejo and Gitea instances
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging Forgejo/Gitea pull requests
8
+ * Compatible with Gitea API v1
9
+ */
10
+ export default class ForgejoRequest extends BaseMergeRequest {
11
+ platform = 'forgejo';
12
+ idPrefix = '#';
13
+ /**
14
+ * Build Forgejo/Gitea API URL for the repository
15
+ */
16
+ buildApiUrl(repoInfo) {
17
+ return `${repoInfo.serverUrl}/api/v1/repos/${repoInfo.owner}/${repoInfo.repo}/pulls`;
18
+ }
19
+ /**
20
+ * Check if a PR already exists on Forgejo/Gitea
21
+ */
22
+ async checkExists(repoInfo, source, target) {
23
+ const apiUrl = this.buildApiUrl(repoInfo);
24
+ const response = await fetch(`${apiUrl}?state=open&head=${source}&base=${target}`, {
25
+ headers: {
26
+ 'Authorization': `token ${repoInfo.token}`,
27
+ 'Accept': 'application/json'
28
+ }
29
+ });
30
+ if (response.ok) {
31
+ const result = await response.json();
32
+ if (result.length > 0 && result[0]?.number) {
33
+ return { exists: true, id: result[0].number };
34
+ }
35
+ }
36
+ return { exists: false };
37
+ }
38
+ /**
39
+ * Create a new Forgejo/Gitea PR
40
+ */
41
+ async createRequest(repoInfo, source, target) {
42
+ const apiUrl = this.buildApiUrl(repoInfo);
43
+ const response = await fetch(apiUrl, {
44
+ method: 'POST',
45
+ headers: {
46
+ 'Authorization': `token ${repoInfo.token}`,
47
+ 'Accept': 'application/json',
48
+ 'Content-Type': 'application/json'
49
+ },
50
+ body: JSON.stringify({
51
+ title: `Merge ${source} into ${target}`,
52
+ head: source,
53
+ base: target
54
+ })
55
+ });
56
+ if (!response.ok) {
57
+ throw new Error(response.statusText);
58
+ }
59
+ const pr = await response.json();
60
+ return { id: pr.number };
61
+ }
62
+ /**
63
+ * Merge a Forgejo/Gitea PR
64
+ */
65
+ async acceptMergeRequest(repoInfo, id, _method = 'merge') {
66
+ const apiUrl = this.buildApiUrl(repoInfo);
67
+ const response = await fetch(`${apiUrl}/${id}/merge`, {
68
+ method: 'POST',
69
+ headers: {
70
+ 'Authorization': `token ${repoInfo.token}`,
71
+ 'Content-Type': 'application/json'
72
+ },
73
+ body: JSON.stringify({
74
+ Do: 'merge'
75
+ })
76
+ });
77
+ if (!response.ok) {
78
+ throw new Error(response.statusText);
79
+ }
80
+ }
81
+ }
82
+ //# sourceMappingURL=ForgejoRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ForgejoRequest.js","sourceRoot":"","sources":["../../../src/core/strategies/ForgejoRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AAEpD;;;GAGG;AACH,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAAgB;IAC/C,QAAQ,GAAG,SAAS,CAAA;IACV,QAAQ,GAAG,GAAG,CAAA;IAEjC;;OAEG;IACO,WAAW,CAAC,QAAa;QAC/B,OAAO,GAAG,QAAQ,CAAC,SAAS,iBAAiB,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,QAAQ,CAAA;IACxF,CAAC;IAED;;OAEG;IACO,KAAK,CAAC,WAAW,CACvB,QAAa,EACb,MAAc,EACd,MAAc;QAEd,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,MAAM,oBAAoB,MAAM,SAAS,MAAM,EAAE,EACpD;YACI,OAAO,EAAE;gBACL,eAAe,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;gBAC1C,QAAQ,EAAE,kBAAkB;aAC/B;SACJ,CACJ,CAAA;QAED,IAAI,QAAQ,CAAC,EAAE,EAAE,CAAC;YACd,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAS,CAAA;YAC3C,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC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AAQ,EAAE;YAClD,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACL,eAAe,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAE;gBAC1C,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,EAAE,EAAE,OAAO;aACd,CAAC;SACL,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACxC,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * GitHub pull request strategy
3
+ * Handles PR creation and merge for GitHub.com and GitHub Enterprise
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging GitHub pull requests
8
+ */
9
+ export default class GitHubRequest extends BaseMergeRequest {
10
+ readonly platform = "github";
11
+ protected readonly idPrefix = "#";
12
+ /**
13
+ * Build GitHub API URL for the repository
14
+ */
15
+ protected buildApiUrl(repoInfo: any): string;
16
+ /**
17
+ * Check if a PR already exists on GitHub
18
+ */
19
+ protected checkExists(repoInfo: any, source: string, target: string): Promise<{
20
+ exists: boolean;
21
+ id?: string | number;
22
+ }>;
23
+ /**
24
+ * Create a new GitHub PR
25
+ */
26
+ protected createRequest(repoInfo: any, source: string, target: string): Promise<{
27
+ id: string | number;
28
+ }>;
29
+ /**
30
+ * Merge a GitHub PR
31
+ */
32
+ protected acceptMergeRequest(repoInfo: any, id: string | number, method?: string): Promise<void>;
33
+ }
34
+ //# sourceMappingURL=GitHubRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubRequest.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/GitHubRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAQ,gBAAgB,MAAO,uBAAuB,CAAA;AAEtD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,gBAAgB;IACzD,QAAQ,CAAC,QAAQ,YAAW;IAC5B,SAAS,CAAC,QAAQ,CAAC,QAAQ,OAAM;IAEjC;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM;IAK5C;;OAEG;cACa,WAAW,CACzB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAqBrD;;OAEG;cACa,aAAa,CAC3B,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAwBnC;;OAEG;cACa,kBAAkB,CAChC,QAAQ,EAAE,GAAG,EACb,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,MAAM,GAAE,MAAgB,GACvB,OAAO,CAAC,IAAI,CAAC;CAmBjB"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * GitHub pull request strategy
3
+ * Handles PR creation and merge for GitHub.com and GitHub Enterprise
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging GitHub pull requests
8
+ */
9
+ export default class GitHubRequest extends BaseMergeRequest {
10
+ platform = 'github';
11
+ idPrefix = '#';
12
+ /**
13
+ * Build GitHub API URL for the repository
14
+ */
15
+ buildApiUrl(repoInfo) {
16
+ const apiBase = repoInfo.serverUrl?.replace('github.com', 'api.github.com') || 'https://api.github.com';
17
+ return `${apiBase}/repos/${repoInfo.owner}/${repoInfo.repo}/pulls`;
18
+ }
19
+ /**
20
+ * Check if a PR already exists on GitHub
21
+ */
22
+ async checkExists(repoInfo, source, target) {
23
+ const apiUrl = this.buildApiUrl(repoInfo);
24
+ const response = await fetch(`${apiUrl}?head=${repoInfo.owner}:${source}&base=${target}&state=open`, {
25
+ headers: {
26
+ 'Authorization': `Bearer ${repoInfo.token}`,
27
+ 'Accept': 'application/vnd.github.v3+json'
28
+ }
29
+ });
30
+ if (response.ok) {
31
+ const prs = await response.json();
32
+ if (prs.length > 0) {
33
+ return { exists: true, id: prs[0].number };
34
+ }
35
+ }
36
+ return { exists: false };
37
+ }
38
+ /**
39
+ * Create a new GitHub PR
40
+ */
41
+ async createRequest(repoInfo, source, target) {
42
+ const apiUrl = this.buildApiUrl(repoInfo);
43
+ const response = await fetch(apiUrl, {
44
+ method: 'POST',
45
+ headers: {
46
+ 'Authorization': `Bearer ${repoInfo.token}`,
47
+ 'Accept': 'application/vnd.github.v3+json',
48
+ 'Content-Type': 'application/json'
49
+ },
50
+ body: JSON.stringify({
51
+ title: `Merge ${source} into ${target}`,
52
+ head: `${repoInfo.owner}:${source}`,
53
+ base: target
54
+ })
55
+ });
56
+ if (!response.ok) {
57
+ throw new Error(response.statusText);
58
+ }
59
+ const pr = await response.json();
60
+ return { id: pr.number };
61
+ }
62
+ /**
63
+ * Merge a GitHub PR
64
+ */
65
+ async acceptMergeRequest(repoInfo, id, method = 'merge') {
66
+ const apiUrl = this.buildApiUrl(repoInfo);
67
+ const response = await fetch(`${apiUrl}/${id}/merge`, {
68
+ method: 'PUT',
69
+ headers: {
70
+ 'Authorization': `Bearer ${repoInfo.token}`,
71
+ 'Accept': 'application/vnd.github.v3+json',
72
+ 'Content-Type': 'application/json'
73
+ },
74
+ body: JSON.stringify({
75
+ commit_title: `Merge PR #${id}`,
76
+ merge_method: method
77
+ })
78
+ });
79
+ if (!response.ok) {
80
+ throw new Error(response.statusText);
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=GitHubRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitHubRequest.js","sourceRoot":"","sources":["../../../src/core/strategies/GitHubRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;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EF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,25 @@
1
+ /**
2
+ * GitLab merge request strategy
3
+ * Handles MR creation and merge for GitLab.com and self-hosted GitLab instances
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging GitLab merge requests
8
+ */
9
+ export default class GitLabRequest extends BaseMergeRequest {
10
+ readonly platform = "gitlab";
11
+ protected readonly idPrefix = "!";
12
+ /**
13
+ * Build GitLab API URL for the repository
14
+ */
15
+ protected buildApiUrl(repoInfo: any): string;
16
+ protected checkExists(repoInfo: any, source: string, target: string): Promise<{
17
+ exists: boolean;
18
+ id?: string | number;
19
+ }>;
20
+ protected createRequest(repoInfo: any, source: string, target: string): Promise<{
21
+ id: string | number;
22
+ }>;
23
+ protected acceptMergeRequest(repoInfo: any, id: string | number, _method?: string): Promise<void>;
24
+ }
25
+ //# sourceMappingURL=GitLabRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitLabRequest.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/GitLabRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AAEpD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,gBAAgB;IACvD,QAAQ,CAAC,QAAQ,YAAW;IAC5B,SAAS,CAAC,QAAQ,CAAC,QAAQ,OAAM;IAEjC;;OAEG;IACH,SAAS,CAAC,WAAW,CAAC,QAAQ,EAAE,GAAG,GAAG,MAAM;cAK5B,WAAW,CACvB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,MAAM,EAAE,OAAO,CAAC;QAAC,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;cAkBrC,aAAa,CACzB,QAAQ,EAAE,GAAG,EACb,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACf,OAAO,CAAC;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;cAuBnB,kBAAkB,CAC9B,QAAQ,EAAE,GAAG,EACb,EAAE,EAAE,MAAM,GAAG,MAAM,EACnB,OAAO,GAAE,MAAgB,GAC1B,OAAO,CAAC,IAAI,CAAC;CAkBnB"}
@@ -0,0 +1,70 @@
1
+ /**
2
+ * GitLab merge request strategy
3
+ * Handles MR creation and merge for GitLab.com and self-hosted GitLab instances
4
+ */
5
+ import BaseMergeRequest from './BaseMergeRequest.js';
6
+ /**
7
+ * Strategy for creating and merging GitLab merge requests
8
+ */
9
+ export default class GitLabRequest extends BaseMergeRequest {
10
+ platform = 'gitlab';
11
+ idPrefix = '!';
12
+ /**
13
+ * Build GitLab API URL for the repository
14
+ */
15
+ buildApiUrl(repoInfo) {
16
+ const apiBase = `${repoInfo.serverUrl}/api/v4`;
17
+ return `${apiBase}/projects/${encodeURIComponent(`${repoInfo.owner}/${repoInfo.repo}`)}/merge_requests`;
18
+ }
19
+ async checkExists(repoInfo, source, target) {
20
+ const apiUrl = this.buildApiUrl(repoInfo);
21
+ const response = await fetch(`${apiUrl}?source_branch=${source}&target_branch=${target}&state=opened`, {
22
+ headers: { 'PRIVATE-TOKEN': repoInfo.token }
23
+ });
24
+ if (response.ok) {
25
+ const mrs = await response.json();
26
+ if (mrs.length > 0) {
27
+ return { exists: true, id: mrs[0].iid };
28
+ }
29
+ }
30
+ return { exists: false };
31
+ }
32
+ async createRequest(repoInfo, source, target) {
33
+ const apiUrl = this.buildApiUrl(repoInfo);
34
+ const response = await fetch(apiUrl, {
35
+ method: 'POST',
36
+ headers: {
37
+ 'PRIVATE-TOKEN': repoInfo.token,
38
+ 'Content-Type': 'application/json'
39
+ },
40
+ body: JSON.stringify({
41
+ source_branch: source,
42
+ target_branch: target,
43
+ title: `Merge ${source} into ${target}`
44
+ })
45
+ });
46
+ if (!response.ok) {
47
+ throw new Error(response.statusText);
48
+ }
49
+ const mr = await response.json();
50
+ return { id: mr.iid };
51
+ }
52
+ async acceptMergeRequest(repoInfo, id, _method = 'merge') {
53
+ const apiUrl = this.buildApiUrl(repoInfo);
54
+ const response = await fetch(`${apiUrl}/${id}/merge`, {
55
+ method: 'PUT',
56
+ headers: {
57
+ 'PRIVATE-TOKEN': repoInfo.token,
58
+ 'Content-Type': 'application/json'
59
+ },
60
+ body: JSON.stringify({
61
+ merge_when_pipeline_succeeds: false,
62
+ should_remove_source_branch: true
63
+ })
64
+ });
65
+ if (!response.ok) {
66
+ throw new Error(response.statusText);
67
+ }
68
+ }
69
+ }
70
+ //# sourceMappingURL=GitLabRequest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"GitLabRequest.js","sourceRoot":"","sources":["../../../src/core/strategies/GitLabRequest.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,gBAAgB,MAAM,uBAAuB,CAAA;AAEpD;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,aAAc,SAAQ,gBAAgB;IAC9C,QAAQ,GAAG,QAAQ,CAAA;IACT,QAAQ,GAAG,GAAG,CAAA;IAEjC;;OAEG;IACO,WAAW,CAAC,QAAa;QAC/B,MAAM,OAAO,GAAG,GAAG,QAAQ,CAAC,SAAS,SAAS,CAAA;QAC9C,OAAO,GAAG,OAAO,aAAa,kBAAkB,CAAC,GAAG,QAAQ,CAAC,KAAK,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,iBAAiB,CAAA;IAC3G,CAAC;IAES,KAAK,CAAC,WAAW,CACvB,QAAa,EACb,MAAc,EACd,MAAc;QAEd,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CACxB,GAAG,MAAM,kBAAk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UAAkB,OAAO;QAEzB,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAA;QACzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,MAAM,IAAI,EAAE,QAAQ,EAAE;YAClD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE;gBACL,eAAe,EAAE,QAAQ,CAAC,KAAK;gBAC/B,cAAc,EAAE,kBAAkB;aACrC;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;gBACjB,4BAA4B,EAAE,KAAK;gBACnC,2BAA2B,EAAE,IAAI;aACpC,CAAC;SACL,CAAC,CAAA;QAEF,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACxC,CAAC;IACL,CAAC;CACJ"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Merge request strategy registry
3
+ *
4
+ * Manages available strategies for creating pull/merge requests
5
+ * across different platforms (GitHub, GitLab, Forgejo, etc.)
6
+ */
7
+ import type { MergeRequestStrategy } from './types.js';
8
+ /**
9
+ * Registry for merge request strategies
10
+ * Allows registration and retrieval of platform-specific strategies
11
+ */
12
+ declare class MergeRequestStrategyRegistry {
13
+ private strategies;
14
+ constructor();
15
+ /**
16
+ * Register a new strategy
17
+ * @param strategy - The strategy to register
18
+ */
19
+ register(strategy: MergeRequestStrategy): void;
20
+ /**
21
+ * Get a strategy by name
22
+ * @param name - Strategy platform name (e.g., 'github', 'gitlab', 'forgejo')
23
+ * @returns The strategy or undefined if not found
24
+ */
25
+ get(name: string): MergeRequestStrategy | undefined;
26
+ /**
27
+ * List all registered strategy names
28
+ * @returns Array of platform names
29
+ */
30
+ listStrategies(): string[];
31
+ }
32
+ /** Global strategy registry instance */
33
+ export declare const strategyRegistry: MergeRequestStrategyRegistry;
34
+ export * from './types.js';
35
+ export { default as BaseMergeRequest } from './BaseMergeRequest.js';
36
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,YAAY,CAAA;AAEpD;;;GAGG;AACH,cAAM,4BAA4B;IAC9B,OAAO,CAAC,UAAU,CAA0C;;IAS5D;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,GAAG,IAAI;IAI9C;;;;OAIG;IACH,GAAG,CAAC,IAAI,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS;IAInD;;;OAGG;IACH,cAAc,IAAI,MAAM,EAAE;CAG7B;AAED,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,8BAAqC,CAAA;AAGlE,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Merge request strategy registry
3
+ *
4
+ * Manages available strategies for creating pull/merge requests
5
+ * across different platforms (GitHub, GitLab, Forgejo, etc.)
6
+ */
7
+ import GitHubRequest from './GitHubRequest.js';
8
+ import GitLabRequest from './GitLabRequest.js';
9
+ import ForgejoRequest from './ForgejoRequest.js';
10
+ /**
11
+ * Registry for merge request strategies
12
+ * Allows registration and retrieval of platform-specific strategies
13
+ */
14
+ class MergeRequestStrategyRegistry {
15
+ strategies = new Map();
16
+ constructor() {
17
+ // Register built-in strategies
18
+ this.register(new GitHubRequest());
19
+ this.register(new GitLabRequest());
20
+ this.register(new ForgejoRequest());
21
+ }
22
+ /**
23
+ * Register a new strategy
24
+ * @param strategy - The strategy to register
25
+ */
26
+ register(strategy) {
27
+ this.strategies.set(strategy.platform, strategy);
28
+ }
29
+ /**
30
+ * Get a strategy by name
31
+ * @param name - Strategy platform name (e.g., 'github', 'gitlab', 'forgejo')
32
+ * @returns The strategy or undefined if not found
33
+ */
34
+ get(name) {
35
+ return this.strategies.get(name);
36
+ }
37
+ /**
38
+ * List all registered strategy names
39
+ * @returns Array of platform names
40
+ */
41
+ listStrategies() {
42
+ return Array.from(this.strategies.keys());
43
+ }
44
+ }
45
+ /** Global strategy registry instance */
46
+ export const strategyRegistry = new MergeRequestStrategyRegistry();
47
+ // Type exports
48
+ export * from './types.js';
49
+ export { default as BaseMergeRequest } from './BaseMergeRequest.js';
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/strategies/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAC9C,OAAO,aAAa,MAAM,oBAAoB,CAAA;AAC9C,OAAO,cAAc,MAAM,qBAAqB,CAAA;AAGhD;;;GAGG;AACH,MAAM,4BAA4B;IACtB,UAAU,GAAG,IAAI,GAAG,EAAgC,CAAA;IAE5D;QACI,+BAA+B;QAC/B,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAA;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,aAAa,EAAE,CAAC,CAAA;QAClC,IAAI,CAAC,QAAQ,CAAC,IAAI,cAAc,EAAE,CAAC,CAAA;IACvC,CAAC;IAED;;;OAGG;IACH,QAAQ,CAAC,QAA8B;QACnC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;IACpD,CAAC;IAED;;;;OAIG;IACH,GAAG,CAAC,IAAY;QACZ,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACpC,CAAC;IAED;;;OAGG;IACH,cAAc;QACV,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC,CAAA;IAC7C,CAAC;CACJ;AAED,wCAAwC;AACxC,MAAM,CAAC,MAAM,gBAAgB,GAAG,IAAI,4BAA4B,EAAE,CAAA;AAElE,eAAe;AACf,cAAc,YAAY,CAAA;AAC1B,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,uBAAuB,CAAA"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Merge request strategy types
3
+ */
4
+ /**
5
+ * Strategy interface for creating merge requests/pull requests
6
+ * Different platforms (GitHub, GitLab, etc.) implement this interface
7
+ */
8
+ export interface MergeRequestStrategy {
9
+ /**
10
+ * Platform name
11
+ */
12
+ readonly platform: string;
13
+ /**
14
+ * Create a merge request and auto-merge it
15
+ * @param repoInfo - Repository info { platform, owner, repo, serverUrl, token }
16
+ * @param source - Source branch name
17
+ * @param target - Target branch name
18
+ * @param mergeMethod - Merge method: 'merge', 'squash', or 'rebase'
19
+ */
20
+ create(repoInfo: any, source: string, target: string, mergeMethod?: string): Promise<void>;
21
+ }
22
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/core/strategies/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;IAEzB;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC3F"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Merge request strategy types
3
+ */
4
+ export {};
5
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/core/strategies/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
@@ -0,0 +1,2 @@
1
+ export * from './types/config.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,mBAAmB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ // Main exports
2
+ export * from './types/config.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,eAAe;AAEf,cAAc,mBAAmB,CAAA"}