@devness/useai 0.4.9 → 0.4.11

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -15
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -112,7 +112,7 @@ var VERSION;
112
112
  var init_version = __esm({
113
113
  "../shared/dist/constants/version.js"() {
114
114
  "use strict";
115
- VERSION = "0.4.9";
115
+ VERSION = "0.4.11";
116
116
  }
117
117
  });
118
118
 
@@ -947,12 +947,20 @@ process.stdin.on('end', () => {
947
947
  if (!hook.transcript_path) process.exit(0);
948
948
  let transcript;
949
949
  try { transcript = readFileSync(hook.transcript_path, 'utf-8'); } catch { process.exit(0); }
950
- if (!transcript.includes('useai_session_start')) process.exit(0);
951
- if (transcript.includes('useai_session_end')) process.exit(0);
952
- process.stdout.write(JSON.stringify({
953
- decision: 'block',
954
- reason: 'Before ending, call useai_session_end with milestones (generic descriptions of accomplishments), languages used, and files_touched_count.'
955
- }));
950
+ var starts = (transcript.match(/useai_session_start/g) || []).length;
951
+ if (starts === 0) process.exit(0);
952
+ var ends = (transcript.match(/useai_session_end/g) || []).length;
953
+ if (starts > ends) {
954
+ process.stdout.write(JSON.stringify({
955
+ decision: 'block',
956
+ reason: 'Before ending, call useai_session_end with milestones (generic descriptions of accomplishments), languages used, and files_touched_count.'
957
+ }));
958
+ } else {
959
+ process.stdout.write(JSON.stringify({
960
+ decision: 'block',
961
+ reason: 'You did work without UseAI tracking. Call useai_session_start first, then useai_session_end with milestones (generic descriptions of accomplishments), languages used, and files_touched_count.'
962
+ }));
963
+ }
956
964
  } catch { process.exit(0); }
957
965
  });
958
966
  `;
@@ -1093,7 +1101,7 @@ function resolveClient(server2, session2) {
1093
1101
  function registerTools(server2, session2) {
1094
1102
  server2.tool(
1095
1103
  "useai_session_start",
1096
- "Start tracking an AI coding session. Call this at the beginning of a conversation.",
1104
+ "Start tracking an AI coding session. Call this at the beginning of every response.",
1097
1105
  {
1098
1106
  task_type: z2.enum(["coding", "debugging", "testing", "planning", "reviewing", "documenting", "learning", "other"]).optional().describe("What kind of task is the developer working on?")
1099
1107
  },
@@ -1579,10 +1587,9 @@ var init_tools = __esm({
1579
1587
  init_dist();
1580
1588
  USEAI_INSTRUCTIONS_TEXT = [
1581
1589
  "## UseAI Session Tracking",
1582
- "- At the START of every conversation, call `useai_session_start` with the appropriate task_type.",
1590
+ "- At the START of every response, call `useai_session_start` with the appropriate task_type.",
1583
1591
  "- For LONG sessions (15+ min), call `useai_heartbeat` periodically.",
1584
- "- At the END of every conversation, call `useai_session_end` with languages used, files_touched_count, and milestones.",
1585
- '- MILESTONES PRIVACY: Milestone titles must be COMPLETELY GENERIC. NEVER mention project names, repository names, product names, file names, file paths, class names, or company names. Write as if describing the work to a stranger who knows nothing about the codebase. GOOD: "Fixed race condition in background worker". BAD: "Fixed bug in ProjectX worker service".'
1592
+ "- At the END of every response, call `useai_session_end` with languages used, files_touched_count, and milestones (generic descriptions only \u2014 no project names, file paths, or company names)."
1586
1593
  ].join("\n");
1587
1594
  MCP_ENTRY = {
1588
1595
  command: "npx",
@@ -1595,10 +1602,9 @@ var init_tools = __esm({
1595
1602
  INSTRUCTIONS_END = "<!-- useai:end -->";
1596
1603
  USEAI_INSTRUCTIONS = [
1597
1604
  "## UseAI Session Tracking",
1598
- "- At the START of every conversation, call `useai_session_start` with the appropriate task_type.",
1605
+ "- At the START of every response, call `useai_session_start` with the appropriate task_type.",
1599
1606
  "- For LONG sessions (15+ min), call `useai_heartbeat` periodically.",
1600
- "- At the END of every conversation, call `useai_session_end` with languages used, files_touched_count, and milestones.",
1601
- '- MILESTONES PRIVACY: Milestone titles must be COMPLETELY GENERIC. NEVER mention project names, repository names, product names, file names, file paths, class names, or company names. Write as if describing the work to a stranger who knows nothing about the codebase. GOOD: "Fixed race condition in background worker". BAD: "Fixed bug in ProjectX worker service".'
1607
+ "- At the END of every response, call `useai_session_end` with languages used, files_touched_count, and milestones (generic descriptions only \u2014 no project names, file paths, or company names)."
1602
1608
  ].join("\n");
1603
1609
  USEAI_INSTRUCTIONS_BLOCK = `${INSTRUCTIONS_START}
1604
1610
  ${USEAI_INSTRUCTIONS}
@@ -2554,7 +2560,15 @@ function getDashboardHtml() {
2554
2560
  section.style.display = 'block';
2555
2561
  var recent = milestones.slice(-20).reverse();
2556
2562
  list.innerHTML = recent.map(function(m) {
2557
- var date = m.created_at ? m.created_at.slice(0, 10) : '';
2563
+ var date = '';
2564
+ if (m.created_at) {
2565
+ var d = new Date(m.created_at);
2566
+ if (!isNaN(d.getTime())) {
2567
+ date = d.getFullYear() + '-' + String(d.getMonth()+1).padStart(2,'0') + '-' + String(d.getDate()).padStart(2,'0') + ' ' + String(d.getHours()).padStart(2,'0') + ':' + String(d.getMinutes()).padStart(2,'0');
2568
+ } else {
2569
+ date = m.created_at.slice(0, 10);
2570
+ }
2571
+ }
2558
2572
  var dur = fmtDuration(m.duration_minutes);
2559
2573
  return '<div class="milestone-item">' +
2560
2574
  '<div class="milestone-title">' + escapeHtml(m.title) + '</div>' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devness/useai",
3
- "version": "0.4.9",
3
+ "version": "0.4.11",
4
4
  "description": "Track your AI-assisted development workflow. MCP server that records usage metrics across all your AI tools.",
5
5
  "keywords": [
6
6
  "mcp",