dbotquery 0.9

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 (57) hide show
  1. checksums.yaml +7 -0
  2. data/.idea/.gitignore +10 -0
  3. data/.idea/dbotquery.iml +130 -0
  4. data/.idea/dictionaries/project.xml +9 -0
  5. data/.idea/modules.xml +8 -0
  6. data/.idea/runConfigurations/Specs.xml +33 -0
  7. data/.idea/vcs.xml +6 -0
  8. data/.reek.yml +8 -0
  9. data/CHANGELOG.md +5 -0
  10. data/CODE_OF_CONDUCT.md +10 -0
  11. data/LICENSE.txt +21 -0
  12. data/NOTES.md +38 -0
  13. data/README.md +34 -0
  14. data/Rakefile +32 -0
  15. data/Steepfile +25 -0
  16. data/exe/dbotquery +8 -0
  17. data/lib/d_bot_query/cli.rb +74 -0
  18. data/lib/d_bot_query/commands/command_base.rb +51 -0
  19. data/lib/d_bot_query/commands/package_search_command.rb +40 -0
  20. data/lib/d_bot_query/commands/repo_sla_statistics_command.rb +52 -0
  21. data/lib/d_bot_query/commands/sla_statistics_command.rb +62 -0
  22. data/lib/d_bot_query/commands/summary_command.rb +51 -0
  23. data/lib/d_bot_query/models/alert.rb +40 -0
  24. data/lib/d_bot_query/models/alert_collection.rb +89 -0
  25. data/lib/d_bot_query/models/base.rb +128 -0
  26. data/lib/d_bot_query/models/cvss.rb +11 -0
  27. data/lib/d_bot_query/models/cwe.rb +8 -0
  28. data/lib/d_bot_query/models/data_file.rb +30 -0
  29. data/lib/d_bot_query/models/dependency.rb +12 -0
  30. data/lib/d_bot_query/models/package.rb +23 -0
  31. data/lib/d_bot_query/models/reference.rb +11 -0
  32. data/lib/d_bot_query/models/repository.rb +42 -0
  33. data/lib/d_bot_query/models/security_advisory.rb +22 -0
  34. data/lib/d_bot_query/models/security_vulnerability.rb +19 -0
  35. data/lib/d_bot_query/models/vulnerability_identifier.rb +14 -0
  36. data/lib/d_bot_query/version.rb +6 -0
  37. data/lib/dbotquery.rb +79 -0
  38. data/lib/schema.json +1255 -0
  39. data/rbs_collection.lock.yaml +316 -0
  40. data/rbs_collection.yaml +19 -0
  41. data/sig/d_bot_query/cli.rbs +26 -0
  42. data/sig/d_bot_query/commands/command_base.rbs +18 -0
  43. data/sig/d_bot_query/commands/package_search_command.rbs +11 -0
  44. data/sig/d_bot_query/commands/repo_sla_statistics_command.rbs +9 -0
  45. data/sig/d_bot_query/commands/sla_statistics_command.rbs +11 -0
  46. data/sig/d_bot_query/commands/summary_command.rbs +15 -0
  47. data/sig/d_bot_query/models/alert.rbs +17 -0
  48. data/sig/d_bot_query/models/alert_collection.rbs +41 -0
  49. data/sig/d_bot_query/models/base.rbs +39 -0
  50. data/sig/d_bot_query/models/data_file.rbs +21 -0
  51. data/sig/d_bot_query/models/dependency.rbs +7 -0
  52. data/sig/d_bot_query/models/package.rbs +10 -0
  53. data/sig/d_bot_query/models/repository.rbs +11 -0
  54. data/sig/d_bot_query/models/security_advisory.rbs +9 -0
  55. data/sig/d_bot_query.rbs +14 -0
  56. data/sig/gems/json-schema.rbs +5 -0
  57. metadata +157 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 54f665596ce0a1ef9bc40d3fad0c0e208b8fcbe9b27225851584dbb5087a359c
4
+ data.tar.gz: 0da1bd780a74e60361ea1b7f703e9b6f15f57d31e5e6e69a4e1130a1d2a5be02
5
+ SHA512:
6
+ metadata.gz: 474a2bf379ae1f15e293558e756efce924a1a8b5dec015e86774fe1bc64ba6d90c8a2e84b4ad7b7a9b616257ebf0f7bd1a0f5fcf31adf37ba5f0e3e42879f307
7
+ data.tar.gz: 8c3e80eee61bc7437fdc5cd7b95c9ae67719b67d4381b7f08e44cca8e905df4fd0164ffd9ee0a212d58735e3228314142112999e76d01250616c018e0becb1c9
data/.idea/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Ignored default folder with query files
7
+ /queries/
8
+ # Datasource local storage ignored files
9
+ /dataSources/
10
+ /dataSources.local.xml
@@ -0,0 +1,130 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared>
5
+ <configuration default="false" name="Specs" type="RSpecRunConfigurationType" factoryName="RSpec">
6
+ <module name="dbotquery" />
7
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
8
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
9
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
10
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
11
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
12
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
13
+ <EXTENSION ID="BundlerRunConfigurationExtension" BUNDLE_MODE="AUTO" bundleExecEnabled="true" />
14
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
15
+ <COVERAGE_PATTERN ENABLED="true">
16
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
17
+ </COVERAGE_PATTERN>
18
+ </EXTENSION>
19
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
20
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
21
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
22
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATHS" VALUE="" />
23
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
24
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
25
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
26
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_EXAMPLE_MATCHES" VALUE="false" />
27
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="LINE_NUMBER_EXAMPLE_IDS" VALUE="" />
28
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="ALL_IN_FOLDER" />
29
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
30
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
31
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
32
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
33
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
34
+ <method v="2" />
35
+ </configuration>
36
+ </shared>
37
+ </component>
38
+ <component name="NewModuleRootManager">
39
+ <content url="file://$MODULE_DIR$">
40
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
41
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
42
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
43
+ </content>
44
+ <orderEntry type="jdk" jdkName="rbenv: 4.0.5" jdkType="RUBY_SDK" />
45
+ <orderEntry type="sourceFolder" forTests="false" />
46
+ <orderEntry type="library" scope="PROVIDED" name="activemodel (v8.1.3, rbenv: 4.0.5) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="activesupport (v8.1.3, rbenv: 4.0.5) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="addressable (v2.9.0, rbenv: 4.0.5) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, rbenv: 4.0.5) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="base64 (v0.3.0, rbenv: 4.0.5) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="bigdecimal (v3.3.1, rbenv: 4.0.5) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v4.0.14, rbenv: 4.0.5) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="bundler-audit (v0.9.3, rbenv: 4.0.5) [gem]" level="application" />
54
+ <orderEntry type="library" scope="TEST" name="byebug (v13.0.0, rbenv: 4.0.5) [gem]" level="application" />
55
+ <orderEntry type="library" scope="PROVIDED" name="coderay (v1.1.3, rbenv: 4.0.5) [gem]" level="application" />
56
+ <orderEntry type="library" scope="PROVIDED" name="concurrent-ruby (v1.3.7, rbenv: 4.0.5) [gem]" level="application" />
57
+ <orderEntry type="library" scope="PROVIDED" name="connection_pool (v3.0.2, rbenv: 4.0.5) [gem]" level="application" />
58
+ <orderEntry type="library" scope="PROVIDED" name="csv (v3.3.5, rbenv: 4.0.5) [gem]" level="application" />
59
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.6.2, rbenv: 4.0.5) [gem]" level="application" />
60
+ <orderEntry type="library" scope="PROVIDED" name="docile (v1.4.1, rbenv: 4.0.5) [gem]" level="application" />
61
+ <orderEntry type="library" scope="PROVIDED" name="drb (v2.2.3, rbenv: 4.0.5) [gem]" level="application" />
62
+ <orderEntry type="library" scope="PROVIDED" name="dry-configurable (v1.4.0, rbenv: 4.0.5) [gem]" level="application" />
63
+ <orderEntry type="library" scope="PROVIDED" name="dry-core (v1.2.0, rbenv: 4.0.5) [gem]" level="application" />
64
+ <orderEntry type="library" scope="PROVIDED" name="dry-inflector (v1.3.1, rbenv: 4.0.5) [gem]" level="application" />
65
+ <orderEntry type="library" scope="PROVIDED" name="dry-initializer (v3.2.0, rbenv: 4.0.5) [gem]" level="application" />
66
+ <orderEntry type="library" scope="PROVIDED" name="dry-logic (v1.6.0, rbenv: 4.0.5) [gem]" level="application" />
67
+ <orderEntry type="library" scope="PROVIDED" name="dry-schema (v1.16.0, rbenv: 4.0.5) [gem]" level="application" />
68
+ <orderEntry type="library" scope="PROVIDED" name="dry-types (v1.9.1, rbenv: 4.0.5) [gem]" level="application" />
69
+ <orderEntry type="library" scope="PROVIDED" name="ffi (v1.17.4, rbenv: 4.0.5) [gem]" level="application" />
70
+ <orderEntry type="library" scope="PROVIDED" name="fileutils (v1.8.0, rbenv: 4.0.5) [gem]" level="application" />
71
+ <orderEntry type="library" scope="PROVIDED" name="gemika (v2.0.0, rbenv: 4.0.5) [gem]" level="application" />
72
+ <orderEntry type="library" scope="PROVIDED" name="i18n (v1.15.2, rbenv: 4.0.5) [gem]" level="application" />
73
+ <orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.2, rbenv: 4.0.5) [gem]" level="application" />
74
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.21.1, rbenv: 4.0.5) [gem]" level="application" />
75
+ <orderEntry type="library" scope="PROVIDED" name="json-schema (v5.2.2, rbenv: 4.0.5) [gem]" level="application" />
76
+ <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.6, rbenv: 4.0.5) [gem]" level="application" />
77
+ <orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, rbenv: 4.0.5) [gem]" level="application" />
78
+ <orderEntry type="library" scope="PROVIDED" name="listen (v3.10.0, rbenv: 4.0.5) [gem]" level="application" />
79
+ <orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, rbenv: 4.0.5) [gem]" level="application" />
80
+ <orderEntry type="library" scope="PROVIDED" name="method_source (v1.1.0, rbenv: 4.0.5) [gem]" level="application" />
81
+ <orderEntry type="library" scope="PROVIDED" name="minitest (v6.0.6, rbenv: 4.0.5) [gem]" level="application" />
82
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v2.1.0, rbenv: 4.0.5) [gem]" level="application" />
83
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.11.1, rbenv: 4.0.5) [gem]" level="application" />
84
+ <orderEntry type="library" scope="PROVIDED" name="prism (v1.9.0, rbenv: 4.0.5) [gem]" level="application" />
85
+ <orderEntry type="library" scope="TEST" name="pry (v0.16.0, rbenv: 4.0.5) [gem]" level="application" />
86
+ <orderEntry type="library" scope="PROVIDED" name="public_suffix (v7.0.5, rbenv: 4.0.5) [gem]" level="application" />
87
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 4.0.5) [gem]" level="application" />
88
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 4.0.5) [gem]" level="application" />
89
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.4.2, rbenv: 4.0.5) [gem]" level="application" />
90
+ <orderEntry type="library" scope="PROVIDED" name="rb-fsevent (v0.11.2, rbenv: 4.0.5) [gem]" level="application" />
91
+ <orderEntry type="library" scope="PROVIDED" name="rb-inotify (v0.11.1, rbenv: 4.0.5) [gem]" level="application" />
92
+ <orderEntry type="library" scope="TEST" name="rbs (v4.0.3, rbenv: 4.0.5) [gem]" level="application" />
93
+ <orderEntry type="library" scope="TEST" name="rbs-inline (v0.14.0, rbenv: 4.0.5) [gem]" level="application" />
94
+ <orderEntry type="library" scope="PROVIDED" name="reek (v6.5.0, rbenv: 4.0.5) [gem]" level="application" />
95
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.12.0, rbenv: 4.0.5) [gem]" level="application" />
96
+ <orderEntry type="library" scope="PROVIDED" name="reline (v0.6.3, rbenv: 4.0.5) [gem]" level="application" />
97
+ <orderEntry type="library" scope="PROVIDED" name="rexml (v3.4.4, rbenv: 4.0.5) [gem]" level="application" />
98
+ <orderEntry type="library" scope="TEST" name="rspec (v3.13.2, rbenv: 4.0.5) [gem]" level="application" />
99
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.6, rbenv: 4.0.5) [gem]" level="application" />
100
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.5, rbenv: 4.0.5) [gem]" level="application" />
101
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.8, rbenv: 4.0.5) [gem]" level="application" />
102
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.7, rbenv: 4.0.5) [gem]" level="application" />
103
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.88.2, rbenv: 4.0.5) [gem]" level="application" />
104
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.50.0, rbenv: 4.0.5) [gem]" level="application" />
105
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-performance (v1.26.1, rbenv: 4.0.5) [gem]" level="application" />
106
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-rake (v0.7.1, rbenv: 4.0.5) [gem]" level="application" />
107
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-rspec (v3.10.2, rbenv: 4.0.5) [gem]" level="application" />
108
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-yard (v1.3.0, rbenv: 4.0.5) [gem]" level="application" />
109
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, rbenv: 4.0.5) [gem]" level="application" />
110
+ <orderEntry type="library" scope="PROVIDED" name="securerandom (v0.4.1, rbenv: 4.0.5) [gem]" level="application" />
111
+ <orderEntry type="library" scope="TEST" name="simplecov (v0.22.0, rbenv: 4.0.5) [gem]" level="application" />
112
+ <orderEntry type="library" scope="PROVIDED" name="simplecov-html (v0.13.2, rbenv: 4.0.5) [gem]" level="application" />
113
+ <orderEntry type="library" scope="PROVIDED" name="simplecov_json_formatter (v0.1.4, rbenv: 4.0.5) [gem]" level="application" />
114
+ <orderEntry type="library" scope="TEST" name="steep (v2.0.0, rbenv: 4.0.5) [gem]" level="application" />
115
+ <orderEntry type="library" scope="PROVIDED" name="strscan (v3.1.8, rbenv: 4.0.5) [gem]" level="application" />
116
+ <orderEntry type="library" scope="PROVIDED" name="terminal-table (v4.0.0, rbenv: 4.0.5) [gem]" level="application" />
117
+ <orderEntry type="library" scope="PROVIDED" name="thor (v1.5.0, rbenv: 4.0.5) [gem]" level="application" />
118
+ <orderEntry type="library" scope="PROVIDED" name="tsort (v0.2.0, rbenv: 4.0.5) [gem]" level="application" />
119
+ <orderEntry type="library" scope="PROVIDED" name="tzinfo (v2.0.6, rbenv: 4.0.5) [gem]" level="application" />
120
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.2.0, rbenv: 4.0.5) [gem]" level="application" />
121
+ <orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.2.0, rbenv: 4.0.5) [gem]" level="application" />
122
+ <orderEntry type="library" scope="PROVIDED" name="uri (v1.1.1, rbenv: 4.0.5) [gem]" level="application" />
123
+ <orderEntry type="library" scope="PROVIDED" name="yard (v0.9.45, rbenv: 4.0.5) [gem]" level="application" />
124
+ <orderEntry type="library" scope="PROVIDED" name="zeitwerk (v2.8.2, rbenv: 4.0.5) [gem]" level="application" />
125
+ </component>
126
+ <component name="RModuleSettingsStorage">
127
+ <LOAD_PATH number="1" string0="$MODULE_DIR$/lib" />
128
+ <I18N_FOLDERS number="0" />
129
+ </component>
130
+ </module>
@@ -0,0 +1,9 @@
1
+ <component name="ProjectDictionaryState">
2
+ <dictionary name="project">
3
+ <words>
4
+ <w>cvss</w>
5
+ <w>dbotquery</w>
6
+ <w>ghsa</w>
7
+ </words>
8
+ </dictionary>
9
+ </component>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/dbotquery.iml" filepath="$PROJECT_DIR$/.idea/dbotquery.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
@@ -0,0 +1,33 @@
1
+ <component name="ProjectRunConfigurationManager">
2
+ <configuration default="false" name="Specs" type="RSpecRunConfigurationType" factoryName="RSpec">
3
+ <module name="dbotquery" />
4
+ <predefined_log_file enabled="true" id="RUBY_RSPEC" />
5
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUBY_ARGS" VALUE="" />
6
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="WORK DIR" VALUE="$MODULE_DIR$" />
7
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SHOULD_USE_SDK" VALUE="false" />
8
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="ALTERN_SDK_NAME" VALUE="" />
9
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="myPassParentEnvs" VALUE="true" />
10
+ <EXTENSION ID="BundlerRunConfigurationExtension" BUNDLE_MODE="AUTO" bundleExecEnabled="true" />
11
+ <EXTENSION ID="RubyCoverageRunConfigurationExtension" track_test_folders="true" runner="rcov" ENABLE_BRANCH_COVERAGE="true" ENABLE_FORKED_COVERAGE="true">
12
+ <COVERAGE_PATTERN ENABLED="true">
13
+ <PATTERN REGEXPS="/.rvm/" INCLUDED="false" />
14
+ </COVERAGE_PATTERN>
15
+ </EXTENSION>
16
+ <EXTENSION ID="org.jetbrains.plugins.ruby.rails.run.RailsRunConfigurationExtension" SCRATCH_USE_RAILS_RUNNER="false" />
17
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TESTS_FOLDER_PATH" VALUE="$MODULE_DIR$/spec" />
18
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATH" VALUE="" />
19
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_SCRIPT_PATHS" VALUE="" />
20
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_RUNNER_PATH" VALUE="" />
21
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_FILE_MASK" VALUE="**/*_spec.rb" />
22
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_EXAMPLE_NAME" VALUE="" />
23
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_EXAMPLE_MATCHES" VALUE="false" />
24
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="LINE_NUMBER_EXAMPLE_IDS" VALUE="" />
25
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="TEST_TEST_TYPE" VALUE="ALL_IN_FOLDER" />
26
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPEC_ARGS" VALUE="" />
27
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="RUNNER_VERSION" VALUE="" />
28
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="USE_CUSTOM_SPEC_RUNNER" VALUE="false" />
29
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="SPRING" VALUE="false" />
30
+ <RSPEC_RUN_CONFIG_SETTINGS_ID NAME="FULL_BACKTRACE" VALUE="false" />
31
+ <method v="2" />
32
+ </configuration>
33
+ </component>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
data/.reek.yml ADDED
@@ -0,0 +1,8 @@
1
+
2
+ ---
3
+ detectors:
4
+ UncommunicativeVariableName:
5
+ accept:
6
+ - e
7
+ MissingSafeMethod:
8
+ enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2026-06-29
4
+
5
+ - Initial release
@@ -0,0 +1,10 @@
1
+ # Code of Conduct
2
+
3
+ "dbotquery" follows [The Ruby Community Conduct Guideline](https://www.ruby-lang.org/en/conduct) in all "collaborative space", which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.):
4
+
5
+ * Participants will be tolerant of opposing views.
6
+ * Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
7
+ * When interpreting the words and actions of others, participants should always assume good intentions.
8
+ * Behaviour which can be reasonably considered harassment will not be tolerated.
9
+
10
+ If you have any concerns about behaviour within this project, please contact us at ["rickmark@outlook.com"](mailto:"rickmark@outlook.com").
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2026 Rick Mark
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/NOTES.md ADDED
@@ -0,0 +1,38 @@
1
+ #
2
+
3
+ ## Rationale on Full Gem
4
+
5
+ Due to the simple nature of the challenge, I decided that simply providing "a solution" wouldn't properly showcase what
6
+ my ability to produce polished, maintainable, and secure code. I therfore decided to be overly
7
+ heavy-handed on showing what all proper aspects of SDLC / maintable code would look like. This also
8
+ is something outside the pervue of current AI tools (they can toss a bunch of process at a project, but fail
9
+ in the correct usage of such tools).
10
+
11
+ This means that the only directory that is of interest for the solution is `lib/dbotquery`, and the remaininng
12
+ files can be considered engineering execlence / best practice.
13
+
14
+ Similarly, due to the fact the example code was based on `argparse`, I decided to use the alternative of `thor` as to
15
+ demonstrate a clean implmentation. In reality, this adds a dependency and would not have been chosen had there not be
16
+ value in displaying that the solution is free from the example code.
17
+
18
+ ## Extensive Comments
19
+
20
+ Due to the fact Ruby is my prefered language, but not as common as say python, I've been overly verbose in the
21
+ comments, particularly where there are "rubyisms"
22
+
23
+ ## YARD Documentation
24
+
25
+ The solution shows proper code documenation inline, with the YARD (Yet another ruby documentation) documentation generated.
26
+
27
+ ## RSpec Testing
28
+
29
+ The solution is asserted through proper testing.
30
+
31
+ ## RBS, Steep, Rubocop
32
+
33
+ The solution includes Rubocop for proper code linting, Steep for static analysis. These are quality tools for the
34
+ purpose of showing a fully clean / production ready style of coding.
35
+
36
+ ## AI Attestation
37
+
38
+ The solution was created with only typical IDE code completion, no agentic tools.
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # DBotQuery
2
+
3
+ An example of a production ready query tool for GitHub dependabot data.
4
+
5
+ ## Installation
6
+
7
+ Install the gem and add to the application's Gemfile by executing:
8
+
9
+ ```bash
10
+ bundle install
11
+ rake install
12
+ ```
13
+
14
+ ## Usage
15
+
16
+ `bundle exec dbotquery summary`
17
+
18
+ ## Development
19
+
20
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
21
+
22
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
23
+
24
+ ## Contributing
25
+
26
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/dbotquery. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/dbotquery/blob/main/CODE_OF_CONDUCT.md).
27
+
28
+ ## License
29
+
30
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
31
+
32
+ ## Code of Conduct
33
+
34
+ Everyone interacting in the Dbotquery project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/dbotquery/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ require 'bundler/gem_tasks'
5
+ require 'bundler/setup'
6
+ require 'rspec/core/rake_task'
7
+ require 'rubocop/rake_task'
8
+ require 'steep/rake_task'
9
+ require 'gemika/tasks'
10
+ require 'reek/rake/task'
11
+ require 'yard'
12
+
13
+ YARD::Rake::YardocTask.new do |t|
14
+ t.files = ['lib/**/*.rb'] # Source files to document
15
+ t.options = %w[--any --extra-opts]
16
+ end
17
+
18
+ RSpec::Core::RakeTask.new(:spec)
19
+
20
+ RuboCop::RakeTask.new
21
+
22
+ Steep::RakeTask.new do |t|
23
+ t.check.severity_level = :error
24
+ t.watch.verbose = true
25
+ end
26
+
27
+ Reek::Rake::Task.new do |t|
28
+ t.fail_on_error = false
29
+ t.source_files = FileList['lib/**/*.rb']
30
+ end
31
+
32
+ task default: %i[yard rubocop spec steep]
data/Steepfile ADDED
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ D = Steep::Diagnostic
5
+
6
+ target :lib do
7
+ signature 'sig'
8
+
9
+ check 'lib'
10
+
11
+ library 'time'
12
+ library 'date'
13
+ end
14
+
15
+ target :test do
16
+ unreferenced!
17
+
18
+ signature 'sig'
19
+
20
+ check 'spec'
21
+
22
+ configure_code_diagnostics(D::Ruby.lenient)
23
+
24
+ gem 'rspec'
25
+ end
data/exe/dbotquery ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+ # rbs_inline: enabled
4
+
5
+ require_relative '../lib/dbotquery'
6
+ require 'thor'
7
+
8
+ DBotQuery::CLI.start
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DBotQuery
4
+ # Implements the CLI parsing and argument passing. This permits two things:
5
+ #
6
+ # * The separation of the command and its unit tests from the actual command line
7
+ # * The testing of the command line interface, independent of the command itself
8
+ class CLI < Thor
9
+ # This ensures that Thor exits with a non-zero exit code when an error occurs
10
+ def self.exit_on_failure?
11
+ true
12
+ end
13
+
14
+ # Shared options for all commands are specified here
15
+ class_option :file, required: true, desc: 'Path to JSON file exported from Dependabot', aliases: ['-f'],
16
+ example: 'dependabot.json'
17
+
18
+ desc 'summary', 'Count the number of vulnerabilities in a Dependabot JSON file'
19
+ long_desc <<~TEXT
20
+ This subcommand takes a JSON export from Dependabot and returns the number of findings in
21
+ the file. This command should take an optional “state” parameter so that the only vulnerabilities
22
+ that are counted are the ones that match its value (e.g. open, fixed, dismissed)
23
+ TEXT
24
+ method_option :state, desc: 'One of the possible states a finding can have', enum: %w[open fixed dismissed]
25
+ method_option :severity, desc: 'One of the possible severities a finding can have',
26
+ enum: %w[critical high medium low]
27
+ def summary
28
+ state = options[:state]&.to_sym #: DBotQuery::Commands::SummaryCommand::state?
29
+ severity = options[:severity]&.to_sym #: DBotQuery::Commands::SummaryCommand::severity?
30
+
31
+ run! DBotQuery::Commands::SummaryCommand.new(state: state, severity: severity)
32
+ end
33
+
34
+ desc 'sla_stats', 'Calculate the SLA statistics for a Dependabot JSON file'
35
+ method_option :time, desc: 'The time period to calculate the SLA statistics for', example: '2023-01-01T00:00:00Z',
36
+ aliases: ['-t']
37
+ def sla_stats
38
+ time = parse_time(options[:time])
39
+ run! DBotQuery::Commands::SLAStatisticsCommand.new time: time
40
+ end
41
+
42
+ desc 'repo_sla_stats', 'Calculate the SLA statistics for a Dependabot JSON file for a given repository'
43
+ method_option :time, desc: 'The time period to calculate the SLA statistics for', example: '2023-01-01T00:00:00Z',
44
+ aliases: ['-t']
45
+ def repo_sla_stats
46
+ time = parse_time(options[:time])
47
+ run! DBotQuery::Commands::RepoSLAStatisticsCommand.new time: time
48
+ end
49
+
50
+ desc 'package_search', 'Search for a package in a Dependabot JSON file'
51
+ option :package, desc: 'The name of the package to search for', required: true
52
+ def package_search
53
+ run! DBotQuery::Commands::PackageSearchCommand.new(package: options[:package])
54
+ end
55
+
56
+ private
57
+
58
+ # This encapsulates the logic for running a command. It handles all the proper console-ish things as well as
59
+ # common parameters.
60
+ def run!(command)
61
+ file = options[:file]
62
+
63
+ command.execute!(file)
64
+ end
65
+
66
+ def parse_time(value)
67
+ return Time.now unless value
68
+
69
+ Time.parse(value)
70
+ rescue ArgumentError => e
71
+ raise Error, "Invalid time '#{value}': #{e.message}"
72
+ end
73
+ end
74
+ end
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module DBotQuery
5
+ module Commands
6
+ # Abstract base class that all commands derive from. This ensures that they handle the JSON and command line
7
+ # correctly. Each command has a basic flow:
8
+ # * The command is instantiated with the proper arguments passed to the `new` call
9
+ # * The command has `#execute` called (common to all commands) which will call the abstract method `#perform`,
10
+ # which produces the proper hash for the command. Execute will then properly format and output the result
11
+ # to the console.
12
+ class CommandBase
13
+ # The object result of the perform method. This is prior to serialization allowing composition of commands
14
+ attr_reader :result
15
+
16
+ # Abstract initializer
17
+ def initialize
18
+ return if self.class.name != 'DBotQuery::Commands::CommandBase'
19
+
20
+ raise NotImplementedError, 'Cannot instantiate an abstract class directly'
21
+ end
22
+
23
+ # The shared implementation of the command, which handles calling the abstract method, then formatting for the
24
+ # screen. This permits the abstract method to be called in unit testing without reliance on the console.
25
+ # As every command operates on the same input file, this is handled as a parameter here. This permits common
26
+ # error handling such as if the file does not exist or fails to parse.
27
+ #
28
+ # @param [String] file The path to the input file
29
+ # @return void
30
+ def execute!(file)
31
+ file_path = Pathname.new(file)
32
+
33
+ raise DBotQuery::Error, "File #{file} does not exist" unless file_path.exist? && file_path.file?
34
+
35
+ input = Models::DataFile.load_file file_path
36
+
37
+ @result = perform(input)
38
+
39
+ puts JSON.pretty_generate(@result)
40
+ end
41
+
42
+ # Abstract method that performs the work of the command.
43
+ #
44
+ # @abstract
45
+ # @return Hash
46
+ def perform(_input)
47
+ raise NotImplementedError, '#perform is abstract and must be implemented in derived classes'
48
+ end
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module DBotQuery
4
+ module Commands
5
+ # # Package Search
6
+ # One question we often get asked is `do we use an X library?`. This subcommand will help us
7
+ # answer that. The subcommand should take a package name, and the result should contain a list
8
+ # of all the repositories where that package was seen.
9
+ #
10
+ # ## Inputs
11
+ #
12
+ # | Command Line Flag | Required? | Description | Example |
13
+ # | :--- | :--- | :--- | :--- |
14
+ # | -f/--file | yes | Path to JSON file exported from Dependabot | dependabot.json |
15
+ # | --package | yes | A package name | sinatra, puma, node-forge |
16
+ #
17
+ # ## Example commands
18
+ # * `./dbotquery package_search -f dependabot.json --package sinatra`
19
+ # * `./dbotquery package_search -f dependabot.json --package node-forge`
20
+ #
21
+ # ## Outputs
22
+ # ```json
23
+ # ["org/repo", "org/repo2"]
24
+ # ```
25
+ class PackageSearchCommand < CommandBase
26
+ attr_reader :package
27
+
28
+ # @param [String] package The name of the package to search for
29
+ def initialize(package:)
30
+ super()
31
+
32
+ @package = package
33
+ end
34
+
35
+ def perform(input)
36
+ input.alerts.package_search(@package)
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+ # rbs_inline: enabled
3
+
4
+ module DBotQuery
5
+ module Commands
6
+ # # Service Level Agreement Stats by Repo
7
+ # Now that we can get SLA stats for the entire organization, we want to view SLA stats for specific
8
+ # repositories as well. This will allow us to disseminate SLA statistics by repository, so the right
9
+ # people can view information specific to their code.
10
+ # Effectively, this will be the same thing as the previous subcommand, just broken out by
11
+ # repository.
12
+ #
13
+ # ## Inputs
14
+ #
15
+ # | Command Line Flag | Required? | Description | Example |
16
+ # | :--- | :--- | :--- | :--- |
17
+ # | -f/--file | yes | Path to JSON file exported from Dependabot | dependabot.json |
18
+ # | --time | no | The date/time for which the SLA is being calculated, in ISO8601 format | 2023-01-01T00:00:00Z |
19
+ #
20
+ # ## Example commands
21
+ #
22
+ # * `./your_program repo_sla_stats -f dependabot.json`
23
+ # * A count of all findings that exceed the SLA, separated by severity and repository. The current time is
24
+ # used when calculating age.
25
+ # * `./your_program repo_sla_stats -f dependabot.json -t 2023-01-01T00:00:00Z`
26
+ # * A count of all findings that exceed the SLA, separated by severity and repository. The time specified is
27
+ # used when calculating age.
28
+ #
29
+ # ## Outputs
30
+ #
31
+ # ```json
32
+ # {
33
+ # "org/repo": { "low": $count, "medium": $count, "high": $count, "critical": $count, "total": $count },
34
+ # "org/repo2": { "low": $count, "medium": $count, "high": $count, "critical": $count, "total": $count }
35
+ # }
36
+ # ```
37
+ #
38
+ # The output is roughly the same as with the previous subcommand, except broken out by
39
+ # repository. The keys here are each repository, and the values are their corresponding
40
+ # SLA stats.
41
+ class RepoSLAStatisticsCommand < CommandBase
42
+ def initialize(time: nil)
43
+ super()
44
+ @time = time || Time.now
45
+ end
46
+
47
+ def perform(input)
48
+ input.alerts.repo_sla_stats @time
49
+ end
50
+ end
51
+ end
52
+ end