plugin-git-manager 1.2.26 → 1.2.28

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 (108) hide show
  1. package/README.md +133 -108
  2. package/client-v2.d.ts +2 -2
  3. package/client-v2.js +1 -1
  4. package/client.d.ts +3 -3
  5. package/client.js +1 -1
  6. package/dist/client/{326.90c276058682b536.js → 313.d38fc1d40c4589b9.js} +1 -1
  7. package/dist/client/900.a48beac7e2ebee7d.js +10 -0
  8. package/dist/client/index.js +1 -1
  9. package/dist/client-v2/156.445366026c1cc9a8.js +10 -0
  10. package/dist/client-v2/{326.42b7b53651ffab3a.js → 313.3c867179c3a1e817.js} +1 -1
  11. package/dist/client-v2/434.19c7579c06b9077c.js +10 -0
  12. package/dist/client-v2/900.e6155002a9c97e7f.js +10 -0
  13. package/dist/client-v2/928.bba701b5a1ece58e.js +10 -0
  14. package/dist/client-v2/index.js +1 -1
  15. package/dist/externalVersion.js +9 -8
  16. package/dist/locale/en-US.json +307 -297
  17. package/dist/locale/vi-VN.json +295 -292
  18. package/dist/locale/zh-CN.json +61 -51
  19. package/dist/node_modules/simple-git/dist/cjs/index.js +25 -25
  20. package/dist/node_modules/simple-git/package.json +1 -1
  21. package/dist/node_modules/zod/index.cjs +1 -1
  22. package/dist/node_modules/zod/package.json +1 -1
  23. package/dist/server/actions/git-actions.js +90 -36
  24. package/dist/server/actions/gitlab-api.js +4 -2
  25. package/dist/server/actions/poller.js +5 -2
  26. package/dist/server/actions/review.js +20 -10
  27. package/dist/server/plugin.js +6 -4
  28. package/dist/server/poller.js +46 -45
  29. package/dist/server/request-method-policy.js +75 -0
  30. package/dist/server/services/registry-content-service.js +23 -10
  31. package/dist/server/utils/get-repo-account.js +3 -2
  32. package/dist/server/utils/url-security.js +24 -0
  33. package/package.json +61 -43
  34. package/server.d.ts +2 -2
  35. package/server.js +1 -1
  36. package/src/client/__tests__/RunReviewButton.test.tsx +73 -0
  37. package/src/client/ai-context.tsx +114 -114
  38. package/src/client/components/AIEmployeeSelect.tsx +63 -63
  39. package/src/client/components/CommitHistory.tsx +374 -374
  40. package/src/client/components/FileExplorer.tsx +386 -386
  41. package/src/client/components/GitAccounts.tsx +179 -179
  42. package/src/client/components/GitManagerSettings.tsx +160 -160
  43. package/src/client/components/GitOperations.tsx +220 -220
  44. package/src/client/components/LLMModelSelect.tsx +63 -63
  45. package/src/client/components/LLMServiceSelect.tsx +58 -58
  46. package/src/client/components/MarkdownView.tsx +80 -80
  47. package/src/client/components/MergeRequests.tsx +790 -790
  48. package/src/client/components/PollingStatus.tsx +225 -225
  49. package/src/client/components/RepositoryConfig.tsx +335 -335
  50. package/src/client/components/RepositoryPermissions.tsx +123 -123
  51. package/src/client/components/ReviewFlows.tsx +303 -303
  52. package/src/client/components/ReviewHistory.tsx +566 -566
  53. package/src/client/components/RunReviewButton.tsx +63 -55
  54. package/src/client/context/GitManagerContext.tsx +92 -92
  55. package/src/client/index.tsx +91 -82
  56. package/src/client/locale.ts +9 -9
  57. package/src/client/promptTemplates.ts +31 -31
  58. package/src/client-v2/ai-context.tsx +99 -0
  59. package/src/client-v2/components/SubtreeSplits.tsx +547 -547
  60. package/src/client-v2/index.tsx +1 -1
  61. package/src/client-v2/locale.ts +8 -8
  62. package/src/client-v2/plugin.tsx +67 -39
  63. package/src/index.ts +2 -2
  64. package/src/locale/en-US.json +307 -297
  65. package/src/locale/vi-VN.json +295 -292
  66. package/src/locale/zh-CN.json +61 -51
  67. package/src/server/__tests__/git-actions.test.ts +24 -24
  68. package/src/server/__tests__/git-security.test.ts +170 -0
  69. package/src/server/__tests__/plugin-url-security.test.ts +17 -17
  70. package/src/server/__tests__/poller-lifecycle.test.ts +71 -0
  71. package/src/server/__tests__/poller.test.ts +37 -37
  72. package/src/server/__tests__/repository-access.test.ts +752 -752
  73. package/src/server/__tests__/review.test.ts +137 -137
  74. package/src/server/__tests__/role-permissions.test.ts +147 -147
  75. package/src/server/__tests__/smoke.test.ts +139 -17
  76. package/src/server/__tests__/subtree.test.ts +85 -85
  77. package/src/server/actions/git-actions.ts +540 -480
  78. package/src/server/actions/gitlab-api.ts +422 -411
  79. package/src/server/actions/poller.ts +39 -27
  80. package/src/server/actions/review.ts +1388 -1369
  81. package/src/server/actions/role-permissions.ts +321 -321
  82. package/src/server/actions/subtree.ts +508 -508
  83. package/src/server/ai-tools.ts +319 -319
  84. package/src/server/collections/gitAccounts.ts +56 -56
  85. package/src/server/collections/gitCodeReviews.ts +199 -199
  86. package/src/server/collections/gitRepositories.ts +87 -87
  87. package/src/server/collections/gitReviewFlows.ts +108 -108
  88. package/src/server/collections/gitSubtreeConfigs.ts +38 -38
  89. package/src/server/collections/gitSubtreeRuns.ts +30 -30
  90. package/src/server/index.ts +2 -2
  91. package/src/server/migrations/20260508000000-add-auto-review-flow-id.ts +29 -29
  92. package/src/server/migrations/20260712000000-add-git-accounts.ts +198 -198
  93. package/src/server/migrations/20260730000000-migrate-legacy-repository-permissions.ts +81 -81
  94. package/src/server/plugin.ts +372 -361
  95. package/src/server/poller.ts +351 -352
  96. package/src/server/repository-access.ts +773 -773
  97. package/src/server/request-method-policy.ts +55 -0
  98. package/src/server/services/__tests__/registry-content-service.test.ts +359 -345
  99. package/src/server/services/registry-content-service.ts +33 -11
  100. package/src/server/utils/__tests__/redact.test.ts +56 -56
  101. package/src/server/utils/__tests__/url-security.test.ts +85 -85
  102. package/src/server/utils/get-repo-account.ts +51 -41
  103. package/src/server/utils/gitlab-url.ts +38 -38
  104. package/src/server/utils/redact.ts +87 -87
  105. package/src/server/utils/url-security.ts +128 -95
  106. package/dist/client/900.acf7d1fa22f95e71.js +0 -10
  107. package/dist/client-v2/434.7a27051db18526c0.js +0 -10
  108. package/dist/client-v2/900.f32b9dc85249fc0a.js +0 -10
@@ -1,87 +1,87 @@
1
- import { defineCollection } from '@nocobase/database';
2
-
3
- export default defineCollection({
4
- name: 'gitRepositories',
5
- title: 'Git Repositories',
6
- autoGenId: true,
7
- createdAt: true,
8
- updatedAt: true,
9
- fields: [
10
- {
11
- type: 'string',
12
- name: 'name',
13
- interface: 'input',
14
- uiSchema: { title: 'Repository Name', type: 'string', 'x-component': 'Input' },
15
- },
16
- {
17
- type: 'string',
18
- name: 'repoUrl',
19
- interface: 'input',
20
- uiSchema: { title: 'Repository URL', type: 'string', 'x-component': 'Input' },
21
- },
22
- {
23
- type: 'belongsTo',
24
- name: 'gitAccount',
25
- target: 'gitAccounts',
26
- foreignKey: 'gitAccountId',
27
- onDelete: 'RESTRICT',
28
- interface: 'm2o',
29
- uiSchema: {
30
- title: 'Git Account',
31
- 'x-component': 'AssociationField',
32
- 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
33
- },
34
- },
35
- {
36
- type: 'string',
37
- name: 'localPath',
38
- interface: 'input',
39
- uiSchema: { title: 'Local Path', type: 'string', 'x-component': 'Input' },
40
- },
41
- {
42
- type: 'string',
43
- name: 'defaultBranch',
44
- defaultValue: 'main',
45
- interface: 'input',
46
- uiSchema: { title: 'Default Branch', type: 'string', 'x-component': 'Input' },
47
- },
48
- {
49
- type: 'string',
50
- name: 'status',
51
- defaultValue: 'disconnected',
52
- interface: 'input',
53
- },
54
- {
55
- type: 'boolean',
56
- name: 'autoReview',
57
- defaultValue: false,
58
- interface: 'checkbox',
59
- uiSchema: { title: 'Auto Review', type: 'boolean', 'x-component': 'Checkbox' },
60
- },
61
- {
62
- type: 'boolean',
63
- name: 'registryExportEnabled',
64
- allowNull: false,
65
- defaultValue: false,
66
- interface: 'checkbox',
67
- uiSchema: { title: 'Allow Skill Registry export', type: 'boolean', 'x-component': 'Checkbox' },
68
- },
69
- {
70
- type: 'belongsTo',
71
- name: 'autoReviewFlow',
72
- target: 'gitReviewFlows',
73
- foreignKey: 'autoReviewFlowId',
74
- interface: 'm2o',
75
- uiSchema: {
76
- title: 'Primary Auto Review Flow',
77
- 'x-component': 'AssociationField',
78
- 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
79
- },
80
- },
81
- {
82
- type: 'date',
83
- name: 'lastPolledAt',
84
- interface: 'datetime',
85
- },
86
- ],
87
- });
1
+ import { defineCollection } from '@nocobase/database';
2
+
3
+ export default defineCollection({
4
+ name: 'gitRepositories',
5
+ title: 'Git Repositories',
6
+ autoGenId: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ fields: [
10
+ {
11
+ type: 'string',
12
+ name: 'name',
13
+ interface: 'input',
14
+ uiSchema: { title: 'Repository Name', type: 'string', 'x-component': 'Input' },
15
+ },
16
+ {
17
+ type: 'string',
18
+ name: 'repoUrl',
19
+ interface: 'input',
20
+ uiSchema: { title: 'Repository URL', type: 'string', 'x-component': 'Input' },
21
+ },
22
+ {
23
+ type: 'belongsTo',
24
+ name: 'gitAccount',
25
+ target: 'gitAccounts',
26
+ foreignKey: 'gitAccountId',
27
+ onDelete: 'RESTRICT',
28
+ interface: 'm2o',
29
+ uiSchema: {
30
+ title: 'Git Account',
31
+ 'x-component': 'AssociationField',
32
+ 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
33
+ },
34
+ },
35
+ {
36
+ type: 'string',
37
+ name: 'localPath',
38
+ interface: 'input',
39
+ uiSchema: { title: 'Local Path', type: 'string', 'x-component': 'Input' },
40
+ },
41
+ {
42
+ type: 'string',
43
+ name: 'defaultBranch',
44
+ defaultValue: 'main',
45
+ interface: 'input',
46
+ uiSchema: { title: 'Default Branch', type: 'string', 'x-component': 'Input' },
47
+ },
48
+ {
49
+ type: 'string',
50
+ name: 'status',
51
+ defaultValue: 'disconnected',
52
+ interface: 'input',
53
+ },
54
+ {
55
+ type: 'boolean',
56
+ name: 'autoReview',
57
+ defaultValue: false,
58
+ interface: 'checkbox',
59
+ uiSchema: { title: 'Auto Review', type: 'boolean', 'x-component': 'Checkbox' },
60
+ },
61
+ {
62
+ type: 'boolean',
63
+ name: 'registryExportEnabled',
64
+ allowNull: false,
65
+ defaultValue: false,
66
+ interface: 'checkbox',
67
+ uiSchema: { title: 'Allow Skill Registry export', type: 'boolean', 'x-component': 'Checkbox' },
68
+ },
69
+ {
70
+ type: 'belongsTo',
71
+ name: 'autoReviewFlow',
72
+ target: 'gitReviewFlows',
73
+ foreignKey: 'autoReviewFlowId',
74
+ interface: 'm2o',
75
+ uiSchema: {
76
+ title: 'Primary Auto Review Flow',
77
+ 'x-component': 'AssociationField',
78
+ 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
79
+ },
80
+ },
81
+ {
82
+ type: 'date',
83
+ name: 'lastPolledAt',
84
+ interface: 'datetime',
85
+ },
86
+ ],
87
+ });
@@ -1,108 +1,108 @@
1
- import { defineCollection } from '@nocobase/database';
2
-
3
- export default defineCollection({
4
- name: 'gitReviewFlows',
5
- title: 'Git Review Flows',
6
- autoGenId: true,
7
- createdBy: true,
8
- updatedBy: true,
9
- createdAt: true,
10
- updatedAt: true,
11
- fields: [
12
- {
13
- type: 'string',
14
- name: 'name',
15
- interface: 'input',
16
- uiSchema: { title: 'Flow Name', type: 'string', 'x-component': 'Input', required: true },
17
- },
18
- {
19
- type: 'belongsTo',
20
- name: 'repository',
21
- target: 'gitRepositories',
22
- foreignKey: 'repositoryId',
23
- interface: 'm2o',
24
- uiSchema: {
25
- title: 'Repository',
26
- 'x-component': 'AssociationField',
27
- 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
28
- },
29
- },
30
- {
31
- type: 'boolean',
32
- name: 'enabled',
33
- defaultValue: true,
34
- interface: 'checkbox',
35
- uiSchema: { title: 'Enabled', type: 'boolean', 'x-component': 'Checkbox' },
36
- },
37
- {
38
- type: 'string',
39
- name: 'triggerMode',
40
- defaultValue: 'manual',
41
- interface: 'select',
42
- uiSchema: {
43
- title: 'Trigger Mode',
44
- type: 'string',
45
- 'x-component': 'Select',
46
- enum: [
47
- { value: 'manual', label: 'Manual' },
48
- { value: 'onMergeRequestCreated', label: 'On Merge Request Created' },
49
- { value: 'both', label: 'Both' },
50
- ],
51
- },
52
- },
53
- {
54
- type: 'string',
55
- name: 'aiEmployeeUsername',
56
- interface: 'input',
57
- uiSchema: { title: 'AI Employee', type: 'string', 'x-component': 'Input' },
58
- },
59
- {
60
- type: 'string',
61
- name: 'llmService',
62
- interface: 'input',
63
- uiSchema: { title: 'LLM Service (optional)', type: 'string', 'x-component': 'Input' },
64
- },
65
- {
66
- type: 'string',
67
- name: 'model',
68
- interface: 'input',
69
- uiSchema: { title: 'Model (optional)', type: 'string', 'x-component': 'Input' },
70
- },
71
- {
72
- type: 'string',
73
- name: 'branchFilter',
74
- interface: 'input',
75
- uiSchema: {
76
- title: 'Branch Filter (regex, optional)',
77
- type: 'string',
78
- 'x-component': 'Input',
79
- },
80
- },
81
- {
82
- type: 'string',
83
- name: 'postMode',
84
- defaultValue: 'manual',
85
- interface: 'select',
86
- uiSchema: {
87
- title: 'Post Mode',
88
- type: 'string',
89
- 'x-component': 'Select',
90
- enum: [
91
- { value: 'auto', label: 'Auto' },
92
- { value: 'manual', label: 'Manual (require approval)' },
93
- { value: 'disabled', label: 'Disabled' },
94
- ],
95
- },
96
- },
97
- {
98
- type: 'text',
99
- name: 'instructions',
100
- interface: 'textarea',
101
- uiSchema: {
102
- title: 'Additional Instructions',
103
- type: 'string',
104
- 'x-component': 'Input.TextArea',
105
- },
106
- },
107
- ],
108
- });
1
+ import { defineCollection } from '@nocobase/database';
2
+
3
+ export default defineCollection({
4
+ name: 'gitReviewFlows',
5
+ title: 'Git Review Flows',
6
+ autoGenId: true,
7
+ createdBy: true,
8
+ updatedBy: true,
9
+ createdAt: true,
10
+ updatedAt: true,
11
+ fields: [
12
+ {
13
+ type: 'string',
14
+ name: 'name',
15
+ interface: 'input',
16
+ uiSchema: { title: 'Flow Name', type: 'string', 'x-component': 'Input', required: true },
17
+ },
18
+ {
19
+ type: 'belongsTo',
20
+ name: 'repository',
21
+ target: 'gitRepositories',
22
+ foreignKey: 'repositoryId',
23
+ interface: 'm2o',
24
+ uiSchema: {
25
+ title: 'Repository',
26
+ 'x-component': 'AssociationField',
27
+ 'x-component-props': { fieldNames: { label: 'name', value: 'id' } },
28
+ },
29
+ },
30
+ {
31
+ type: 'boolean',
32
+ name: 'enabled',
33
+ defaultValue: true,
34
+ interface: 'checkbox',
35
+ uiSchema: { title: 'Enabled', type: 'boolean', 'x-component': 'Checkbox' },
36
+ },
37
+ {
38
+ type: 'string',
39
+ name: 'triggerMode',
40
+ defaultValue: 'manual',
41
+ interface: 'select',
42
+ uiSchema: {
43
+ title: 'Trigger Mode',
44
+ type: 'string',
45
+ 'x-component': 'Select',
46
+ enum: [
47
+ { value: 'manual', label: 'Manual' },
48
+ { value: 'onMergeRequestCreated', label: 'On Merge Request Created' },
49
+ { value: 'both', label: 'Both' },
50
+ ],
51
+ },
52
+ },
53
+ {
54
+ type: 'string',
55
+ name: 'aiEmployeeUsername',
56
+ interface: 'input',
57
+ uiSchema: { title: 'AI Employee', type: 'string', 'x-component': 'Input' },
58
+ },
59
+ {
60
+ type: 'string',
61
+ name: 'llmService',
62
+ interface: 'input',
63
+ uiSchema: { title: 'LLM Service (optional)', type: 'string', 'x-component': 'Input' },
64
+ },
65
+ {
66
+ type: 'string',
67
+ name: 'model',
68
+ interface: 'input',
69
+ uiSchema: { title: 'Model (optional)', type: 'string', 'x-component': 'Input' },
70
+ },
71
+ {
72
+ type: 'string',
73
+ name: 'branchFilter',
74
+ interface: 'input',
75
+ uiSchema: {
76
+ title: 'Branch Filter (regex, optional)',
77
+ type: 'string',
78
+ 'x-component': 'Input',
79
+ },
80
+ },
81
+ {
82
+ type: 'string',
83
+ name: 'postMode',
84
+ defaultValue: 'manual',
85
+ interface: 'select',
86
+ uiSchema: {
87
+ title: 'Post Mode',
88
+ type: 'string',
89
+ 'x-component': 'Select',
90
+ enum: [
91
+ { value: 'auto', label: 'Auto' },
92
+ { value: 'manual', label: 'Manual (require approval)' },
93
+ { value: 'disabled', label: 'Disabled' },
94
+ ],
95
+ },
96
+ },
97
+ {
98
+ type: 'text',
99
+ name: 'instructions',
100
+ interface: 'textarea',
101
+ uiSchema: {
102
+ title: 'Additional Instructions',
103
+ type: 'string',
104
+ 'x-component': 'Input.TextArea',
105
+ },
106
+ },
107
+ ],
108
+ });
@@ -1,38 +1,38 @@
1
- import { defineCollection } from '@nocobase/database';
2
-
3
- export default defineCollection({
4
- name: 'gitSubtreeConfigs',
5
- title: 'Git Subtree Configurations',
6
- autoGenId: true,
7
- createdAt: true,
8
- updatedAt: true,
9
- fields: [
10
- { type: 'string', name: 'name', allowNull: false },
11
- {
12
- type: 'belongsTo',
13
- name: 'repository',
14
- target: 'gitRepositories',
15
- foreignKey: 'repositoryId',
16
- onDelete: 'CASCADE',
17
- },
18
- { type: 'string', name: 'sourceBranch', allowNull: false },
19
- { type: 'string', name: 'sourcePrefix', allowNull: false },
20
- { type: 'json', name: 'sourcePrefixes' },
21
- { type: 'string', name: 'targetBranch', allowNull: false },
22
- { type: 'string', name: 'remoteName', allowNull: false, defaultValue: 'origin' },
23
- { type: 'string', name: 'defaultPolicy', allowNull: false, defaultValue: 'fastForward' },
24
- { type: 'boolean', name: 'pushAfterRun', allowNull: false, defaultValue: true },
25
- { type: 'boolean', name: 'enabled', allowNull: false, defaultValue: true },
26
- { type: 'date', name: 'lastRunAt' },
27
- { type: 'string', name: 'lastSplitSha' },
28
- { type: 'string', name: 'lastStatus' },
29
- { type: 'text', name: 'lastError' },
30
- {
31
- type: 'hasMany',
32
- name: 'runs',
33
- target: 'gitSubtreeRuns',
34
- foreignKey: 'configId',
35
- onDelete: 'CASCADE',
36
- },
37
- ],
38
- });
1
+ import { defineCollection } from '@nocobase/database';
2
+
3
+ export default defineCollection({
4
+ name: 'gitSubtreeConfigs',
5
+ title: 'Git Subtree Configurations',
6
+ autoGenId: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ fields: [
10
+ { type: 'string', name: 'name', allowNull: false },
11
+ {
12
+ type: 'belongsTo',
13
+ name: 'repository',
14
+ target: 'gitRepositories',
15
+ foreignKey: 'repositoryId',
16
+ onDelete: 'CASCADE',
17
+ },
18
+ { type: 'string', name: 'sourceBranch', allowNull: false },
19
+ { type: 'string', name: 'sourcePrefix', allowNull: false },
20
+ { type: 'json', name: 'sourcePrefixes' },
21
+ { type: 'string', name: 'targetBranch', allowNull: false },
22
+ { type: 'string', name: 'remoteName', allowNull: false, defaultValue: 'origin' },
23
+ { type: 'string', name: 'defaultPolicy', allowNull: false, defaultValue: 'fastForward' },
24
+ { type: 'boolean', name: 'pushAfterRun', allowNull: false, defaultValue: true },
25
+ { type: 'boolean', name: 'enabled', allowNull: false, defaultValue: true },
26
+ { type: 'date', name: 'lastRunAt' },
27
+ { type: 'string', name: 'lastSplitSha' },
28
+ { type: 'string', name: 'lastStatus' },
29
+ { type: 'text', name: 'lastError' },
30
+ {
31
+ type: 'hasMany',
32
+ name: 'runs',
33
+ target: 'gitSubtreeRuns',
34
+ foreignKey: 'configId',
35
+ onDelete: 'CASCADE',
36
+ },
37
+ ],
38
+ });
@@ -1,30 +1,30 @@
1
- import { defineCollection } from '@nocobase/database';
2
-
3
- export default defineCollection({
4
- name: 'gitSubtreeRuns',
5
- title: 'Git Subtree Runs',
6
- autoGenId: true,
7
- createdAt: true,
8
- updatedAt: true,
9
- fields: [
10
- {
11
- type: 'belongsTo',
12
- name: 'config',
13
- target: 'gitSubtreeConfigs',
14
- foreignKey: 'configId',
15
- onDelete: 'CASCADE',
16
- },
17
- { type: 'string', name: 'policy', allowNull: false },
18
- { type: 'string', name: 'executionMode', allowNull: false, defaultValue: 'app' },
19
- { type: 'string', name: 'sourceSha' },
20
- { type: 'string', name: 'splitSha' },
21
- { type: 'string', name: 'targetBeforeSha' },
22
- { type: 'string', name: 'targetAfterSha' },
23
- { type: 'string', name: 'status', allowNull: false, defaultValue: 'running' },
24
- { type: 'date', name: 'startedAt', allowNull: false },
25
- { type: 'date', name: 'finishedAt' },
26
- { type: 'text', name: 'output' },
27
- { type: 'text', name: 'error' },
28
- { type: 'bigInt', name: 'triggeredById' },
29
- ],
30
- });
1
+ import { defineCollection } from '@nocobase/database';
2
+
3
+ export default defineCollection({
4
+ name: 'gitSubtreeRuns',
5
+ title: 'Git Subtree Runs',
6
+ autoGenId: true,
7
+ createdAt: true,
8
+ updatedAt: true,
9
+ fields: [
10
+ {
11
+ type: 'belongsTo',
12
+ name: 'config',
13
+ target: 'gitSubtreeConfigs',
14
+ foreignKey: 'configId',
15
+ onDelete: 'CASCADE',
16
+ },
17
+ { type: 'string', name: 'policy', allowNull: false },
18
+ { type: 'string', name: 'executionMode', allowNull: false, defaultValue: 'app' },
19
+ { type: 'string', name: 'sourceSha' },
20
+ { type: 'string', name: 'splitSha' },
21
+ { type: 'string', name: 'targetBeforeSha' },
22
+ { type: 'string', name: 'targetAfterSha' },
23
+ { type: 'string', name: 'status', allowNull: false, defaultValue: 'running' },
24
+ { type: 'date', name: 'startedAt', allowNull: false },
25
+ { type: 'date', name: 'finishedAt' },
26
+ { type: 'text', name: 'output' },
27
+ { type: 'text', name: 'error' },
28
+ { type: 'bigInt', name: 'triggeredById' },
29
+ ],
30
+ });
@@ -1,2 +1,2 @@
1
- export { default } from './plugin';
2
- export { PluginGitManagerServer } from './plugin';
1
+ export { default } from './plugin';
2
+ export { PluginGitManagerServer } from './plugin';
@@ -1,29 +1,29 @@
1
- import { Migration } from '@nocobase/server';
2
- import { DataTypes } from 'sequelize';
3
-
4
- export default class AddAutoReviewFlowIdMigration extends Migration {
5
- on = 'afterLoad';
6
-
7
- async up() {
8
- const queryInterface = (this as any).db.sequelize.getQueryInterface();
9
- const tablePrefix = (this as any).db.options?.tablePrefix || '';
10
- const tableName = `${tablePrefix}gitRepositories`;
11
- const tableInfo = await queryInterface.describeTable(tableName).catch(() => null);
12
- if (!tableInfo || tableInfo.autoReviewFlowId) return;
13
-
14
- await queryInterface.addColumn(tableName, 'autoReviewFlowId', {
15
- type: DataTypes.INTEGER,
16
- allowNull: true,
17
- });
18
- }
19
-
20
- async down() {
21
- const queryInterface = (this as any).db.sequelize.getQueryInterface();
22
- const tablePrefix = (this as any).db.options?.tablePrefix || '';
23
- const tableName = `${tablePrefix}gitRepositories`;
24
- const tableInfo = await queryInterface.describeTable(tableName).catch(() => null);
25
- if (!tableInfo?.autoReviewFlowId) return;
26
-
27
- await queryInterface.removeColumn(tableName, 'autoReviewFlowId');
28
- }
29
- }
1
+ import { Migration } from '@nocobase/server';
2
+ import { DataTypes } from 'sequelize';
3
+
4
+ export default class AddAutoReviewFlowIdMigration extends Migration {
5
+ on = 'afterLoad';
6
+
7
+ async up() {
8
+ const queryInterface = (this as any).db.sequelize.getQueryInterface();
9
+ const tablePrefix = (this as any).db.options?.tablePrefix || '';
10
+ const tableName = `${tablePrefix}gitRepositories`;
11
+ const tableInfo = await queryInterface.describeTable(tableName).catch(() => null);
12
+ if (!tableInfo || tableInfo.autoReviewFlowId) return;
13
+
14
+ await queryInterface.addColumn(tableName, 'autoReviewFlowId', {
15
+ type: DataTypes.INTEGER,
16
+ allowNull: true,
17
+ });
18
+ }
19
+
20
+ async down() {
21
+ const queryInterface = (this as any).db.sequelize.getQueryInterface();
22
+ const tablePrefix = (this as any).db.options?.tablePrefix || '';
23
+ const tableName = `${tablePrefix}gitRepositories`;
24
+ const tableInfo = await queryInterface.describeTable(tableName).catch(() => null);
25
+ if (!tableInfo?.autoReviewFlowId) return;
26
+
27
+ await queryInterface.removeColumn(tableName, 'autoReviewFlowId');
28
+ }
29
+ }