@devness/useai 0.4.11 → 0.4.13

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 +13 -13
  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.11";
115
+ VERSION = "0.4.13";
116
116
  }
117
117
  });
118
118
 
@@ -950,17 +950,11 @@ process.stdin.on('end', () => {
950
950
  var starts = (transcript.match(/useai_session_start/g) || []).length;
951
951
  if (starts === 0) process.exit(0);
952
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
- }
953
+ if (ends >= starts) process.exit(0);
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
+ }));
964
958
  } catch { process.exit(0); }
965
959
  });
966
960
  `;
@@ -1493,11 +1487,17 @@ function injectInstructions(config) {
1493
1487
  writeFileSync4(config.path, USEAI_INSTRUCTIONS + "\n");
1494
1488
  return;
1495
1489
  }
1496
- if (hasInstructionsBlock(config.path)) return;
1497
1490
  let existing = "";
1498
1491
  if (existsSync8(config.path)) {
1499
1492
  existing = readFileSync4(config.path, "utf-8");
1500
1493
  }
1494
+ if (hasInstructionsBlock(config.path)) {
1495
+ const pattern = new RegExp(
1496
+ `${INSTRUCTIONS_START}[\\s\\S]*?${INSTRUCTIONS_END}`
1497
+ );
1498
+ writeFileSync4(config.path, existing.replace(pattern, USEAI_INSTRUCTIONS_BLOCK));
1499
+ return;
1500
+ }
1501
1501
  const separator = existing && !existing.endsWith("\n") ? "\n\n" : existing ? "\n" : "";
1502
1502
  writeFileSync4(config.path, existing + separator + USEAI_INSTRUCTIONS_BLOCK + "\n");
1503
1503
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devness/useai",
3
- "version": "0.4.11",
3
+ "version": "0.4.13",
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",