feat: add skill manager interface

This commit is contained in:
2026-05-13 16:50:09 +08:00
parent 12a6a83840
commit a0f2860a57
10 changed files with 1408 additions and 98 deletions

View File

@@ -1,4 +1,29 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import {domain} from '../models';
export function Greet(arg1: string): Promise<string>;
export function DeleteSkill(arg1:string,arg2:string):Promise<void>;
export function DownloadSkill(arg1:domain.RemoteSkill):Promise<domain.SkillState>;
export function InstallSkill(arg1:string,arg2:string,arg3:string):Promise<domain.SkillState>;
export function ListLocalSkills():Promise<Array<domain.SkillState>>;
export function ListRemoteSkills():Promise<Array<domain.RemoteSkill>>;
export function LoadConfig():Promise<domain.Config>;
export function OpenFolder(arg1:string,arg2:string):Promise<void>;
export function OpenInVSCode(arg1:string,arg2:string):Promise<void>;
export function RunAutoUpdate():Promise<void>;
export function SaveConfig(arg1:domain.SaveConfigRequest):Promise<void>;
export function TestConnection(arg1:domain.SaveConfigRequest):Promise<domain.TestConnectionResult>;
export function UninstallSkill(arg1:string,arg2:string,arg3:string):Promise<domain.SkillState>;
export function UpdateSkill(arg1:string,arg2:string):Promise<domain.SkillState>;

View File

@@ -2,6 +2,54 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function Greet(arg1) {
return window['go']['main']['App']['Greet'](arg1);
export function DeleteSkill(arg1, arg2) {
return window['go']['main']['App']['DeleteSkill'](arg1, arg2);
}
export function DownloadSkill(arg1) {
return window['go']['main']['App']['DownloadSkill'](arg1);
}
export function InstallSkill(arg1, arg2, arg3) {
return window['go']['main']['App']['InstallSkill'](arg1, arg2, arg3);
}
export function ListLocalSkills() {
return window['go']['main']['App']['ListLocalSkills']();
}
export function ListRemoteSkills() {
return window['go']['main']['App']['ListRemoteSkills']();
}
export function LoadConfig() {
return window['go']['main']['App']['LoadConfig']();
}
export function OpenFolder(arg1, arg2) {
return window['go']['main']['App']['OpenFolder'](arg1, arg2);
}
export function OpenInVSCode(arg1, arg2) {
return window['go']['main']['App']['OpenInVSCode'](arg1, arg2);
}
export function RunAutoUpdate() {
return window['go']['main']['App']['RunAutoUpdate']();
}
export function SaveConfig(arg1) {
return window['go']['main']['App']['SaveConfig'](arg1);
}
export function TestConnection(arg1) {
return window['go']['main']['App']['TestConnection'](arg1);
}
export function UninstallSkill(arg1, arg2, arg3) {
return window['go']['main']['App']['UninstallSkill'](arg1, arg2, arg3);
}
export function UpdateSkill(arg1, arg2) {
return window['go']['main']['App']['UpdateSkill'](arg1, arg2);
}

View File

@@ -0,0 +1,218 @@
export namespace domain {
export class UpdateConfig {
autoUpdate: boolean;
checkOnStartup: boolean;
intervalMinutes: number;
static createFrom(source: any = {}) {
return new UpdateConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.autoUpdate = source["autoUpdate"];
this.checkOnStartup = source["checkOnStartup"];
this.intervalMinutes = source["intervalMinutes"];
}
}
export class GiteaConfig {
baseURL: string;
org: string;
authType: string;
username: string;
credentialKey: string;
static createFrom(source: any = {}) {
return new GiteaConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.baseURL = source["baseURL"];
this.org = source["org"];
this.authType = source["authType"];
this.username = source["username"];
this.credentialKey = source["credentialKey"];
}
}
export class Config {
gitea: GiteaConfig;
update: UpdateConfig;
static createFrom(source: any = {}) {
return new Config(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.gitea = this.convertValues(source["gitea"], GiteaConfig);
this.update = this.convertValues(source["update"], UpdateConfig);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class InstalledTarget {
path: string;
linkType: string;
targetPath: string;
static createFrom(source: any = {}) {
return new InstalledTarget(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.linkType = source["linkType"];
this.targetPath = source["targetPath"];
}
}
export class RemoteSkill {
name: string;
fullName: string;
description: string;
cloneURL: string;
sshURL: string;
defaultBranch: string;
updatedAt: string;
isDownloaded: boolean;
status: string;
error: string;
static createFrom(source: any = {}) {
return new RemoteSkill(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.fullName = source["fullName"];
this.description = source["description"];
this.cloneURL = source["cloneURL"];
this.sshURL = source["sshURL"];
this.defaultBranch = source["defaultBranch"];
this.updatedAt = source["updatedAt"];
this.isDownloaded = source["isDownloaded"];
this.status = source["status"];
this.error = source["error"];
}
}
export class SaveConfigRequest {
config: Config;
password: string;
token: string;
static createFrom(source: any = {}) {
return new SaveConfigRequest(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], Config);
this.password = source["password"];
this.token = source["token"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class SkillState {
org: string;
repo: string;
localPath: string;
remoteURL: string;
defaultBranch: string;
currentCommit: string;
lastCheckedAt: string;
lastError: string;
installedTargets: Record<string, InstalledTarget>;
static createFrom(source: any = {}) {
return new SkillState(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.org = source["org"];
this.repo = source["repo"];
this.localPath = source["localPath"];
this.remoteURL = source["remoteURL"];
this.defaultBranch = source["defaultBranch"];
this.currentCommit = source["currentCommit"];
this.lastCheckedAt = source["lastCheckedAt"];
this.lastError = source["lastError"];
this.installedTargets = this.convertValues(source["installedTargets"], InstalledTarget, true);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class TestConnectionResult {
ok: boolean;
message: string;
username: string;
org: string;
static createFrom(source: any = {}) {
return new TestConnectionResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.ok = source["ok"];
this.message = source["message"];
this.username = source["username"];
this.org = source["org"];
}
}
}