You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/minefield-cli/usage.md
+78-12
Original file line number
Diff line number
Diff line change
@@ -6,45 +6,46 @@ sidebar_position: 1
6
6
7
7
## Query
8
8
9
+
### Custom Queries
10
+
9
11
Custom queries allow users to perform complex searches by combining multiple commands. These queries can be used to analyze the relationships between different nodes in the graph.
10
12
11
13
When running a custom query, there are multiple commands that can be used. For example, the custom command:
To find the dependencies shared by `dep1` and `lib-A`, you can use the following custom query:
50
51
@@ -54,16 +55,59 @@ minefield query "dependencies library pkg:generic/[email protected] and dependencies li
54
55
55
56
This query will return all nodes that are dependencies of both `dep1` and `lib-A`.
56
57
57
-
### Flags
58
+
####Flags
58
59
59
60
--visualize : This flag will visualize the query, by creating a graph of the nodes and edges.
60
61
61
62
--addr : This flag will specify the port that the visualization will be hosted on.
62
63
63
-
--outputdir: This flag will specify the directory that the query will be saved to, the query will be saved as a files in the directory, with the name of each file being the name of the node in that query, the the file wil contain the metadata of the node.
64
-
65
64
--max-output: This flag will specify the maximum number of nodes that the query will return.
66
65
66
+
### Output Query
67
+
68
+
Output is takes in a node name, and will output the metadata of the node to the terminal or to a file if the --outputdir flag is specified.
69
+
70
+
#### Usage
71
+
72
+
```sh
73
+
minefield query output <node_name>
74
+
```
75
+
76
+
#### Examples
77
+
78
+
To output the metadata of the node `pkg:generic/[email protected]`, you can use the following command:
This will output the node's name, id, type, and metadata.
85
+
86
+
87
+
#### Flags
88
+
--output-file: This flag will specify the file that output will be saved to.
89
+
90
+
91
+
### Globsearch
92
+
93
+
The globsearch command is used to search for nodes in the graph that match a given pattern. We can run this query without the cache command, without any impact on performance.
94
+
95
+
#### Usage
96
+
97
+
```sh
98
+
minefield query globsearch <pattern>
99
+
```
100
+
101
+
#### Examples
102
+
103
+
To search for all the noes for the package `dep` you can run `*dep*` with the following command:
104
+
105
+
```sh
106
+
minefield query globsearch "*dep*"
107
+
```
108
+
109
+
The pattern is a glob pattern, and will match any node that contains the pattern.
110
+
67
111
## Leaderboard
68
112
69
113
The `leaderboard` command is used to generate a leaderboard of nodes based on a specified query, sorted by the number of nodes returned by the query.
@@ -142,3 +186,25 @@ minefield cache
142
186
```sh
143
187
minefield ingest sbom <sbom_file or directory>
144
188
```
189
+
190
+
### OSV
191
+
192
+
#### Load
193
+
194
+
This command will load the OSV data into a local database without graphing it.
195
+
THe data must be in the OSV JSON schema, but it can be in a directory, a single file, or a zip file.
196
+
197
+
#### Usage
198
+
199
+
```sh
200
+
minefield ingest osv load <osv_file or directory>
201
+
```
202
+
#### Graph
203
+
204
+
This command will load the OSV data into the graph, from the local database.
0 commit comments