Skip to content

An agentic skills framework & software development methodology that works.

feat: add git update checking to core module

Jesse Vincenta23eead91892
diff --git a/lib/skills-core.js b/lib/skills-core.js
index b9ebd5f3a..ce9c0ef57 100644
--- a/lib/skills-core.js
+++ b/lib/skills-core.js
@@ -1,5 +1,6 @@
const fs = require('fs');
const path = require('path');
+const { execSync } = require('child_process');
/**
* Extract YAML frontmatter from a skill file.
@@ -138,8 +139,39 @@ function resolveSkillPath(skillName, superpowersDir, personalDir) {
return null;
}
+/**
+ * Check if a git repository has updates available.
+ *
+ * @param {string} repoDir - Path to git repository
+ * @returns {boolean} - True if updates are available
+ */
+function checkForUpdates(repoDir) {
+ try {
+ // Quick check with 3 second timeout to avoid delays if network is down
+ const output = execSync('git fetch origin && git status --porcelain=v1 --branch', {
+ cwd: repoDir,
+ timeout: 3000,
+ encoding: 'utf8',
+ stdio: 'pipe'
+ });
+
+ // Parse git status output to see if we're behind
+ const statusLines = output.split('\n');
+ for (const line of statusLines) {
+ if (line.startsWith('## ') && line.includes('[behind ')) {
+ return true; // We're behind remote
+ }
+ }
+ return false; // Up to date
+ } catch (error) {
+ // Network down, git error, timeout, etc. - don't block bootstrap
+ return false;
+ }
+}
+
module.exports = {
extractFrontmatter,
findSkillsInDir,
- resolveSkillPath
+ resolveSkillPath,
+ checkForUpdates
};