Skip to content

Commit 3101d3a

Browse files
Merge pull request #10 from bitbomdev/neil/updatedocsosvandquerytools
Updated the Docs to reflect changes on the repo
2 parents 1db5de8 + fc64695 commit 3101d3a

File tree

1 file changed

+78
-12
lines changed

1 file changed

+78
-12
lines changed

docs/minefield-cli/usage.md

+78-12
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,46 @@ sidebar_position: 1
66

77
## Query
88

9+
### Custom Queries
10+
911
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.
1012

1113
When running a custom query, there are multiple commands that can be used. For example, the custom command:
1214

1315
```sh
14-
minefield query "dependencies library pkg:generic/[email protected] and dependencies library pkg:generic/[email protected]"
16+
minefield query custom "dependencies library pkg:generic/[email protected] and dependencies library pkg:generic/[email protected]"
1517
```
1618

17-
1819
This custom command uses the commands "dependencies" and "and".
1920

20-
### Available Commands
21+
#### Available Commands
2122

22-
#### dependencies
23+
##### dependencies
2324
- **Description**: Retrieves all dependencies of a specified node.
2425
- **Usage**: `dependencies <node_type> <node_name>`
2526
- **Example**: `dependencies library pkg:generic/[email protected]`
2627

27-
#### dependents
28+
##### dependents
2829
- **Description**: Retrieves all dependents of a specified node.
2930
- **Usage**: `dependents <node_type> <node_name>`
3031
- **Example**: `dependents library pkg:generic/[email protected]`
3132

32-
#### and
33+
##### and
3334
- **Description**: Combines two queries with a logical AND, returning nodes that satisfy both conditions.
3435
- **Usage**: `<query1> and <query2>`
3536
- **Example**: `dependencies library pkg:generic/[email protected] and dependencies library pkg:generic/[email protected]`
3637

37-
#### or
38+
##### or
3839
- **Description**: Combines two queries with a logical OR, returning nodes that satisfy either condition.
3940
- **Usage**: `<query1> or <query2>`
4041
- **Example**: `dependencies library pkg:generic/[email protected] or dependencies library pkg:generic/[email protected]`
4142

42-
#### xor
43+
##### xor
4344
- **Description**: Combines two queries with a logical XOR, returning nodes that satisfy one condition but not both.
4445
- **Usage**: `<query1> xor <query2>`
4546
- **Example**: `dependencies library pkg:generic/[email protected] xor dependencies library pkg:generic/[email protected]`
4647

47-
### Examples
48+
#### Examples
4849

4950
To find the dependencies shared by `dep1` and `lib-A`, you can use the following custom query:
5051

@@ -54,16 +55,59 @@ minefield query "dependencies library pkg:generic/[email protected] and dependencies li
5455

5556
This query will return all nodes that are dependencies of both `dep1` and `lib-A`.
5657

57-
### Flags
58+
#### Flags
5859

5960
--visualize : This flag will visualize the query, by creating a graph of the nodes and edges.
6061

6162
--addr : This flag will specify the port that the visualization will be hosted on.
6263

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-
6564
--max-output: This flag will specify the maximum number of nodes that the query will return.
6665

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:
79+
80+
```sh
81+
minefield query output pkg:generic/[email protected]
82+
```
83+
84+
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+
67111
## Leaderboard
68112

69113
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
142186
```sh
143187
minefield ingest sbom <sbom_file or directory>
144188
```
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.
205+
206+
#### Usage
207+
208+
```sh
209+
minefield ingest osv graph
210+
```

0 commit comments

Comments
 (0)