Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- **[Viewer]**: Surface the `project` facet that was already parsed and filtered
- New sortable **Project** column in the list view, and a Project row in the detail panel
- `stats` now reports `By Project`, in both the summary and the Markdown output
- The list view scrolls horizontally instead of overflowing on narrow windows

- **[Docs]**: Add comprehensive dependencies reference documentation
- Complete catalog of all external dependencies with purposes
- Version constraints and update policy
Expand Down
9 changes: 9 additions & 0 deletions src/application/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,15 @@ fn format_markdown(stats: &AdrStatistics) -> String {
}
}

if !stats.by_project.is_empty() {
let _ = writeln!(output, "\n## By Project\n");
let _ = writeln!(output, "| Project | Count |");
let _ = writeln!(output, "|---------|-------|");
for (project, count) in &stats.by_project {
let _ = writeln!(output, "| {project} | {count} |");
}
}

if !stats.by_author.is_empty() {
let _ = writeln!(output, "\n## By Author\n");
let _ = writeln!(output, "| Author | Count |");
Expand Down
10 changes: 10 additions & 0 deletions src/domain/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ impl AdrStatistics {
let _ = writeln!(output, "By Category: {}", parts.join(", "));
}

// Project breakdown (top 5)
if !self.by_project.is_empty() {
let top = Self::top_n(&self.by_project, 5);
let parts: Vec<String> = top.iter().map(|(k, v)| format!("{k} ({v})")).collect();
let _ = writeln!(output, "By Project: {}", parts.join(", "));
}

// Author breakdown (top 5)
if !self.by_author.is_empty() {
let top = Self::top_n(&self.by_author, 5);
Expand Down Expand Up @@ -486,12 +493,14 @@ mod tests {
let fm1 = Frontmatter::new("ADR 1")
.with_status(Status::Accepted)
.with_category("architecture")
.with_project("project-alpha")
.with_author("Alice")
.with_created(date!(2025 - 01 - 15));

let fm2 = Frontmatter::new("ADR 2")
.with_status(Status::Proposed)
.with_category("api")
.with_project("project-beta")
.with_author("Bob")
.with_created(date!(2025 - 06 - 20));

Expand Down Expand Up @@ -521,6 +530,7 @@ mod tests {

assert!(summary.contains("Total: 2 records"));
assert!(summary.contains("By Category:"));
assert!(summary.contains("By Project:"));
assert!(summary.contains("Authors:"));
assert!(summary.contains("Date Range:"));
}
Expand Down
10 changes: 10 additions & 0 deletions templates/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,10 @@
aVal = a.frontmatter.category || '';
bVal = b.frontmatter.category || '';
break;
case 'project':
aVal = a.frontmatter.project || '';
bVal = b.frontmatter.project || '';
break;
case 'author':
aVal = a.frontmatter.author || '';
bVal = b.frontmatter.author || '';
Expand Down Expand Up @@ -578,6 +582,11 @@
tdCategory.appendChild(catBadge);
tr.appendChild(tdCategory);

// Project cell
var tdProject = document.createElement('td');
tdProject.textContent = adr.frontmatter.project || '-';
tr.appendChild(tdProject);

// Author cell
var tdAuthor = document.createElement('td');
tdAuthor.textContent = adr.frontmatter.author || '-';
Expand Down Expand Up @@ -850,6 +859,7 @@

var metaItems = [
{ label: 'Category', value: fm.category || '-' },
{ label: 'Project', value: fm.project || '-' },
{ label: 'Author', value: fm.author || '-' },
{ label: 'Project', value: fm.project || '-' },
{ label: 'Created', value: formatDate(fm.created) },
Expand Down
1 change: 1 addition & 0 deletions templates/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ table {
/* View Containers */
.view-container {
min-height: 400px;
overflow-x: auto;
}

/* ============================================================================
Expand Down
1 change: 1 addition & 0 deletions templates/viewer.html
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ <h3>Date Range</h3>
<th class="sortable" data-sort="status">Status</th>
<th class="sortable" data-sort="title">Title</th>
<th class="sortable" data-sort="category">Category</th>
<th class="sortable" data-sort="project">Project</th>
<th class="sortable" data-sort="author">Author</th>
<th class="sortable" data-sort="created">Created</th>
<th class="sortable" data-sort="updated">Updated</th>
Expand Down