gitlab-cloud-connector 1.1.0 → 1.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4d3a9c6cb24eae104dda40308b879b159d1e1583da6c39292dc864b3f9306746
4
- data.tar.gz: 474c1fa8efc2fb0480818d74ac587152aa3ab907a5c340e3d5de7524c95fb3e2
3
+ metadata.gz: 7b483b10874986b71ec2c3b91a53dfd4fdcbd78be20144aeb63e26fe521df83b
4
+ data.tar.gz: 50eaf9263b69b27d22a689be8943967a998a10c9944e17d0ea1ecc25b9c1d79a
5
5
  SHA512:
6
- metadata.gz: f502784866d6d67fdbccbf262591ccc14d0a96fd44c6e38ab0de5273e224ce85258e0e504ded2d90f8d00b6f7a48662afae650a3dc8afe6de39ad8adcba37b26
7
- data.tar.gz: ce85d65412bf2722bc68c5dcc2c8f16fa5da8c80147abef96c606dce03367aaaf053396671cf88281530aba9cce406440ef6b4ce11ce35a0379e3966c989edd9
6
+ metadata.gz: d0efcf11ce2879783ceb5d3a6027c8ab7f2e35e6b97690db1e6c7e366f1116765a09ee047ee3396bb7e94718a14eab7e20e2733e267ee934e9dce3fb72df03ea
7
+ data.tar.gz: 3d5ae9797a346b4d92fecbf8e5c8acc8f4a2136745ec4b5e138e5cb896a38972b87144f3fddd91620cd83bc347f7b7953be59d8a4ddd48a7910359fa4b585510
data/README.md CHANGED
@@ -34,16 +34,18 @@ add_ons:
34
34
  - duo_enterprise
35
35
  ```
36
36
 
37
- ### Working with DataModels
37
+ ### Working with DataModel
38
38
 
39
- `DataModels` are the core data structures in the Cloud Connector. Each model inherits from `DataModel::Base`. The data is loaded from YAML files into memory at runtime, making it efficient for read operations and relationship traversal.
39
+ `DataModel` contains the core data structures in the Ruby library.
40
+ Each model inherits from `DataModel::Base`. The data is loaded from YAML files into memory at runtime, making it efficient
41
+ for read operations and relationship traversal.
40
42
 
41
43
  ```ruby
42
44
  require 'gitlab/cloud_connector'
43
45
 
44
46
  # Find unit primitive by name
45
47
  # Note: value should be a symbol (e.g., `:duo_chat` instead of `'duo_chat'`).
46
- duo_chat = Gitlab::CloudConnector::DataModels::UnitPrimitive.find_by_name(:duo_chat)
48
+ duo_chat = Gitlab::CloudConnector::DataModel::UnitPrimitive.find_by_name(:duo_chat)
47
49
  duo_chat.description
48
50
  duo_chat.cut_off_date
49
51
 
@@ -10,3 +10,4 @@ unit_primitives:
10
10
  - summarize_issue_discussions
11
11
  - summarize_new_merge_request
12
12
  - summarize_review
13
+ - description_composer
@@ -10,7 +10,6 @@ unit_primitives:
10
10
  - documentation_search
11
11
  - duo_chat
12
12
  - explain_code
13
- - explain_terminal
14
13
  - fix_code
15
14
  - include_dependency_context
16
15
  - include_file_context
@@ -18,5 +17,6 @@ unit_primitives:
18
17
  - include_local_git_context
19
18
  - include_merge_request_context
20
19
  - include_snippet_context
20
+ - include_terminal_context
21
21
  - refactor_code
22
- - write_tests
22
+ - write_tests
@@ -20,5 +20,6 @@ unit_primitives:
20
20
  - include_local_git_context
21
21
  - include_merge_request_context
22
22
  - include_snippet_context
23
+ - include_terminal_context
23
24
  - refactor_code
24
25
  - write_tests
@@ -6,4 +6,3 @@ unit_primitives:
6
6
  - glab_ask_git_command
7
7
  - semantic_search_issue
8
8
  - summarize_issue_discussions
9
- - summarize_merge_request
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: ask_merge_request
3
- description: Ask questions about GitLab merge reuest.
3
+ description: Ask questions about GitLab merge request.
4
4
  cut_off_date: 2024-10-17T00:00:00+00:00
5
5
  group: group::duo_chat
6
6
  feature_category: duo_chat
@@ -0,0 +1,11 @@
1
+ ---
2
+ name: description_composer
3
+ description: Composes a description for a merge request.
4
+ cut_off_date: 2024-10-17T00:00:00+00:00
5
+ group: group::code review
6
+ feature_category: code_review_workflow
7
+ introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/183512
8
+ backend_services:
9
+ - ai_gateway
10
+ add_ons:
11
+ - duo_enterprise
@@ -1,6 +1,6 @@
1
1
  ---
2
- name: explain_terminal
3
- description: Explain terminal or command line interface output.
2
+ name: include_terminal_context
3
+ description: Include terminal context in the prompt.
4
4
  cut_off_date: 2024-10-17T00:00:00+00:00
5
5
  group: group::duo_chat
6
6
  feature_category: duo_chat
@@ -28,7 +28,6 @@ module Gitlab
28
28
  security_scans
29
29
  semantic_search_issue
30
30
  summarize_issue_discussions
31
- summarize_merge_request
32
31
  write_tests
33
32
  ].freeze
34
33
 
@@ -45,7 +44,7 @@ module Gitlab
45
44
  def generate_services_config(gitlab_realm)
46
45
  services_config = {}
47
46
 
48
- DataModels::Service.each do |service|
47
+ DataModel::Service.each do |service|
49
48
  next if service.gitlab_realm && !service.gitlab_realm&.include?(gitlab_realm)
50
49
 
51
50
  service_config = generate_service_config(service.unit_primitives, service.basic_unit_primitive)
@@ -56,7 +55,7 @@ module Gitlab
56
55
  end
57
56
 
58
57
  # Generate a stand-alone service for each unit primitive (except the ones in the ignore list)
59
- unit_primitives = DataModels::UnitPrimitive.reject { |up| IGNORE_UNIT_PRIMITIVES.include?(up.name) }
58
+ unit_primitives = DataModel::UnitPrimitive.reject { |up| IGNORE_UNIT_PRIMITIVES.include?(up.name) }
60
59
  unit_primitives.each do |unit_primitive|
61
60
  next if services_config[unit_primitive.name]
62
61
 
@@ -23,7 +23,7 @@ module Gitlab
23
23
 
24
24
  def load_association_records(association_name)
25
25
  names = Array(self[association_name])
26
- association_class = Gitlab::CloudConnector::DataModels.const_get(association_name.to_s.classify)
26
+ association_class = Gitlab::CloudConnector::DataModel.const_get(association_name.to_s.classify)
27
27
  association_class.select { |record| names.include?(record.name.to_s) }
28
28
  end
29
29
  end
@@ -4,8 +4,10 @@ require_relative 'data_model/base'
4
4
 
5
5
  module Gitlab
6
6
  module CloudConnector
7
- module DataModels
8
- class UnitPrimitive < DataModel::Base
7
+ module DataModel
8
+ autoload(:YamlDataLoader, 'gitlab/cloud_connector/data_model/yaml_data_loader')
9
+
10
+ class UnitPrimitive < Base
9
11
  has_and_belongs_to_many :backend_services
10
12
  has_and_belongs_to_many :add_ons
11
13
  has_and_belongs_to_many :license_types
@@ -15,21 +17,21 @@ module Gitlab
15
17
  :min_gitlab_version_for_free_access, :name, :unit_primitive_issue_url
16
18
  end
17
19
 
18
- class Service < DataModel::Base
20
+ class Service < Base
19
21
  has_and_belongs_to_many :unit_primitives
20
22
 
21
23
  attr_reader :basic_unit_primitive, :description, :gitlab_realm, :name
22
24
  end
23
25
 
24
- class BackendService < DataModel::Base
26
+ class BackendService < Base
25
27
  attr_reader :description, :group, :jwt_aud, :name, :project_url
26
28
  end
27
29
 
28
- class LicenseType < DataModel::Base
30
+ class LicenseType < Base
29
31
  attr_reader :description, :name
30
32
  end
31
33
 
32
- class AddOn < DataModel::Base
34
+ class AddOn < Base
33
35
  attr_reader :description, :name
34
36
  end
35
37
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gitlab
4
4
  module CloudConnector
5
- VERSION = '1.1.0'
5
+ VERSION = '1.3.0'
6
6
  end
7
7
  end
@@ -7,7 +7,7 @@ module Gitlab
7
7
  module CloudConnector
8
8
  autoload(:JsonWebToken, 'gitlab/cloud_connector/json_web_token')
9
9
  autoload(:Configuration, 'gitlab/cloud_connector/configuration')
10
- autoload(:DataModels, 'gitlab/cloud_connector/data_models')
10
+ autoload(:DataModel, 'gitlab/cloud_connector/data_model')
11
11
  autoload(:AvailableServicesGenerator, 'gitlab/cloud_connector/available_services_generator')
12
12
  end
13
13
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-cloud-connector
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nikola Milojevic
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2025-03-05 00:00:00.000000000 Z
11
+ date: 2025-03-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -128,11 +128,11 @@ files:
128
128
  - config/unit_primitives/categorize_duo_chat_question.yml
129
129
  - config/unit_primitives/code_suggestions.yml
130
130
  - config/unit_primitives/complete_code.yml
131
+ - config/unit_primitives/description_composer.yml
131
132
  - config/unit_primitives/documentation_search.yml
132
133
  - config/unit_primitives/duo_chat.yml
133
134
  - config/unit_primitives/duo_workflow_execute_workflow.yml
134
135
  - config/unit_primitives/explain_code.yml
135
- - config/unit_primitives/explain_terminal.yml
136
136
  - config/unit_primitives/explain_vulnerability.yml
137
137
  - config/unit_primitives/fix_code.yml
138
138
  - config/unit_primitives/generate_code.yml
@@ -146,6 +146,7 @@ files:
146
146
  - config/unit_primitives/include_local_git_context.yml
147
147
  - config/unit_primitives/include_merge_request_context.yml
148
148
  - config/unit_primitives/include_snippet_context.yml
149
+ - config/unit_primitives/include_terminal_context.yml
149
150
  - config/unit_primitives/measure_comment_temperature.yml
150
151
  - config/unit_primitives/observability_all.yml
151
152
  - config/unit_primitives/refactor_code.yml
@@ -155,7 +156,6 @@ files:
155
156
  - config/unit_primitives/semantic_search_issue.yml
156
157
  - config/unit_primitives/summarize_comments.yml
157
158
  - config/unit_primitives/summarize_issue_discussions.yml
158
- - config/unit_primitives/summarize_merge_request.yml
159
159
  - config/unit_primitives/summarize_new_merge_request.yml
160
160
  - config/unit_primitives/summarize_review.yml
161
161
  - config/unit_primitives/troubleshoot_job.yml
@@ -163,12 +163,11 @@ files:
163
163
  - lib/gitlab/cloud_connector.rb
164
164
  - lib/gitlab/cloud_connector/available_services_generator.rb
165
165
  - lib/gitlab/cloud_connector/configuration.rb
166
+ - lib/gitlab/cloud_connector/data_model.rb
166
167
  - lib/gitlab/cloud_connector/data_model/abstract_data_loader.rb
167
168
  - lib/gitlab/cloud_connector/data_model/associations.rb
168
169
  - lib/gitlab/cloud_connector/data_model/base.rb
169
- - lib/gitlab/cloud_connector/data_model/data_loader.rb
170
170
  - lib/gitlab/cloud_connector/data_model/yaml_data_loader.rb
171
- - lib/gitlab/cloud_connector/data_models.rb
172
171
  - lib/gitlab/cloud_connector/json_web_token.rb
173
172
  - lib/gitlab/cloud_connector/version.rb
174
173
  homepage: https://gitlab.com/gitlab-org/cloud-connector/gitlab-cloud-connector
@@ -1,11 +0,0 @@
1
- ---
2
- name: summarize_merge_request
3
- description: Summarize merge request from the comments.
4
- cut_off_date: 2024-10-17T00:00:00+00:00
5
- group: group::code review
6
- feature_category: code_review_workflow
7
- documentation_url: https://docs.gitlab.com/ee/user/gitlab_duo/#merge-request-summary
8
- backend_services:
9
- - ai_gateway
10
- add_ons:
11
- - duo_enterprise
@@ -1,39 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'yaml'
4
-
5
- module Gitlab
6
- module CloudConnector
7
- module DataModel
8
- class DataLoader
9
- def initialize(model_class)
10
- @model_class = model_class
11
- end
12
-
13
- def load!
14
- Dir.glob(data_files_path).map { |file| load_model_from_file(file) }
15
- end
16
-
17
- private
18
-
19
- attr_reader :model_class
20
-
21
- def data_files_path
22
- File.join(CloudConnector::Configuration.config_dir, model_class.model_name.tableize, '*.yml')
23
- end
24
-
25
- def load_model_from_file(file_path)
26
- data = YAML.safe_load(
27
- File.read(file_path),
28
- permitted_classes: [Time],
29
- symbolize_names: true
30
- ).deep_symbolize_keys!
31
-
32
- model_class.new(**data)
33
- rescue StandardError => e
34
- raise "Error loading file #{file_path}: #{e.message}"
35
- end
36
- end
37
- end
38
- end
39
- end