diff --git a/CHANGELOG.md b/CHANGELOG.md index e7fc7ce..94e4aa0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/src/application/stats.rs b/src/application/stats.rs index 10145ef..c15daf6 100644 --- a/src/application/stats.rs +++ b/src/application/stats.rs @@ -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 |"); diff --git a/src/domain/stats.rs b/src/domain/stats.rs index 3699b2b..9e76fbb 100644 --- a/src/domain/stats.rs +++ b/src/domain/stats.rs @@ -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 = 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); @@ -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)); @@ -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:")); } diff --git a/templates/app.js b/templates/app.js index c3a321f..348cb30 100644 --- a/templates/app.js +++ b/templates/app.js @@ -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 || ''; @@ -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 || '-'; @@ -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) }, diff --git a/templates/styles.css b/templates/styles.css index fbf508a..8215ff6 100644 --- a/templates/styles.css +++ b/templates/styles.css @@ -523,6 +523,7 @@ table { /* View Containers */ .view-container { min-height: 400px; + overflow-x: auto; } /* ============================================================================ diff --git a/templates/viewer.html b/templates/viewer.html index 939b859..2d61dd0 100644 --- a/templates/viewer.html +++ b/templates/viewer.html @@ -136,6 +136,7 @@

Date Range

Status Title Category + Project Author Created Updated