Skip to content

Commit e077752

Browse files
elbrunoCopilot
andcommitted
merge: viewer guides, worked examples, and all export formats
- Wire all 7 export formats into CLI (SVG, Neo4j, Obsidian, Wiki, Report) - Create sample project with pre-generated worked examples - 8 new format guide docs + export overview - 17 new integration tests (454 total, 0 failures) - Update README with export format table and worked examples - Remove bin/obj artifacts from git tracking Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2 parents 5359272 + 30e2b78 commit e077752

501 files changed

Lines changed: 6645 additions & 23069 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.squad/agents/morpheus/history.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,43 @@ Graphify.Mcp.exe <path-to-graph.json> [--verbose]
176176
- `Graphify.Sdk.csproj` — Added 3 new package references
177177
- `GitHubModelsClientFactory.cs` — Replaced NotImplementedException with working OpenAI client code
178178

179+
### 2026-04-06: Export Format Documentation (7 Guides + Overview)
180+
181+
**What:** Created comprehensive user-facing documentation for all 7 export formats supported by graphify-dotnet CLI.
182+
183+
**Artifacts Created:**
184+
1. **docs/export-formats.md** — Overview with format comparison table, quick-start examples, and routing guide for choosing the right format
185+
2. **docs/format-html.md** — Interactive vis-network viewer; click nodes, search, filter, zoom/pan; best for exploration and presentations
186+
3. **docs/format-json.md** — Machine-readable graph data; JSON schema, loading examples (C#/JS/Python), jq piping, CI/CD integration
187+
4. **docs/format-svg.md** — Static vector image; embed in docs, print to PDF, convert to PNG; for documentation and offline viewing
188+
5. **docs/format-neo4j.md** — Cypher script for Neo4j import; advanced queries, shortest paths, cycle detection, bulk import examples
189+
6. **docs/format-obsidian.md** — Personal knowledge vault; wikilinks, YAML frontmatter, Obsidian plugins, knowledge management workflows
190+
7. **docs/format-wiki.md** — Team documentation site; agent-crawlable structure, community pages, god node analysis, GitHub Pages hosting
191+
8. **docs/format-report.md** — Human-readable analysis; god nodes, surprising connections, communities, suggested questions, metrics
192+
193+
**Key Decisions:**
194+
- **Consistent structure:** Each format guide follows: title, quick-start, what it produces, how to use, features, best for, examples, customization, size/limitations, cross-references
195+
- **Audience-specific:** HTML for visual explorers; JSON for developers; SVG for documentarians; Neo4j for analysts; Obsidian for knowledge workers; Wiki for teams; Report for everyone
196+
- **Practical examples:** Showed CLI commands, code samples (C#, JavaScript, Python, bash), workflow patterns
197+
- **Cross-linking:** All guides link to overview and related formats; overview table shows format names, outputs, use cases, interactivity levels
198+
- **Default formats:** Documented json, html, report as defaults; show multi-format combinations for different goals
199+
- **Format comparison:** Overview table and "Choosing Multiple Formats" section help users select the right export strategy
200+
201+
**Rationale:**
202+
The CLI supports 7 distinct export formats serving different use cases. Users needed clear guidance on:
203+
- What each format produces
204+
- When to use each one
205+
- How to access and manipulate the output
206+
- Real-world workflows and integrations
207+
- Performance characteristics and limitations
208+
209+
Documentation reduces user friction and enables full feature adoption.
210+
211+
**Documentation Style:**
212+
- Concise (100–200 lines per guide)
213+
- Practical (CLI examples, code samples, real workflows)
214+
- Inclusive ("Quick Start" top of each, "See Also" linking structure)
215+
- User-centric (guides organized by use case, not just technical features)
216+
- Markdown with code blocks, tables, and inline formatting for GitHub/web presentation
217+
179218

.squad/agents/tank/history.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,3 +347,51 @@ Created 11 new test files covering exporters, pipeline stages, models, SDK, and
347347

348348
**Test run**: 404 tests passing (383 unit + 21 integration), 0 failures. 181 new tests added.
349349

350+
### 2026-04-07: Format Routing and Sample Project Integration Tests
351+
352+
Created comprehensive integration test suite for PipelineRunner format routing and end-to-end project processing:
353+
354+
**FormatRoutingTests.cs** (11 tests):
355+
- JSON format routing and file creation
356+
- HTML format routing and file creation
357+
- SVG format routing and file creation
358+
- Neo4j format routing and Cypher file creation
359+
- Obsidian format routing and vault directory creation
360+
- Wiki format routing and markdown page creation
361+
- Report format routing and GRAPH_REPORT.md creation
362+
- All formats simultaneously (7 formats: json, html, svg, neo4j, obsidian, wiki, report)
363+
- Unknown format handling (warning logged, known formats succeed)
364+
- Comma-separated format string parsing
365+
- Empty formats array (completes without exports)
366+
367+
**SampleProjectTests.cs** (3 tests):
368+
- Mini-library sample project: 6 C# files (IRepository, Repository, IService, Service, Model, Controller) with dependency injection patterns
369+
- ProcessSampleProject_ProducesNonEmptyGraph: verifies nodes and edges extracted from realistic codebase
370+
- ProcessSampleProject_DetectsAllFiles: verifies all .cs files detected during file discovery phase
371+
- ProcessSampleProject_AllFormatsSucceed: all 7 export formats produce output for sample project
372+
373+
**ExportIntegrationTests.cs** (4 new tests):
374+
- ReportGeneration_ProducesMarkdownReport: verifies ReportGenerator creates markdown with statistics, god nodes, communities
375+
- SvgExport_ProducesValidSvg: validates SVG XML structure with circles (nodes), lines (edges), legend
376+
- Neo4jExport_ProducesValidCypher: validates Cypher CREATE statements with proper escaping
377+
- (Retained existing tests: JsonExport_ThenReimport, HtmlExport_ProducesValidHtml, MultiFormatExport, Export_ToNonExistentDirectory)
378+
379+
**Key decisions**:
380+
- Tests create temp directory mini-projects with realistic C# source files for integration testing
381+
- Each format test verifies specific output artifact exists and has expected content structure
382+
- Tests are forward-compatible: written to verify routing logic Trinity is implementing in PipelineRunner
383+
- Currently passing: json, html, svg formats (6 tests passing for implemented formats)
384+
- Currently failing: neo4j, obsidian, wiki, report formats (6 tests failing, awaiting Trinity's PipelineRunner switch statement completion)
385+
- All tests use IDisposable pattern with temp directory cleanup
386+
- Sample project tests verify end-to-end pipeline from C# source → graph → all export formats
387+
388+
**Test run**:
389+
- Integration tests: 31 passing, 6 failing (expected: waiting for Trinity to add remaining format switch cases)
390+
- Unit tests: 416 passing, 0 failing
391+
- Total: 447 tests (18 new integration tests added)
392+
393+
**Observed**:
394+
- Tests were already committed by Trinity in commit 9f0d98f before Tank completed writing them
395+
- Tests align with Trinity's PipelineRunner implementation in progress
396+
- Test suite is comprehensive and ready for when all format routing is complete
397+

.squad/agents/trinity/history.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,3 +569,53 @@
569569

570570
**Validation**: `dotnet test src/tests/Graphify.Integration.Tests/` — 21/21 passed in ~3.4s.
571571

572+
### 2026-04-07: Wire All Exporters + Sample Project
573+
574+
**Context**: Completed wiring of all exporters into PipelineRunner and created a sample C# project for testing.
575+
576+
**Task 1 — Wired all exporters into CLI:**
577+
- Extended PipelineRunner.cs Stage 6 export switch to support ALL 7 formats:
578+
- `json` → JsonExporter → graph.json
579+
- `html` → HtmlExporter (with community labels) → graph.html
580+
- `svg` → SvgExporter → graph.svg (NEW)
581+
- `neo4j` → Neo4jExporter → graph.cypher (NEW)
582+
- `obsidian` → ObsidianExporter → obsidian/ subdirectory (NEW)
583+
- `wiki` → WikiExporter → wiki/ subdirectory (NEW)
584+
- `report` → ReportGenerator → GRAPH_REPORT.md (NEW)
585+
- Added helper methods to PipelineRunner:
586+
- `BuildCommunityLabels()`: Creates labels based on most common node type per community (from Analyzer.cs pattern)
587+
- `CalculateCohesionScores()`: Computes internal edge density per community
588+
- `CalculateCohesion()`: Internal edge count / possible edge count formula
589+
- Updated Program.cs default format from `"json,html"` to `"json,html,report"`
590+
- Updated --format option description to list all 7 supported formats
591+
592+
**Task 2 — Created samples/mini-library/:**
593+
- Created realistic mini C# library demonstrating repository pattern at `samples/mini-library/`
594+
- 6 files total:
595+
1. `src/IRepository.cs`: Generic repository interface with CRUD methods
596+
2. `src/User.cs`: Simple entity model with validation
597+
3. `src/UserRepository.cs`: In-memory implementation with thread-safety
598+
4. `src/UserService.cs`: Service layer with business logic
599+
5. `src/ServiceCollectionExtensions.cs`: DI registration helpers
600+
6. `README.md`: Documentation explaining the sample structure and expected graph output
601+
- All files include XML doc comments
602+
- Demonstrates interface/implementation, generic constraints, async/await, DI patterns
603+
- No .csproj needed (graphify analyzes source files directly)
604+
605+
**Technical Decisions**:
606+
- Stored AnalysisResult in Stage 5 for use in Stage 6 (previously discarded)
607+
- HtmlExporter now receives community labels parameter (was passing null before)
608+
- Report generator needs project name — derived from input path basename
609+
- Directory-based exporters (obsidian, wiki) use subdirectories in output path
610+
- Neo4j exporter outputs `.cypher` extension (not `.neo4j`)
611+
612+
**Build Verification**: `dotnet build src/Graphify.Cli/Graphify.Cli.csproj` — ✅ succeeded in 3.4s
613+
614+
**Commit**: 6caf710 — "feat: wire all exporters into CLI + create sample project"
615+
616+
**Impact**:
617+
- Users can now export to ANY format via `--format svg,neo4j,obsidian,wiki,report`
618+
- Report format is included by default, providing immediate analysis summary
619+
- Sample project gives new users a working example to test against
620+
- All exporters now actually accessible from CLI (previously only json/html worked)
621+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
# Decision: Export Format Architecture + Default Formats
2+
3+
**Author:** Trinity (Core Dev)
4+
**Date:** 2026-04-07
5+
**Status:** Proposed for team review
6+
7+
## Context
8+
9+
All exporters were implemented (JSON, HTML, SVG, Neo4j, Obsidian, Wiki) and ReportGenerator existed, but PipelineRunner only wired JSON and HTML. Users couldn't access the other formats from the CLI.
10+
11+
## Decision
12+
13+
### 1. Wired All Exporters into PipelineRunner
14+
15+
Extended the Stage 6 export switch statement to support all 7 export formats:
16+
- `json` → graph.json (existing)
17+
- `html` → graph.html with community labels (existing, enhanced)
18+
- `svg` → graph.svg (NEW)
19+
- `neo4j` → graph.cypher (NEW)
20+
- `obsidian` → obsidian/ directory (NEW)
21+
- `wiki` → wiki/ directory (NEW)
22+
- `report` → GRAPH_REPORT.md (NEW)
23+
24+
### 2. Community Data Generation
25+
26+
Added helper methods to PipelineRunner for community analysis:
27+
- `BuildCommunityLabels()`: Generates human-readable labels based on most common node type per community
28+
- `CalculateCohesionScores()`: Computes internal edge density for each community
29+
- Pattern follows existing Analyzer.cs and WikiExporter.cs implementations
30+
31+
### 3. Default Format Change
32+
33+
Changed default `--format` from `"json,html"` to `"json,html,report"`.
34+
35+
**Rationale:**
36+
- Report provides immediate human-readable analysis summary
37+
- No significant performance cost (analysis already runs)
38+
- JSON remains for machine consumption
39+
- HTML remains for interactive visualization
40+
- Report adds actionable insights (god nodes, communities, surprising connections)
41+
42+
### 4. Export Path Conventions
43+
44+
- Single-file formats: Use filename from format (e.g., `graph.json`, `graph.svg`, `graph.cypher`)
45+
- Directory formats: Use subdirectory (e.g., `obsidian/`, `wiki/`)
46+
- Report: Fixed filename `GRAPH_REPORT.md` (matches Python graphify)
47+
48+
## Alternatives Considered
49+
50+
1. **Keep default as json,html only**: Rejected. Report is valuable and cheap to generate.
51+
2. **Use .neo4j extension**: Rejected. Community convention is `.cypher` for Cypher scripts.
52+
3. **Put community helpers in Analyzer**: Rejected. These are export-specific computations, not analysis insights.
53+
54+
## Impact
55+
56+
**Positive:**
57+
- All 7 export formats now accessible from CLI
58+
- Default output includes actionable analysis (report)
59+
- Community labels enhance HTML and report readability
60+
- Consistent export path conventions
61+
62+
**Negative:**
63+
- Default output directory has one more file (GRAPH_REPORT.md)
64+
- Minimal — users can override with `--format json,html` if they want old behavior
65+
66+
## Open Questions
67+
68+
1. Should we add a `--format all` shorthand for all 7 formats?
69+
2. Should report format support custom templates or always use fixed structure?
70+
3. Do we need a `--report-title` option, or is deriving from input path sufficient?
71+
72+
## Recommendation
73+
74+
Accept this as the standard export architecture. If team agrees, move this decision to `.squad/decisions.md` under "Active Decisions".

README.md

Lines changed: 76 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -65,34 +65,29 @@ graphify-dotnet supports multiple AI backends through a unified `ChatClientFacto
6565

6666
```bash
6767
# Build a knowledge graph from current directory
68-
dotnet run --project src/Graphify.Cli -- run .
68+
graphify run .
6969

7070
# Watch for changes, incrementally update graph
71-
dotnet run --project src/Graphify.Cli -- watch .
72-
73-
# If installed as a global tool:
74-
graphify run .
7571
graphify watch .
7672

7773
# Build from a specific folder
78-
dotnet run --project src/Graphify.Cli -- run ./your-project
74+
graphify run ./your-project
7975

80-
# Query the graph
81-
dotnet run --project src/Graphify.Cli -- query "what connects AuthService to Database?"
76+
# Export all formats
77+
graphify run . --format json,html,svg,neo4j,obsidian,wiki,report
8278

83-
# Explain a specific node
84-
dotnet run --project src/Graphify.Cli -- explain "UserController"
79+
# Run benchmarks
80+
graphify benchmark graphify-out/graph.json
8581

86-
# Export in different formats
87-
dotnet run --project src/Graphify.Cli -- export --format html
88-
dotnet run --project src/Graphify.Cli -- export --format svg
89-
dotnet run --project src/Graphify.Cli -- export --format neo4j
82+
# View configuration
83+
graphify config show
84+
```
9085

91-
# Analyze the graph
92-
dotnet run --project src/Graphify.Cli -- analyze
86+
### Build from Source
9387

94-
# Run benchmarks
95-
dotnet run --project src/Graphify.Cli -- benchmark
88+
```bash
89+
dotnet run --project src/Graphify.Cli -- run .
90+
dotnet run --project src/Graphify.Cli -- run ./your-project --format json,html,report -v
9691
```
9792

9893
### AI Provider Configuration
@@ -117,20 +112,17 @@ graphify config show
117112
### Advanced Options
118113

119114
```bash
120-
# Deep mode (more aggressive inferred edge extraction)
121-
dotnet run --project src/Graphify.Cli -- run . --mode deep
115+
# Verbose mode (detailed progress for each file)
116+
graphify run . -v
122117

123-
# Update only changed files
124-
dotnet run --project src/Graphify.Cli -- run . --update
118+
# Custom output directory
119+
graphify run . --output my-output-dir
125120

126-
# Rerun clustering without re-extraction
127-
dotnet run --project src/Graphify.Cli -- run . --cluster-only
121+
# Specific export formats
122+
graphify run . --format json,html,svg
128123

129-
# Skip HTML visualization
130-
dotnet run --project src/Graphify.Cli -- run . --no-viz
131-
132-
# Generate Obsidian vault
133-
dotnet run --project src/Graphify.Cli -- run . --obsidian
124+
# All formats at once
125+
graphify run . --format json,html,svg,neo4j,obsidian,wiki,report
134126
```
135127

136128
## Configuration
@@ -199,13 +191,48 @@ See [ARCHITECTURE.md](ARCHITECTURE.md) for detailed component documentation.
199191

200192
## Export Formats
201193

202-
- **JSON** (`graph.json`): Complete graph with nodes, edges, communities, metadata
203-
- **HTML** (`graph.html`): Interactive vis.js visualization — click nodes, search, filter by community
204-
- **SVG** (`graph.svg`): Static vector graphic for documentation
205-
- **GraphML** (`graph.graphml`): Import into Gephi or yEd
206-
- **Wiki** (`wiki/`): Wikipedia-style markdown articles per community
207-
- **Obsidian** (`obsidian-vault/`): Vault with backlinks and graph view
208-
- **Neo4j Cypher** (`cypher.txt`): Import script or direct push to Neo4j instance
194+
graphify supports 7 export formats, each optimized for different use cases:
195+
196+
| Format | CLI Flag | Output | Description | Guide |
197+
|--------|----------|--------|-------------|-------|
198+
| **JSON** | `json` | `graph.json` | Machine-readable graph data | [Guide](docs/format-json.md) |
199+
| **HTML** | `html` | `graph.html` | Interactive vis.js viewer | [Guide](docs/format-html.md) |
200+
| **Report** | `report` | `GRAPH_REPORT.md` | Human-readable analysis | [Guide](docs/format-report.md) |
201+
| **SVG** | `svg` | `graph.svg` | Static vector image | [Guide](docs/format-svg.md) |
202+
| **Neo4j** | `neo4j` | `graph.cypher` | Cypher import script | [Guide](docs/format-neo4j.md) |
203+
| **Obsidian** | `obsidian` | `obsidian/` | Markdown vault with wikilinks | [Guide](docs/format-obsidian.md) |
204+
| **Wiki** | `wiki` | `wiki/` | Agent-crawlable wiki pages | [Guide](docs/format-wiki.md) |
205+
206+
**Default formats:** `json,html,report` — use `--format` to customize.
207+
208+
See [Export Formats Overview](docs/export-formats.md) for detailed comparison and usage.
209+
210+
## Worked Example
211+
212+
The `samples/mini-library/` directory contains a complete worked example — a small C# library demonstrating the repository pattern. Run the pipeline and see all 7 output formats:
213+
214+
```bash
215+
# Generate all formats from the sample project
216+
graphify run samples/mini-library --format json,html,svg,neo4j,obsidian,wiki,report
217+
218+
# Or build from source
219+
dotnet run --project src/Graphify.Cli -- run samples/mini-library --format json,html,svg,neo4j,obsidian,wiki,report -v
220+
```
221+
222+
**Pre-generated output** is available at [`samples/mini-library/graphify-out/`](samples/mini-library/graphify-out/):
223+
224+
```
225+
samples/mini-library/graphify-out/
226+
├── GRAPH_REPORT.md # Analysis report (god nodes, communities, insights)
227+
├── graph.json # Full graph data (47 nodes, 79 edges)
228+
├── graph.html # Interactive vis.js viewer — open in browser
229+
├── graph.svg # Static vector image
230+
├── graph.cypher # Neo4j import script
231+
├── obsidian/ # Obsidian vault (35 .md files with wikilinks)
232+
└── wiki/ # Agent-crawlable wiki (index + community pages)
233+
```
234+
235+
**Results:** 6 C# files → 47 nodes, 79 edges, 7 communities detected. 100% EXTRACTED (AST-only, no AI provider needed).
209236

210237
## Building from Source
211238

@@ -232,10 +259,23 @@ dotnet run --project src/Graphify.Cli -- run .
232259

233260
## Documentation
234261

262+
### Setup Guides
235263
- [Azure OpenAI Setup](docs/setup-azure-openai.md)
236264
- [Ollama Setup](docs/setup-ollama.md)
237265
- [Global Tool Install](docs/dotnet-tool-install.md)
238266
- [Watch Mode](docs/watch-mode.md)
267+
268+
### Export Format Guides
269+
- [Export Formats Overview](docs/export-formats.md)
270+
- [HTML Interactive Viewer](docs/format-html.md)
271+
- [JSON Graph Export](docs/format-json.md)
272+
- [SVG Graph Export](docs/format-svg.md)
273+
- [Neo4j Cypher Export](docs/format-neo4j.md)
274+
- [Obsidian Vault Export](docs/format-obsidian.md)
275+
- [Wiki Export](docs/format-wiki.md)
276+
- [Graph Analysis Report](docs/format-report.md)
277+
278+
### Architecture
239279
- [Architecture](ARCHITECTURE.md)
240280

241281
## License

0 commit comments

Comments
 (0)