@triedotdev/mcp 1.0.116 → 1.0.118

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.
@@ -472,6 +472,20 @@ async function getUncommittedChanges(projectPath) {
472
472
  }
473
473
  return changes;
474
474
  }
475
+ async function getGitChangedFiles(projectPath) {
476
+ const isRepo = await ensureRepo(projectPath);
477
+ if (!isRepo) return null;
478
+ const [staged, uncommitted] = await Promise.all([
479
+ getStagedChanges(projectPath).catch(() => []),
480
+ getUncommittedChanges(projectPath).catch(() => [])
481
+ ]);
482
+ const paths = /* @__PURE__ */ new Set();
483
+ for (const change of [...staged, ...uncommitted]) {
484
+ if (change.path) paths.add(change.path);
485
+ if (change.oldPath) paths.add(change.oldPath);
486
+ }
487
+ return [...paths];
488
+ }
475
489
  async function getDiff(projectPath, commitHash) {
476
490
  const isRepo = await ensureRepo(projectPath);
477
491
  if (!isRepo) return "";
@@ -485,6 +499,56 @@ async function getWorkingTreeDiff(projectPath, stagedOnly = false) {
485
499
  const diff = await execGit(args, projectPath);
486
500
  return diff ?? "";
487
501
  }
502
+ async function isGitRepo(projectPath) {
503
+ const result = await execGit(["rev-parse", "--is-inside-work-tree"], projectPath);
504
+ return result === "true";
505
+ }
506
+ async function getChangedFilesSinceTimestamp(projectPath, timestamp) {
507
+ const isRepo = await isGitRepo(projectPath);
508
+ if (!isRepo) return null;
509
+ try {
510
+ const sinceDate = new Date(timestamp).toISOString();
511
+ const GIT_TIMEOUT_MS = 5e3;
512
+ const startTime = Date.now();
513
+ const committedChangesPromise = execGit(
514
+ ["log", `--since=${sinceDate}`, "--name-only", "--pretty=format:"],
515
+ projectPath
516
+ );
517
+ const committedChangesTimeout = new Promise((resolve) => {
518
+ setTimeout(() => resolve(null), GIT_TIMEOUT_MS);
519
+ });
520
+ const committedChanges = await Promise.race([committedChangesPromise, committedChangesTimeout]);
521
+ if (Date.now() - startTime > GIT_TIMEOUT_MS) {
522
+ return null;
523
+ }
524
+ const stagedPromise = execGit(["diff", "--cached", "--name-only"], projectPath);
525
+ const unstagedPromise = execGit(["diff", "--name-only"], projectPath);
526
+ const untrackedPromise = execGit(
527
+ ["ls-files", "--others", "--exclude-standard"],
528
+ projectPath
529
+ );
530
+ const timeoutPromise = new Promise((resolve) => {
531
+ setTimeout(() => resolve(null), Math.max(0, GIT_TIMEOUT_MS - (Date.now() - startTime)));
532
+ });
533
+ const [stagedChanges, unstagedChanges, untrackedFiles] = await Promise.race([
534
+ Promise.all([stagedPromise, unstagedPromise, untrackedPromise]),
535
+ timeoutPromise.then(() => [null, null, null])
536
+ ]);
537
+ const changedFiles = /* @__PURE__ */ new Set();
538
+ const addFiles = (output) => {
539
+ if (output) {
540
+ output.split("\n").map((f) => f.trim()).filter(Boolean).forEach((f) => changedFiles.add(path2.join(projectPath, f)));
541
+ }
542
+ };
543
+ addFiles(committedChanges);
544
+ addFiles(stagedChanges);
545
+ addFiles(unstagedChanges);
546
+ addFiles(untrackedFiles);
547
+ return Array.from(changedFiles);
548
+ } catch {
549
+ return null;
550
+ }
551
+ }
488
552
 
489
553
  // src/agent/confidence.ts
490
554
  function adjustConfidence(current, outcome, step = 0.1) {
@@ -1681,6 +1745,8 @@ export {
1681
1745
  runShellCommandSync,
1682
1746
  getStagedChanges,
1683
1747
  getUncommittedChanges,
1748
+ getGitChangedFiles,
1749
+ getChangedFilesSinceTimestamp,
1684
1750
  LearningEngine,
1685
1751
  perceiveCurrentChanges,
1686
1752
  reasonAboutChangesHumanReadable,
@@ -1690,4 +1756,4 @@ export {
1690
1756
  handleCheckpointCommand,
1691
1757
  isTrieInitialized
1692
1758
  };
1693
- //# sourceMappingURL=chunk-SRQ4DNOP.js.map
1759
+ //# sourceMappingURL=chunk-PPZYVTUO.js.map