Improve plugin settings

This commit is contained in:
Alex Gleason committed 2025-11-06 00:06:50 -06:00
1 parent 3af97e461d
commit 01063423f6
4 files changed
+210 -116

No files matched your search

+37
View File
@@ -1,6 +1,7 @@
import { join } from 'path-browserify';
import matter from 'gray-matter';
import type { JSRuntimeFS } from './JSRuntime';
import * as git from 'isomorphic-git';
export interface Skill {
/** Skill name (alphanumeric lowercase only) */
@@ -19,6 +20,12 @@ export interface SkillFrontmatter {
[key: string]: unknown;
}
export interface PluginGitInfo {
commitHash: string;
commitDate: Date;
commitMessage: string;
}
/**
* Validates a skill name (alphanumeric lowercase with hyphens)
*/
@@ -142,6 +149,36 @@ export async function readSkillContent(fs: JSRuntimeFS, skill: Skill): Promise<s
return await fs.readFile(skillFilePath, 'utf8');
}
/**
* Get git information for a plugin
*/
export async function getPluginGitInfo(fs: JSRuntimeFS, pluginsPath: string, pluginName: string): Promise<PluginGitInfo | null> {
const pluginPath = join(pluginsPath, pluginName);
try {
// Get the latest commit
const commits = await git.log({
fs,
dir: pluginPath,
depth: 1,
});
if (commits.length === 0) {
return null;
}
const commit = commits[0];
return {
commitHash: commit.oid,
commitDate: new Date(commit.commit.committer.timestamp * 1000),
commitMessage: commit.commit.message,
};
} catch {
return null;
}
}
/**
* Delete a plugin directory
*/