Skip to content

Commit d1b948b

Browse files
Merge pull request #9 from vladbatushkov/beta1
Beta 1
2 parents 8e9e87e + 70d5fb5 commit d1b948b

7 files changed

Lines changed: 105 additions & 80 deletions

File tree

Documentation/cli.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Command Line Interface
2+
3+
## Usage
4+
**strazh** [options]
5+
6+
### Options
7+
- **-c**, **--credentials** (REQUIRED)
8+
_required information in format `dbname:user:password` to connect to Neo4j Database_
9+
- **-t**, **--tier**
10+
_optional flag as `project` or `code` or 'all' (default `all`) selected tier to scan in a codebase_
11+
- **-d**, **--delete**
12+
_optional flag as `true` or `false` or no flag (default `true`) to delete data in graph before execution_
13+
- **-s**, **--solution** (REQUIRED)
14+
_optional absolute path to only one `.sln` file (can't be used together with -p / --projects)_
15+
- **-p**, **--projects** (REQUIRED)
16+
_optional list of absolute path to one or many `.csproj` files (can't be used together with -s / --solution)_
17+
- **--version**
18+
_show version information_
19+
- **-?**, **-h**, **--help**
20+
_show help and usage information_
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
# Run with docker-compose
3+
4+
Example of docker-compose file with image `build`
5+
6+
```
7+
version: '3'
8+
services:
9+
10+
strazh:
11+
build: .
12+
image: strazh:dev
13+
container_name: strazh
14+
network_mode: host
15+
volumes:
16+
- ./Strazh:/dest
17+
environment:
18+
- c=neo4j:neo4j:strazh
19+
- p=/dest/Strazh.csproj
20+
depends_on:
21+
- neo4j
22+
23+
neo4j:
24+
image: neo4j:latest
25+
container_name: strazh_neo4j
26+
restart: unless-stopped
27+
ports:
28+
- 7474:7474
29+
- 7687:7687
30+
environment:
31+
NEO4J_AUTH: neo4j/strazh
32+
NEO4J_dbms_memory_pagecache_size: 1G
33+
NEO4J_dbms.memory.heap.initial_size: 1G
34+
NEO4J_dbms_memory_heap_max__size: 1G
35+
```
36+
37+
You can also use a `latest` image instead
38+
```
39+
image: vladbatushkov/strazh:latest
40+
```

Documentation/img/strazh-etl.png

35.4 KB
Loading

Documentation/manual-run.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# Manual run
3+
4+
##### Prerequisite
5+
6+
Run Neo4j on your local (for example, using docker)
7+
8+
```
9+
docker run \
10+
--name strazh_neo4j \
11+
-p7474:7474 -p7687:7687 \
12+
-d \
13+
--env NEO4J_AUTH=neo4j/strazh \
14+
neo4j:latest
15+
```
16+
17+
##### Build Strazh
18+
19+
Do fork & clone repository
20+
21+
```
22+
dotnet build ./Strazh/Strazh.csproj -c Release -o ./app
23+
```
24+
25+
##### Run Strazh
26+
27+
```
28+
dotnet ./app/Strazh.dll -c neo4j:neo4j:strazh -p ./Strazh/Strazh.csproj
29+
```
30+
31+
We point Strazh to build a Codebase Knowledge Graph of Strazh codebase :-)

README.md

Lines changed: 10 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,18 @@
1-
# strazh
2-
Your code - is your Knowledge Graph.
1+
# Strazh
2+
Your codebase - is your Knowledge Graph.
33

4-
__WIP__
4+
**Strazh** is a .NET Core console app to build a Codebase Knowledge Graph from a C# codebase powered by Roslyn analyzer.
55

6-
Release plan:
6+
**Codebase Knowledge Graph** is a graph-structured dataset with free-form relationships between entities of codebase, semantic models of programming language, project structure and other interlinked knowledges.
77

8-
- 1.0.0-alpha
9-
- 1.0.0-alpha.1..N <-- HERE NOW
10-
- 1.0.0-beta
11-
- 1.0.0-beta.1..N
12-
- 1.0.0
8+
![ETL](/Documentation/img/strazh-etl.png)
139

14-
### local
10+
More details in the article [Codebase Knowledge Graph](https://vladbatushkov.medium.com/204f32b58813?source=friends_link&sk=adc2d577a5fa3ae9886b2dd6eb29b428)
1511

16-
Build `strazh` from repository root:
17-
```
18-
dotnet build ./Strazh/Strazh.csproj -c Release -o /app
19-
```
20-
Run `strazh` to analyze `Strazh.csproj`:
21-
```
22-
dotnet ./app/Strazh.dll -c neo4j:neo4j:strazh -p ./Strazh/Strazh.csproj
23-
```
12+
#### Documentation
2413

25-
### docker
14+
[Run with docker-compose](/Documentation/docker-compose-run.md)
2615

27-
In case you want to create a local `strazh:dev` image:
16+
[Manual run](/Documentation/manual-run.md)
2817

29-
```
30-
docker build . -t strazh:dev
31-
```
32-
33-
Example how to run created `strazh:dev` container against the `Strazh.csproj` project (strazh can explore strazh codebase O_o )
34-
35-
```
36-
docker run -it --rm --network=host -v $(pwd)/Strazh:/dest -e c=neo4j:neo4j:strazh -e p=/dest/Strazh.csproj strazh:dev
37-
```
38-
39-
Run with cli from `Strazh` folder: `dotnet Strazh.dll -c neo4j:neo4j:strazh -p ../../../Strazh.csproj`
40-
41-
Run using `dotnet run` from `Strazh` folder:
42-
```
43-
dotnet run -c "neo4j:neo4j:strazh" -p "./Strazh.csproj"
44-
```
45-
46-
- docker volume used to map folder `/Strazh` to folder `/dest` inside docker.
47-
- environment value `c` used to connect to Neo4j with `database:user:password` credentials.
48-
- environment value `m` used to point to mode of analysis used for run.
49-
- environment value `s` used to point to solution file inside docker container.
50-
- environment value `p` used to point to project files inside docker container.
51-
52-
**docker-compose.yml**
53-
54-
Another one option to build and run `strazh` is to use next `docker-compose` config:
55-
```
56-
version: '3'
57-
services:
58-
59-
strazh:
60-
build: .
61-
image: vladbatushkov/strazh:1.0.0-alpha.3
62-
container_name: strazh
63-
network_mode: host
64-
volumes:
65-
- ./Strazh:/dest
66-
environment:
67-
- c=neo4j:neo4j:strazh
68-
- p=/dest/Strazh.csproj
69-
depends_on:
70-
- neo4j
71-
72-
neo4j:
73-
image: neo4j:4.2
74-
container_name: strazh_neo4j
75-
restart: unless-stopped
76-
ports:
77-
- 7474:7474
78-
- 7687:7687
79-
environment:
80-
NEO4J_AUTH: neo4j/strazh
81-
NEO4J_dbms_memory_pagecache_size: 1G
82-
NEO4J_dbms.memory.heap.initial_size: 1G
83-
NEO4J_dbms_memory_heap_max__size: 1G
84-
```
18+
[Command Line Interface](/Documentation/cli.md)

Strazh/Strazh.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
55
<TargetFramework>netcoreapp3.1</TargetFramework>
6-
<Version>1.0.0-alpha.3</Version>
6+
<Version>1.0.0-beta.1</Version>
77
</PropertyGroup>
88

99
<ItemGroup>

cypher/expose.cql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ AND n.modifiers =~ ".*public.*"
1111
RETURN labels(n)[0] as name, n.modifiers as modifier, count(n) as count
1212

1313
MATCH (n)-[:DECLARED_AT]->(:File)-[:INCLUDED_IN*]->(:Folder)<-[:INCLUDED_IN]-(p:Project)
14-
WHERE p.name = "Agoda.Cronos.Bootstrap"
14+
WHERE p.name = "a"
1515
AND (n:Class OR n:Interface)
1616
AND n.modifiers =~ ".*public.*"
1717
RETURN labels(n)[0] as name, count(n) as count
1818

1919
MATCH (m:Method)<-[:HAVE]-(c:Class)-[:DECLARED_AT]->(f:File)
20-
WHERE f.fullName =~ "Agoda.Cronos.Bootstrap.*"
21-
AND NOT f.fullName =~ "Agoda.Cronos.BootstrapUnitTests.*"
20+
WHERE f.fullName =~ "a"
21+
AND NOT f.fullName =~ "b"
2222
AND m.modifiers =~ ".*public.*"
2323
AND c.modifiers =~ ".*public.*"
2424
RETURN labels(m)[0] as name,

0 commit comments

Comments
 (0)