@skyelight/mcp 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/tools.js +25 -1
package/package.json
CHANGED
package/src/tools.js
CHANGED
|
@@ -232,6 +232,25 @@ export function renderWorkspaces(result) {
|
|
|
232
232
|
return lines.join("\n");
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
+
/**
|
|
236
|
+
* Coarse relative time.
|
|
237
|
+
*
|
|
238
|
+
* Deliberately vague past a day: an agent deciding whether to look at a
|
|
239
|
+
* project needs "today" or "last month", and a precise timestamp invites it
|
|
240
|
+
* to quote a date it has no reason to trust to the minute.
|
|
241
|
+
*/
|
|
242
|
+
function ago(ts) {
|
|
243
|
+
const mins = Math.max(0, Math.round((Date.now() - ts) / 60000));
|
|
244
|
+
if (mins < 1) return "just now";
|
|
245
|
+
if (mins < 60) return `${mins}m ago`;
|
|
246
|
+
const hours = Math.round(mins / 60);
|
|
247
|
+
if (hours < 24) return `${hours}h ago`;
|
|
248
|
+
const days = Math.round(hours / 24);
|
|
249
|
+
if (days < 30) return `${days}d ago`;
|
|
250
|
+
const months = Math.round(days / 30);
|
|
251
|
+
return months < 12 ? `${months}mo ago` : `${Math.round(months / 12)}y ago`;
|
|
252
|
+
}
|
|
253
|
+
|
|
235
254
|
export function renderProjects(result) {
|
|
236
255
|
const { projects, total } = result;
|
|
237
256
|
if (total === 0) {
|
|
@@ -244,7 +263,12 @@ export function renderProjects(result) {
|
|
|
244
263
|
for (const p of projects) {
|
|
245
264
|
// The workspace is only worth naming when there is more than one in
|
|
246
265
|
// play; repeating it down a single-workspace list is noise.
|
|
247
|
-
|
|
266
|
+
// The activity date is why this list is ordered the way it is, and it
|
|
267
|
+
// was previously only in the structured payload — so an agent reading the
|
|
268
|
+
// prose could not tell a busy project from a dormant one, and one reading
|
|
269
|
+
// the raw field got `updatedAt`, which meant "renamed recently".
|
|
270
|
+
const when = p.lastActivityAt ? ` · ${ago(p.lastActivityAt)}` : "";
|
|
271
|
+
lines.push(` ${p.name}${spans ? ` (${p.workspace.name})` : ""}${when}`);
|
|
248
272
|
lines.push(` ${p.id}${p.repo ? ` — ${p.repo}` : ""}`);
|
|
249
273
|
}
|
|
250
274
|
lines.push("");
|