Skip to content

Commit 6766e7b

Browse files
TheSmallPixelclaude
andcommitted
feat: add sample project and point demo workflow at it
Adds samples/SampleProject/ with a small class hierarchy (interfaces, service, calculator) that produces a meaningful graph for the live demo. The code-graph workflow now analyzes ./samples instead of the entire repo, making the GitHub Pages visualization a proper showcase rather than a confusing self-graph of the analyzer's own internals. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 042203b commit 6766e7b

5 files changed

Lines changed: 70 additions & 3 deletions

File tree

.github/workflows/code-graph.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@ name: "Generate Code Graph"
22

33
on:
44
push:
5-
branches: [ "main" ]
5+
branches: [main]
66

77
permissions:
8-
contents: write
8+
contents: write
9+
910
jobs:
1011
generate-graph:
1112
runs-on: ubuntu-latest
1213
steps:
1314
- name: Code Graph
1415
uses: TheSmallPixel/GraphCSharp@main
1516
with:
16-
source-path: "./"
17+
source-path: "./samples"
1718
docs-dir: "docs"
1819
index-file: "index.html"
1920
commit-changes: "true"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace SampleProject;
2+
3+
public class Calculator
4+
{
5+
public int Add(int a, int b) => a + b;
6+
public int Subtract(int a, int b) => a - b;
7+
public int Multiply(int a, int b) => a * b;
8+
9+
public double Divide(int a, int b)
10+
{
11+
if (b == 0) throw new DivideByZeroException();
12+
return (double)a / b;
13+
}
14+
}

samples/SampleProject/Formatter.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
namespace SampleProject;
2+
3+
public interface IFormatter
4+
{
5+
string Format(string input);
6+
}
7+
8+
public class UpperCaseFormatter : IFormatter
9+
{
10+
public string Format(string input) => input.ToUpperInvariant();
11+
}
12+
13+
public class LowerCaseFormatter : IFormatter
14+
{
15+
public string Format(string input) => input.ToLowerInvariant();
16+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
namespace SampleProject;
2+
3+
public interface IGreetingService
4+
{
5+
string Greet(string name);
6+
}
7+
8+
public class GreetingService : IGreetingService
9+
{
10+
private readonly IFormatter _formatter;
11+
12+
public GreetingService()
13+
{
14+
_formatter = new UpperCaseFormatter();
15+
}
16+
17+
public string Greet(string name)
18+
{
19+
var raw = $"Hello, {name}!";
20+
return _formatter.Format(raw);
21+
}
22+
}

samples/SampleProject/Program.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
namespace SampleProject;
2+
3+
public class Program
4+
{
5+
public static void Main(string[] args)
6+
{
7+
var service = new GreetingService();
8+
var message = service.Greet("World");
9+
Console.WriteLine(message);
10+
11+
var calculator = new Calculator();
12+
Console.WriteLine($"2 + 3 = {calculator.Add(2, 3)}");
13+
}
14+
}

0 commit comments

Comments
 (0)