refactor(justfile): drop aliases/duplication, enforce single canonical commands, and add descriptions for all recipes

This commit is contained in:
Riz Ashraf committed 2026-10-05 10:48:43 +01:00
1 parent bd8a892101
commit 6e0ccf8082
3 files changed
+135 -107

No files matched your search

+23 -33
View File
@@ -1061,8 +1061,9 @@
const MAX_ACTIVITY_HISTORY = 100;
function parseActivityPayload(item) {
let category = 'activity';
let message = '';
let category = 'TOOL';
let summary = '';
let details = '';
let timestamp = Date.now();
if (typeof item === 'string') {
@@ -1070,40 +1071,19 @@
const parsed = JSON.parse(item);
return parseActivityPayload(parsed);
} catch (e) {
message = item;
summary = item;
}
} else if (typeof item === 'object' && item !== null) {
if (item.method === 'notifications/activity' && item.params) {
message = item.params.message || JSON.stringify(item.params);
timestamp = item.params.time || item.params.timestamp || timestamp;
category = item.params.category || item.params.type || 'tool';
} else {
category = item.category || item.type || category;
message = item.summary || item.message || item.description || item.data || JSON.stringify(item);
timestamp = item.timestamp || item.time || item.updated_at || timestamp;
if (typeof timestamp === 'number' && timestamp < 10000000000) {
timestamp = timestamp * 1000;
}
return parseActivityPayload(item.params);
}
}
category = (item.category || item.type || 'TOOL').toUpperCase();
summary = item.summary || item.message || item.description || item.data || '';
details = item.details || '';
timestamp = item.timestamp || item.time || item.updated_at || timestamp;
// Fallback inference from tool name if category is generic
const lowerCategory = category.toLowerCase();
if (lowerCategory === 'activity' || lowerCategory === 'mcp_tool' || lowerCategory === 'tool') {
const match = message.match(/Agent executed tool:\s*([a-z0-9_]+)/i);
if (match && match[1]) {
const tool = match[1].toLowerCase();
if (tool.includes('clipboard')) category = 'CLIPBOARD';
else if (tool.includes('graph') || tool.includes('entities') || tool.includes('relations') || tool.includes('schema')) category = 'GRAPH';
else if (tool.includes('decision')) category = 'DECISION';
else if (tool.includes('code_change') || tool.includes('ast')) category = 'CODE';
else if (tool.includes('task') || tool.includes('milestone')) category = 'TASK';
else if (tool.includes('note')) category = 'STICKY_NOTE';
else if (tool.includes('checkpoint') || tool.includes('snapshot')) category = 'CHECKPOINT';
else if (tool.includes('subagent') || tool.includes('namespace')) category = 'SUBAGENT';
else if (tool.includes('snippet')) category = 'SNIPPET';
else if (tool.includes('error')) category = 'ERROR_FIX';
else category = tool.toUpperCase();
if (typeof timestamp === 'number' && timestamp < 10000000000) {
timestamp = timestamp * 1000;
}
}
@@ -1131,7 +1111,11 @@
month: '2-digit', day: '2-digit', hour: '2-digit', minute:'2-digit', second:'2-digit'
});
return `<span class="time">[${timeStr}]</span> <span style="background:var(--canvas-bg); color:${badgeColor}; padding:2px 6px; border-radius:3px; font-weight:bold; margin-right:6px; border:1px solid ${badgeColor}60; text-transform:uppercase; font-size:0.75em;">${catUpper}</span> ${message}`;
let html = `<span class="time">[${timeStr}]</span> <span style="background:var(--canvas-bg); color:${badgeColor}; padding:2px 6px; border-radius:3px; font-weight:bold; margin-right:6px; border:1px solid ${badgeColor}60; text-transform:uppercase; font-size:0.75em;">${escapeHtml(catUpper)}</span> ${escapeHtml(summary)}`;
if (details) {
html += `<div style="font-size:0.85em; color:var(--text-secondary); margin-left:20px; margin-top:2px;">${escapeHtml(details)}</div>`;
}
return html;
}
async function loadActivityHistory() {
@@ -1144,7 +1128,13 @@
// Helper to normalize timestamp to epoch milliseconds
const getMillis = (item) => {
if (!item || typeof item !== 'object') return 0;
if (!item) return 0;
if (typeof item === 'string') {
try { item = JSON.parse(item); } catch(e) { return 0; }
}
if (item.method === 'notifications/activity' && item.params) {
item = item.params;
}
let val = item.timestamp || item.time || item.updated_at || 0;
if (typeof val === 'number' && val < 10000000000) {
val = val * 1000;