{"messages":[{"content":"You are a constitutional council ranking individual git commits for ownership allocation.\n\nCompare these two commits. Decide which contributed more lasting value to the project.\n\nJudge substance, not spectacle:\n- Prefer correct, lasting design and real bugfixes over churn, formatting, renames, or generated noise.\n- Prefer clarity and necessity over sheer line count. A small precise change can beat a large diffuse one.\n- Do not favor a side merely because its patch is longer or noisier.\n- Weight what the change does for the project, not the contributor's name.\n\nReturn ONLY a JSON object: {\"winner\": \"A\" or \"B\", \"ratio\": \"N:M\", \"explanation\": \"...\"}\nThe explanation must cite concrete differences in the patches (1-3 sentences).\n\nSide A — contributor: tommy-mor\nSide A — commit message:\n[798c764d] feat(html): grouped cli_panel with hover-to-copy and JS-safe asserts\n\nSingle bordered panel for multiple commands; rows copy on click without a\nseparate copy control. Assert CLI strings contain no chars that would break\nsingle-quoted onclick JS.\n\nMade-with: Cursor\n\nSide A — unified diff (full patch):\ndiff --git a/server/src/html/forum.rs b/server/src/html/forum.rs\nindex f6e45b05bb92126966e304619f80ef1d45be7a4b..075860914a6ce18bb0dfa73dc5651ef1a6318b67 100644\n--- a/server/src/html/forum.rs\n+++ b/server/src/html/forum.rs\n@@ -718,7 +718,7 @@ pub async fn home(\n }\n div id=\"public-new-thread-ui-slot\" {}\n (render_thread_feed(Some(&nav), \"thread-feed\", &public_rows, now))\n- (cli_panel(\"npx slugsocial public forum list\"))\n+ (cli_panel(&[\"npx slugsocial public forum list\"]))\n },\n None,\n theme_from_jar(&jar),\n@@ -868,7 +868,7 @@ async fn thread_view_inner(\n div id=\"thread-live-region\" {\n (compose_form(&nav, &tag, show_compose))\n }\n- (cli_panel(&cli))\n+ (cli_panel(std::slice::from_ref(&cli)))\n },\n None,\n theme_from_jar(&jar),\n@@ -984,9 +984,7 @@ pub async fn room_page(\n (new_thread_form_for_room(&nav, true, false))\n }\n }\n- (cli_panel(&forum_cli))\n- (cli_panel(&garden_cli))\n- (cli_panel(&audit_cli))\n+ (cli_panel(&[forum_cli, garden_cli, audit_cli]))\n },\n None,\n theme_from_jar(&jar),\n@@ -1409,7 +1407,7 @@ pub async fn user_profile_page(\n }\n }\n }\n- (cli_panel(&format!(\"npx slugsocial public forum list\")))\n+ (cli_panel(&[format!(\"npx slugsocial public forum list\")]))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/src/html/garden.rs b/server/src/html/garden.rs\nindex 9b4789a79c3e293cbfc5f033a0eac8650320d94d..c8ce7de450f7d14e04020511e7eb7323bd487deb 100644\n--- a/server/src/html/garden.rs\n+++ b/server/src/html/garden.rs\n@@ -139,7 +139,7 @@ pub async fn garden_index(\n }\n }\n }\n- (cli_panel(\"npx slugsocial garden tree\"))\n+ (cli_panel(&[\"npx slugsocial garden tree\"]))\n },\n None,\n theme_from_jar(&jar),\n@@ -542,7 +542,7 @@ async fn render_scope_view(\n ScopeId::Public => format!(\"npx slugsocial public garden body {}\", path.as_str().trim_start_matches(\"https://slug.social/~/\")),\n ScopeId::Room(room_id) => format!(\"npx slugsocial private {room_id} garden body {}\", path.as_str().trim_start_matches(\"https://slug.social/~/\")),\n };\n- (cli_panel(&cli))\n+ (cli_panel(std::slice::from_ref(&cli)))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/src/html/mod.rs b/server/src/html/mod.rs\nindex e7f5bfb7a4b2dee2adf96447224c58d641092124..6617781a2e8e86c2e2693788ea7cd0eb0e3659a2 100644\n--- a/server/src/html/mod.rs\n+++ b/server/src/html/mod.rs\n@@ -599,18 +599,38 @@ pub(super) fn render_linkified_with_embeds_in_scope(raw: &str, garden_prefix: &s\n }\n }\n \n-/// Small CLI hint panel showing how to look up this page from the terminal.\n-pub(super) fn cli_panel(cmd: &str) -> Markup {\n+/// CLI strings are embedded in a single-quoted JS literal; they must never need escaping.\n+fn assert_cli_panel_cmd_js_single_quote_safe(s: &str) {\n+ assert!(\n+ !s.contains('\\\\')\n+ && !s.contains('\\'')\n+ && !s.contains('\\n')\n+ && !s.contains('\\r'),\n+ \"cli_panel cmd must not contain `\\\\`, `'`, or newlines (got {s:?})\"\n+ );\n+}\n+\n+/// Small CLI hint panel: one border and title; each line is hover-highlighted and copies on click.\n+pub(super) fn cli_panel>(cmds: &[I]) -> Markup {\n+ if cmds.is_empty() {\n+ return html! {};\n+ }\n+ for cmd in cmds {\n+ assert_cli_panel_cmd_js_single_quote_safe(cmd.as_ref());\n+ }\n html! {\n div class=\"cli-panel\" {\n span class=\"cli-panel-label muted\" { \"cli\" }\n- code class=\"cli-panel-cmd\" { (cmd) }\n- button\n- class=\"cli-panel-copy\"\n- title=\"Copy to clipboard\"\n- onclick=(format!(r#\"navigator.clipboard.writeText('{}'); this.textContent='✓'; setTimeout(() => this.textContent='copy', 2000);\"#, cmd.replace(\"'\", \"\\\\'\")))\n- {\n- \"copy\"\n+ div class=\"cli-panel-cmds\" {\n+ @for cmd in cmds {\n+ @let s = cmd.as_ref();\n+ button type=\"button\" class=\"cli-panel-row\" title=\"Copy command\" onclick=(format!(\n+ r#\"navigator.clipboard.writeText('{}');\"#,\n+ s\n+ )) {\n+ code class=\"cli-panel-cmd\" { (s) }\n+ }\n+ }\n }\n }\n }\ndiff --git a/server/src/html/search.rs b/server/src/html/search.rs\nindex 28ceaa53c3fcac6777311535e95fb771b19438f5..43e6ebf36cf0fe72c96f0f9d850bea51ac094c43 100644\n--- a/server/src/html/search.rs\n+++ b/server/src/html/search.rs\n@@ -418,7 +418,7 @@ pub async fn search_page(\n value=(query) autocomplete=\"off\" autofocus;\n }\n (render_search_results(&results, &query))\n- (cli_panel(\"npx slugsocial search \"))\n+ (cli_panel(&[\"npx slugsocial search \"]))\n },\n None,\n theme_from_jar(&jar),\ndiff --git a/server/static/theme_default.css b/server/static/theme_default.css\nindex e024a5c8b74139ae8be37b2a1bd17e4c3abe9324..764b66c8208e91e6138b83c534387cf43c85b8b5 100644\n--- a/server/static/theme_default.css\n+++ b/server/static/theme_default.css\n@@ -610,7 +610,7 @@ code {\n CLI PANEL — how to view this page from the terminal\n ---------------------------------------------------------------- */\n div.cli-panel {\n- align-items: baseline;\n+ align-items: flex-start;\n background: var(--g1);\n border: var(--bv) solid;\n border-color: var(--lo) var(--hi) var(--hi) var(--lo); /* inset */\n@@ -621,11 +621,34 @@ div.cli-panel {\n width: fit-content;\n max-width: 100%;\n }\n+.cli-panel-cmds {\n+ display: flex;\n+ flex-direction: column;\n+ gap: 4px;\n+ flex: 1;\n+ min-width: 0;\n+}\n+button.cli-panel-row {\n+ background: transparent;\n+ border: none;\n+ color: inherit;\n+ cursor: pointer;\n+ display: block;\n+ font: inherit;\n+ margin: 0;\n+ padding: 2px 4px;\n+ text-align: left;\n+ width: 100%;\n+}\n+button.cli-panel-row:hover {\n+ background: var(--g3);\n+}\n .cli-panel-label {\n font-size: 11px;\n letter-spacing: 0.08em;\n text-transform: uppercase;\n flex-shrink: 0;\n+ padding-top: 2px;\n }\n .cli-panel-cmd {\n background: none;\ndiff --git a/server/static/theme_retro_craft.css b/server/static/theme_retro_craft.css\nindex 00714575bfa533d1d9c66653b9089642e2b0a6ca..f89ecbc3a18eb9b2b27d1f7764330f6bd6987552 100644\n--- a/server/static/theme_retro_craft.css\n+++ b/server/static/theme_retro_craft.css\n@@ -306,19 +306,41 @@ a.post-nav-btn:hover {\n }\n \n div.cli-panel {\n- align-items: baseline;\n+ align-items: flex-start;\n border: 1px dashed var(--line);\n display: flex;\n- flex-wrap: wrap;\n gap: 0.5rem;\n margin: 0.65rem 0;\n padding: 0.45rem 0.65rem;\n }\n+.cli-panel-cmds {\n+ display: flex;\n+ flex-direction: column;\n+ gap: 0.25rem;\n+ flex: 1;\n+ min-width: 0;\n+}\n+button.cli-panel-row {\n+ background: transparent;\n+ border: none;\n+ color: inherit;\n+ cursor: pointer;\n+ display: block;\n+ font: inherit;\n+ margin: 0;\n+ padding: 0.1rem 0.2rem;\n+ text-align: left;\n+ width: 100%;\n+}\n+button.cli-panel-row:hover {\n+ background: color-mix(in srgb, var(--accent) 14%, transparent);\n+}\n .cli-panel-label {\n color: var(--ink-dim);\n font-size: 0.72rem;\n letter-spacing: 0.12em;\n text-transform: uppercase;\n+ padding-top: 0.12rem;\n }\n .cli-panel-cmd {\n color: var(--accent);\n\n\nSide B — contributor: tommy-mor\nSide B — commit message:\n[9e3d989b] Add test that 25 spanning-tree votes with perfect ratios sort the alphabet.\n\nDemonstrates rank centrality recovers the true order from a random connected\ncomparison graph when each vote encodes item strength as (idx+1).\n\nCo-authored-by: Cursor \n\nSide B — unified diff (full patch):\ndiff --git a/server/src/ranking.rs b/server/src/ranking.rs\nindex c9b4d5d89d2f22cf53a5b43eb979e19a11bc89a1..93cb4c9f5887a1e598cdc9d648751055f618adcc 100644\n--- a/server/src/ranking.rs\n+++ b/server/src/ranking.rs\n@@ -369,6 +369,48 @@ mod tests {\n assert_eq!(comp1, vec![\"c\", \"d\"]);\n }\n \n+ /// A random spanning tree over 26 items needs only n−1 = 25 pairwise votes.\n+ /// When each vote uses the \"perfect\" ratio (strength left : strength right =\n+ /// (idx_left+1) : (idx_right+1)), rank centrality recovers the true order.\n+ /// See `rank-eric.py` (Eric's demo of Negahban–Oh–Shah rank centrality).\n+ #[test]\n+ fn twenty_five_random_votes_perfect_ratios_sort_alphabet() {\n+ use rand::seq::SliceRandom;\n+\n+ const N: usize = 26;\n+ let letters: Vec = (0..N).map(|i| char::from(b'a' + i as u8)).collect();\n+\n+ let mut rng = rand::thread_rng();\n+ let mut perm: Vec = (0..N).collect();\n+ perm.shuffle(&mut rng);\n+\n+ let mut g = mk_group();\n+ for k in 1..N {\n+ let i = *perm[..k].choose(&mut rng).unwrap();\n+ let j = perm[k];\n+ let (a, b) = (letters[i], letters[j]);\n+ g.apply_vote(vote(\n+ k as i64,\n+ &a.to_string(),\n+ &b.to_string(),\n+ (i + 1) as i32,\n+ (j + 1) as i32,\n+ ));\n+ }\n+\n+ let ranked = ranked_items(&g);\n+ assert_eq!(ranked.len(), N);\n+ for (rank, item) in ranked.iter().enumerate() {\n+ let expected = char::from(b'a' + (N - 1 - rank) as u8);\n+ assert_eq!(\n+ item.item.as_str(),\n+ expected.to_string(),\n+ \"rank {rank}: expected '{expected}', got '{}'\",\n+ item.item.as_str()\n+ );\n+ }\n+ }\n+\n #[test]\n fn subset_ranking_ranks_within_component_only() {\n let mut g = mk_group();\n","role":"user"}],"model":"openai/gpt-chat-latest"}