opencode-gitlab-plugin 2.0.1 → 2.0.3
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/CHANGELOG.md +14 -0
- package/dist/index.js +89 -106
- package/dist/opencode-gitlab-plugin-2.0.3.tgz +0 -0
- package/package.json +1 -1
- package/dist/opencode-gitlab-plugin-2.0.1.tgz +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [2.0.3](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.0.2...v2.0.3) (2026-03-22)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### 🐛 Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **work-items:** use WorkItem widgets for assignees, labels, and notes ([a33b616](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/a33b616247ccaa47674b3221735ebff6bdb63c7a))
|
|
11
|
+
|
|
12
|
+
## [2.0.2](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.0.1...v2.0.2) (2026-03-22)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug Fixes
|
|
16
|
+
|
|
17
|
+
* **work-items:** use workItems(iid:) connection instead of non-existent workItem(iid:) ([e5ef90e](https://gitlab.com/vglafirov/opencode-gitlab-plugin/commit/e5ef90e557d2ee5e1e53ad85b65b3b71ea93d9cb))
|
|
18
|
+
|
|
5
19
|
## [2.0.1](https://gitlab.com/vglafirov/opencode-gitlab-plugin/compare/v2.0.0...v2.0.1) (2026-03-22)
|
|
6
20
|
|
|
7
21
|
|
package/dist/index.js
CHANGED
|
@@ -721,7 +721,30 @@ var IssuesClient = class extends GitLabApiClient {
|
|
|
721
721
|
function toGid(type, id) {
|
|
722
722
|
return `gid://gitlab/${type}/${id}`;
|
|
723
723
|
}
|
|
724
|
-
var
|
|
724
|
+
var WORK_ITEM_WIDGETS_FRAGMENT = `
|
|
725
|
+
widgets {
|
|
726
|
+
type
|
|
727
|
+
... on WorkItemWidgetAssignees {
|
|
728
|
+
assignees {
|
|
729
|
+
nodes {
|
|
730
|
+
id
|
|
731
|
+
username
|
|
732
|
+
name
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
... on WorkItemWidgetLabels {
|
|
737
|
+
labels {
|
|
738
|
+
nodes {
|
|
739
|
+
id
|
|
740
|
+
title
|
|
741
|
+
color
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
}
|
|
746
|
+
`;
|
|
747
|
+
var WORK_ITEM_FIELDS = `
|
|
725
748
|
id
|
|
726
749
|
iid
|
|
727
750
|
title
|
|
@@ -729,6 +752,7 @@ var WORK_ITEM_LIST_FIELDS = `
|
|
|
729
752
|
state
|
|
730
753
|
createdAt
|
|
731
754
|
updatedAt
|
|
755
|
+
confidential
|
|
732
756
|
workItemType {
|
|
733
757
|
id
|
|
734
758
|
name
|
|
@@ -738,59 +762,16 @@ var WORK_ITEM_LIST_FIELDS = `
|
|
|
738
762
|
username
|
|
739
763
|
name
|
|
740
764
|
}
|
|
741
|
-
assignees {
|
|
742
|
-
nodes {
|
|
743
|
-
id
|
|
744
|
-
username
|
|
745
|
-
name
|
|
746
|
-
}
|
|
747
|
-
}
|
|
748
|
-
labels {
|
|
749
|
-
nodes {
|
|
750
|
-
id
|
|
751
|
-
title
|
|
752
|
-
color
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
765
|
webUrl
|
|
766
|
+
${WORK_ITEM_WIDGETS_FRAGMENT}
|
|
756
767
|
`;
|
|
757
768
|
var GET_WORK_ITEM_QUERY = `
|
|
758
769
|
query getWorkItem($fullPath: ID!, $iid: String!) {
|
|
759
770
|
workspace: project(fullPath: $fullPath) {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
title
|
|
764
|
-
description
|
|
765
|
-
state
|
|
766
|
-
createdAt
|
|
767
|
-
updatedAt
|
|
768
|
-
closedAt
|
|
769
|
-
confidential
|
|
770
|
-
workItemType {
|
|
771
|
-
id
|
|
772
|
-
name
|
|
773
|
-
}
|
|
774
|
-
author {
|
|
775
|
-
id
|
|
776
|
-
username
|
|
777
|
-
name
|
|
778
|
-
}
|
|
779
|
-
assignees {
|
|
780
|
-
nodes {
|
|
781
|
-
id
|
|
782
|
-
username
|
|
783
|
-
name
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
labels {
|
|
787
|
-
nodes {
|
|
788
|
-
id
|
|
789
|
-
title
|
|
790
|
-
color
|
|
791
|
-
}
|
|
771
|
+
workItems(iid: $iid, first: 1) {
|
|
772
|
+
nodes {
|
|
773
|
+
${WORK_ITEM_FIELDS}
|
|
792
774
|
}
|
|
793
|
-
webUrl
|
|
794
775
|
}
|
|
795
776
|
}
|
|
796
777
|
}
|
|
@@ -813,7 +794,7 @@ var LIST_WORK_ITEMS_QUERY = `
|
|
|
813
794
|
first: $first
|
|
814
795
|
) {
|
|
815
796
|
nodes {
|
|
816
|
-
${
|
|
797
|
+
${WORK_ITEM_FIELDS}
|
|
817
798
|
}
|
|
818
799
|
}
|
|
819
800
|
}
|
|
@@ -837,7 +818,7 @@ var LIST_GROUP_WORK_ITEMS_QUERY = `
|
|
|
837
818
|
first: $first
|
|
838
819
|
) {
|
|
839
820
|
nodes {
|
|
840
|
-
${
|
|
821
|
+
${WORK_ITEM_FIELDS}
|
|
841
822
|
}
|
|
842
823
|
}
|
|
843
824
|
}
|
|
@@ -846,23 +827,35 @@ var LIST_GROUP_WORK_ITEMS_QUERY = `
|
|
|
846
827
|
var GET_WORK_ITEM_NOTES_QUERY = `
|
|
847
828
|
query getWorkItemNotes($fullPath: ID!, $iid: String!) {
|
|
848
829
|
workspace: project(fullPath: $fullPath) {
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
830
|
+
workItems(iid: $iid, first: 1) {
|
|
831
|
+
nodes {
|
|
832
|
+
id
|
|
833
|
+
iid
|
|
834
|
+
widgets {
|
|
835
|
+
type
|
|
836
|
+
... on WorkItemWidgetNotes {
|
|
837
|
+
discussions {
|
|
838
|
+
nodes {
|
|
839
|
+
id
|
|
840
|
+
notes {
|
|
841
|
+
nodes {
|
|
842
|
+
id
|
|
843
|
+
body
|
|
844
|
+
createdAt
|
|
845
|
+
updatedAt
|
|
846
|
+
author {
|
|
847
|
+
id
|
|
848
|
+
username
|
|
849
|
+
name
|
|
850
|
+
}
|
|
851
|
+
system
|
|
852
|
+
resolvable
|
|
853
|
+
resolved
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
}
|
|
862
858
|
}
|
|
863
|
-
system
|
|
864
|
-
resolvable
|
|
865
|
-
resolved
|
|
866
859
|
}
|
|
867
860
|
}
|
|
868
861
|
}
|
|
@@ -887,23 +880,7 @@ var CREATE_WORK_ITEM_MUTATION = `
|
|
|
887
880
|
assigneesWidget: { assigneeIds: $assigneeIds }
|
|
888
881
|
}) {
|
|
889
882
|
workItem {
|
|
890
|
-
|
|
891
|
-
iid
|
|
892
|
-
title
|
|
893
|
-
description
|
|
894
|
-
state
|
|
895
|
-
createdAt
|
|
896
|
-
updatedAt
|
|
897
|
-
workItemType {
|
|
898
|
-
id
|
|
899
|
-
name
|
|
900
|
-
}
|
|
901
|
-
author {
|
|
902
|
-
id
|
|
903
|
-
username
|
|
904
|
-
name
|
|
905
|
-
}
|
|
906
|
-
webUrl
|
|
883
|
+
${WORK_ITEM_FIELDS}
|
|
907
884
|
}
|
|
908
885
|
errors
|
|
909
886
|
}
|
|
@@ -927,17 +904,7 @@ var UPDATE_WORK_ITEM_MUTATION = `
|
|
|
927
904
|
assigneesWidget: { assigneeIds: $assigneeIds }
|
|
928
905
|
}) {
|
|
929
906
|
workItem {
|
|
930
|
-
|
|
931
|
-
iid
|
|
932
|
-
title
|
|
933
|
-
description
|
|
934
|
-
state
|
|
935
|
-
updatedAt
|
|
936
|
-
workItemType {
|
|
937
|
-
id
|
|
938
|
-
name
|
|
939
|
-
}
|
|
940
|
-
webUrl
|
|
907
|
+
${WORK_ITEM_FIELDS}
|
|
941
908
|
}
|
|
942
909
|
errors
|
|
943
910
|
}
|
|
@@ -963,23 +930,37 @@ var CREATE_NOTE_MUTATION = `
|
|
|
963
930
|
var GET_WORK_ITEM_GID_QUERY = `
|
|
964
931
|
query getWorkItemGid($fullPath: ID!, $iid: String!) {
|
|
965
932
|
workspace: project(fullPath: $fullPath) {
|
|
966
|
-
|
|
967
|
-
|
|
933
|
+
workItems(iid: $iid, first: 1) {
|
|
934
|
+
nodes {
|
|
935
|
+
id
|
|
936
|
+
}
|
|
968
937
|
}
|
|
969
938
|
}
|
|
970
939
|
}
|
|
971
940
|
`;
|
|
941
|
+
function flattenWidgets(raw) {
|
|
942
|
+
const widgets = raw.widgets;
|
|
943
|
+
if (!widgets) return raw;
|
|
944
|
+
const assigneesWidget = widgets.find((w) => w.type === "ASSIGNEES");
|
|
945
|
+
const labelsWidget = widgets.find((w) => w.type === "LABELS");
|
|
946
|
+
const { widgets: _w, ...rest } = raw;
|
|
947
|
+
return {
|
|
948
|
+
...rest,
|
|
949
|
+
assignees: assigneesWidget?.assignees?.nodes ?? [],
|
|
950
|
+
labels: labelsWidget?.labels?.nodes ?? []
|
|
951
|
+
};
|
|
952
|
+
}
|
|
972
953
|
var WorkItemsClient = class extends GitLabApiClient {
|
|
973
954
|
async getWorkItem(projectId, workItemIid) {
|
|
974
955
|
const result = await this.fetchGraphQL(GET_WORK_ITEM_QUERY, {
|
|
975
956
|
fullPath: projectId,
|
|
976
957
|
iid: String(workItemIid)
|
|
977
958
|
});
|
|
978
|
-
const workItem = result.workspace?.
|
|
959
|
+
const workItem = result.workspace?.workItems?.nodes?.[0];
|
|
979
960
|
if (!workItem) {
|
|
980
961
|
throw new Error(`Work item with iid ${workItemIid} not found in project ${projectId}`);
|
|
981
962
|
}
|
|
982
|
-
return workItem;
|
|
963
|
+
return flattenWidgets(workItem);
|
|
983
964
|
}
|
|
984
965
|
async listWorkItems(options) {
|
|
985
966
|
const variables = {
|
|
@@ -991,10 +972,10 @@ var WorkItemsClient = class extends GitLabApiClient {
|
|
|
991
972
|
};
|
|
992
973
|
if (options.projectId) {
|
|
993
974
|
const result = await this.fetchGraphQL(LIST_WORK_ITEMS_QUERY, { fullPath: options.projectId, ...variables });
|
|
994
|
-
return result.workspace?.workItems?.nodes ?? [];
|
|
975
|
+
return (result.workspace?.workItems?.nodes ?? []).map(flattenWidgets);
|
|
995
976
|
} else if (options.groupId) {
|
|
996
977
|
const result = await this.fetchGraphQL(LIST_GROUP_WORK_ITEMS_QUERY, { fullPath: options.groupId, ...variables });
|
|
997
|
-
return result.workspace?.workItems?.nodes ?? [];
|
|
978
|
+
return (result.workspace?.workItems?.nodes ?? []).map(flattenWidgets);
|
|
998
979
|
} else {
|
|
999
980
|
throw new Error("Either projectId or groupId must be provided");
|
|
1000
981
|
}
|
|
@@ -1004,11 +985,13 @@ var WorkItemsClient = class extends GitLabApiClient {
|
|
|
1004
985
|
fullPath: projectId,
|
|
1005
986
|
iid: String(workItemIid)
|
|
1006
987
|
});
|
|
1007
|
-
const workItem = result.workspace?.
|
|
988
|
+
const workItem = result.workspace?.workItems?.nodes?.[0];
|
|
1008
989
|
if (!workItem) {
|
|
1009
990
|
throw new Error(`Work item with iid ${workItemIid} not found in project ${projectId}`);
|
|
1010
991
|
}
|
|
1011
|
-
|
|
992
|
+
const notesWidget = workItem.widgets?.find((w) => w.type === "NOTES");
|
|
993
|
+
const discussions = notesWidget?.discussions?.nodes ?? [];
|
|
994
|
+
return discussions.flatMap((d) => d.notes?.nodes ?? []);
|
|
1012
995
|
}
|
|
1013
996
|
async createWorkItem(projectId, options) {
|
|
1014
997
|
const labelIds = options.labels?.map((l) => toGid("Label", l));
|
|
@@ -1024,14 +1007,14 @@ var WorkItemsClient = class extends GitLabApiClient {
|
|
|
1024
1007
|
if (result.workItemCreate.errors.length > 0) {
|
|
1025
1008
|
throw new Error(`Failed to create work item: ${result.workItemCreate.errors.join(", ")}`);
|
|
1026
1009
|
}
|
|
1027
|
-
return result.workItemCreate.workItem;
|
|
1010
|
+
return flattenWidgets(result.workItemCreate.workItem);
|
|
1028
1011
|
}
|
|
1029
1012
|
async updateWorkItem(projectId, workItemIid, options) {
|
|
1030
1013
|
const gidResult = await this.fetchGraphQL(GET_WORK_ITEM_GID_QUERY, {
|
|
1031
1014
|
fullPath: projectId,
|
|
1032
1015
|
iid: String(workItemIid)
|
|
1033
1016
|
});
|
|
1034
|
-
const gid = gidResult.workspace?.
|
|
1017
|
+
const gid = gidResult.workspace?.workItems?.nodes?.[0]?.id;
|
|
1035
1018
|
if (!gid) {
|
|
1036
1019
|
throw new Error(`Work item with iid ${workItemIid} not found in project ${projectId}`);
|
|
1037
1020
|
}
|
|
@@ -1049,14 +1032,14 @@ var WorkItemsClient = class extends GitLabApiClient {
|
|
|
1049
1032
|
if (result.workItemUpdate.errors.length > 0) {
|
|
1050
1033
|
throw new Error(`Failed to update work item: ${result.workItemUpdate.errors.join(", ")}`);
|
|
1051
1034
|
}
|
|
1052
|
-
return result.workItemUpdate.workItem;
|
|
1035
|
+
return flattenWidgets(result.workItemUpdate.workItem);
|
|
1053
1036
|
}
|
|
1054
1037
|
async createWorkItemNote(projectId, workItemIid, body) {
|
|
1055
1038
|
const gidResult = await this.fetchGraphQL(GET_WORK_ITEM_GID_QUERY, {
|
|
1056
1039
|
fullPath: projectId,
|
|
1057
1040
|
iid: String(workItemIid)
|
|
1058
1041
|
});
|
|
1059
|
-
const gid = gidResult.workspace?.
|
|
1042
|
+
const gid = gidResult.workspace?.workItems?.nodes?.[0]?.id;
|
|
1060
1043
|
if (!gid) {
|
|
1061
1044
|
throw new Error(`Work item with iid ${workItemIid} not found in project ${projectId}`);
|
|
1062
1045
|
}
|
|
Binary file
|
package/package.json
CHANGED
|
Binary file
|