@triedotdev/mcp 1.0.68 → 1.0.70

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/dist/cli/main.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  } from "../chunk-3AKE4M4Z.js";
28
28
  import {
29
29
  getGuardianState
30
- } from "../chunk-O7WFJC2P.js";
30
+ } from "../chunk-COXK23KW.js";
31
31
  import {
32
32
  initProjectInfo,
33
33
  installSkill,
@@ -1314,7 +1314,7 @@ async function listGoals(guardianState) {
1314
1314
  if (active.length > 0) {
1315
1315
  console.error(pc3.cyan("Active:"));
1316
1316
  for (const goal of active) {
1317
- const progress = goal.target > 0 ? Math.round(goal.currentValue / goal.target * 100) : 0;
1317
+ const progress = calculateGoalProgress(goal);
1318
1318
  const bar = renderProgressBar(progress);
1319
1319
  const source = goal.autoGenerated ? pc3.dim("[auto]") : pc3.dim("[manual]");
1320
1320
  console.error(` ${bar} ${goal.description} ${source}`);
@@ -1373,9 +1373,20 @@ async function deleteGoal(guardianState, goalId) {
1373
1373
  await guardianState.updateGoal(goal.id, { status: "rejected" });
1374
1374
  console.error(pc3.dim(`Removed goal: ${goal.description}`));
1375
1375
  }
1376
+ function calculateGoalProgress(goal) {
1377
+ if (goal.target <= 0) return 0;
1378
+ const startValue = goal.startValue ?? goal.currentValue;
1379
+ if (startValue > goal.target) {
1380
+ const totalReduction = startValue - goal.target;
1381
+ const actualReduction = startValue - goal.currentValue;
1382
+ return Math.round(actualReduction / totalReduction * 100);
1383
+ }
1384
+ return Math.round(goal.currentValue / goal.target * 100);
1385
+ }
1376
1386
  function renderProgressBar(percent) {
1377
1387
  const width = 10;
1378
- const filled = Math.round(percent / 100 * width);
1388
+ const clamped = Math.max(0, Math.min(100, percent));
1389
+ const filled = Math.round(clamped / 100 * width);
1379
1390
  const empty = width - filled;
1380
1391
  return `[${pc3.green("\u2588".repeat(filled))}${pc3.dim("\u2591".repeat(empty))}]`;
1381
1392
  }