完成基本功能

This commit is contained in:
zyj
2026-03-09 16:46:15 +08:00
parent d8851e7698
commit f55dd8ca03
57 changed files with 16098 additions and 6 deletions

View File

@@ -0,0 +1,387 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
/**
* AppService 应用服务,暴露给前端调用
* @module
*/
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise, Create as $Create } from "@wailsio/runtime";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as application$0 from "../../../../wailsapp/wails/v3/pkg/application/models.js";
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";
/**
* AddPlatform 添加新平台
* @param {string} name
* @param {string} baseURL
* @returns {$CancellablePromise<void>}
*/
export function AddPlatform(name, baseURL) {
return $Call.ByID(526003212, name, baseURL);
}
/**
* AddProject 添加项目到指定平台/用户下
* @param {string} platform
* @param {string} username
* @param {string} name
* @param {string} path
* @returns {$CancellablePromise<void>}
*/
export function AddProject(platform, username, name, path) {
return $Call.ByID(2299402672, platform, username, name, path);
}
/**
* AddUser 添加用户到指定平台
* @param {string} platform
* @param {string} username
* @param {string} token
* @returns {$CancellablePromise<void>}
*/
export function AddUser(platform, username, token) {
return $Call.ByID(2264426704, platform, username, token);
}
/**
* CommitChanges 提交已暂存的更改
* @param {string} path
* @param {string} message
* @returns {$CancellablePromise<void>}
*/
export function CommitChanges(path, message) {
return $Call.ByID(921984546, path, message);
}
/**
* DiscardFiles 丢弃工作区指定文件的更改
* @param {string} path
* @param {string[]} files
* @returns {$CancellablePromise<void>}
*/
export function DiscardFiles(path, files) {
return $Call.ByID(382904301, path, files);
}
/**
* FetchProject 拉取远程信息
* @param {string} path
* @returns {$CancellablePromise<string>}
*/
export function FetchProject(path) {
return $Call.ByID(3541106829, path);
}
/**
* GetBranches 获取所有本地分支
* @param {string} path
* @returns {$CancellablePromise<$models.BranchInfo[]>}
*/
export function GetBranches(path) {
return $Call.ByID(1686190192, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType1($result);
}));
}
/**
* GetCommitDiff 获取指定提交的 diff
* @param {string} path
* @param {string} hash
* @returns {$CancellablePromise<string>}
*/
export function GetCommitDiff(path, hash) {
return $Call.ByID(3678609798, path, hash);
}
/**
* GetCommitFileDiff 获取指定提交中某个文件的 diff
* @param {string} path
* @param {string} hash
* @param {string} filePath
* @returns {$CancellablePromise<string>}
*/
export function GetCommitFileDiff(path, hash, filePath) {
return $Call.ByID(880053428, path, hash, filePath);
}
/**
* GetCommitFiles 获取指定提交中变更的文件列表
* @param {string} path
* @param {string} hash
* @returns {$CancellablePromise<$models.CommitFileInfo[]>}
*/
export function GetCommitFiles(path, hash) {
return $Call.ByID(2420707876, path, hash).then(/** @type {($result: any) => any} */(($result) => {
return $$createType3($result);
}));
}
/**
* GetCommitLog 获取提交历史
* @param {string} path
* @param {number} count
* @returns {$CancellablePromise<$models.CommitLog[]>}
*/
export function GetCommitLog(path, count) {
return $Call.ByID(1281870789, path, count).then(/** @type {($result: any) => any} */(($result) => {
return $$createType5($result);
}));
}
/**
* GetFileContent 获取文件内容
* @param {string} projectPath
* @param {string} filePath
* @returns {$CancellablePromise<string>}
*/
export function GetFileContent(projectPath, filePath) {
return $Call.ByID(3085630035, projectPath, filePath);
}
/**
* GetFileDiff 获取文件 diff
* @param {string} projectPath
* @param {string} filePath
* @returns {$CancellablePromise<string>}
*/
export function GetFileDiff(projectPath, filePath) {
return $Call.ByID(1694304929, projectPath, filePath);
}
/**
* GetFileDiffStaged 获取已暂存文件的 diff
* @param {string} projectPath
* @param {string} filePath
* @returns {$CancellablePromise<string>}
*/
export function GetFileDiffStaged(projectPath, filePath) {
return $Call.ByID(2773256455, projectPath, filePath);
}
/**
* GetPlatformInfo 获取平台信息
* @param {string} name
* @returns {$CancellablePromise<$models.PlatformInfo | null>}
*/
export function GetPlatformInfo(name) {
return $Call.ByID(2668095547, name).then(/** @type {($result: any) => any} */(($result) => {
return $$createType7($result);
}));
}
/**
* GetProjectChangedFiles 获取项目变更文件列表(可能较慢)
* @param {string} path
* @returns {$CancellablePromise<$models.FileInfo[]>}
*/
export function GetProjectChangedFiles(path) {
return $Call.ByID(2302591462, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType9($result);
}));
}
/**
* GetProjectStatus 获取项目 git 状态
* @param {string} path
* @returns {$CancellablePromise<$models.ProjectStatus | null>}
*/
export function GetProjectStatus(path) {
return $Call.ByID(3451089027, path).then(/** @type {($result: any) => any} */(($result) => {
return $$createType11($result);
}));
}
/**
* GetProjectTree 获取项目树,供前端侧边栏渲染
* @returns {$CancellablePromise<$models.TreeNode[]>}
*/
export function GetProjectTree() {
return $Call.ByID(651189689).then(/** @type {($result: any) => any} */(($result) => {
return $$createType13($result);
}));
}
/**
* GetUserInfo 获取用户信息
* @param {string} platform
* @param {string} username
* @returns {$CancellablePromise<$models.UserInfo | null>}
*/
export function GetUserInfo(platform, username) {
return $Call.ByID(2674655707, platform, username).then(/** @type {($result: any) => any} */(($result) => {
return $$createType15($result);
}));
}
/**
* PullProject 拉取项目(当前分支)
* @param {string} path
* @returns {$CancellablePromise<string>}
*/
export function PullProject(path) {
return $Call.ByID(4145813996, path);
}
/**
* PushProject 推送项目(当前分支)
* @param {string} path
* @returns {$CancellablePromise<string>}
*/
export function PushProject(path) {
return $Call.ByID(3887901113, path);
}
/**
* RemovePlatform 删除平台
* @param {string} name
* @returns {$CancellablePromise<void>}
*/
export function RemovePlatform(name) {
return $Call.ByID(2222448051, name);
}
/**
* RemoveProject 从指定平台/用户下删除项目
* @param {string} platform
* @param {string} username
* @param {string} name
* @returns {$CancellablePromise<void>}
*/
export function RemoveProject(platform, username, name) {
return $Call.ByID(2748109581, platform, username, name);
}
/**
* RemoveUser 从平台删除用户
* @param {string} platform
* @param {string} username
* @returns {$CancellablePromise<void>}
*/
export function RemoveUser(platform, username) {
return $Call.ByID(1409517275, platform, username);
}
/**
* ResetProject 版本回滚git reset
* mode: "hard"(丢弃所有更改), "soft"(保留更改到暂存区), "mixed"(保留更改到工作区)
* @param {string} path
* @param {string} hash
* @param {string} mode
* @returns {$CancellablePromise<void>}
*/
export function ResetProject(path, hash, mode) {
return $Call.ByID(2061148684, path, hash, mode);
}
/**
* SelectDirectory 打开系统文件夹选择器,返回选中的路径
* @returns {$CancellablePromise<string>}
*/
export function SelectDirectory() {
return $Call.ByID(2318416763);
}
/**
* @param {application$0.App | null} app
* @returns {$CancellablePromise<void>}
*/
export function SetApplication(app) {
return $Call.ByID(383695022, app);
}
/**
* StageAll 暂存所有变更文件
* @param {string} path
* @returns {$CancellablePromise<void>}
*/
export function StageAll(path) {
return $Call.ByID(2344562461, path);
}
/**
* StageFiles 暂存指定文件
* @param {string} path
* @param {string[]} files
* @returns {$CancellablePromise<void>}
*/
export function StageFiles(path, files) {
return $Call.ByID(4064506881, path, files);
}
/**
* SwitchBranch 切换分支
* @param {string} path
* @param {string} branch
* @returns {$CancellablePromise<void>}
*/
export function SwitchBranch(path, branch) {
return $Call.ByID(4262224900, path, branch);
}
/**
* UnstageAll 取消暂存所有文件
* @param {string} path
* @returns {$CancellablePromise<void>}
*/
export function UnstageAll(path) {
return $Call.ByID(2417621882, path);
}
/**
* UnstageFiles 取消暂存指定文件
* @param {string} path
* @param {string[]} files
* @returns {$CancellablePromise<void>}
*/
export function UnstageFiles(path, files) {
return $Call.ByID(3546473046, path, files);
}
/**
* UpdatePlatform 修改平台信息base_url
* @param {string} name
* @param {string} baseURL
* @returns {$CancellablePromise<void>}
*/
export function UpdatePlatform(name, baseURL) {
return $Call.ByID(3258014550, name, baseURL);
}
/**
* UpdateUser 修改用户信息用户名、token
* @param {string} platform
* @param {string} oldUsername
* @param {string} newUsername
* @param {string} token
* @returns {$CancellablePromise<void>}
*/
export function UpdateUser(platform, oldUsername, newUsername, token) {
return $Call.ByID(1631729342, platform, oldUsername, newUsername, token);
}
// Private type creation functions
const $$createType0 = $models.BranchInfo.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = $models.CommitFileInfo.createFrom;
const $$createType3 = $Create.Array($$createType2);
const $$createType4 = $models.CommitLog.createFrom;
const $$createType5 = $Create.Array($$createType4);
const $$createType6 = $models.PlatformInfo.createFrom;
const $$createType7 = $Create.Nullable($$createType6);
const $$createType8 = $models.FileInfo.createFrom;
const $$createType9 = $Create.Array($$createType8);
const $$createType10 = $models.ProjectStatus.createFrom;
const $$createType11 = $Create.Nullable($$createType10);
const $$createType12 = $models.TreeNode.createFrom;
const $$createType13 = $Create.Array($$createType12);
const $$createType14 = $models.UserInfo.createFrom;
const $$createType15 = $Create.Nullable($$createType14);

View File

@@ -0,0 +1,19 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
import * as AppService from "./appservice.js";
export {
AppService
};
export {
BranchInfo,
CommitFileInfo,
CommitLog,
FileInfo,
PlatformInfo,
ProjectStatus,
TreeNode,
UserInfo
} from "./models.js";

View File

@@ -0,0 +1,396 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";
/**
* BranchInfo 分支信息
*/
export class BranchInfo {
/**
* Creates a new BranchInfo instance.
* @param {Partial<BranchInfo>} [$$source = {}] - The source object to create the BranchInfo.
*/
constructor($$source = {}) {
if (!("name" in $$source)) {
/**
* @member
* @type {string}
*/
this["name"] = "";
}
if (!("current" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["current"] = false;
}
Object.assign(this, $$source);
}
/**
* Creates a new BranchInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {BranchInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new BranchInfo(/** @type {Partial<BranchInfo>} */($$parsedSource));
}
}
/**
* CommitFileInfo 提交中的文件变更信息
*/
export class CommitFileInfo {
/**
* Creates a new CommitFileInfo instance.
* @param {Partial<CommitFileInfo>} [$$source = {}] - The source object to create the CommitFileInfo.
*/
constructor($$source = {}) {
if (!("status" in $$source)) {
/**
* @member
* @type {string}
*/
this["status"] = "";
}
if (!("filePath" in $$source)) {
/**
* @member
* @type {string}
*/
this["filePath"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new CommitFileInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {CommitFileInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new CommitFileInfo(/** @type {Partial<CommitFileInfo>} */($$parsedSource));
}
}
/**
* CommitLog 提交记录
*/
export class CommitLog {
/**
* Creates a new CommitLog instance.
* @param {Partial<CommitLog>} [$$source = {}] - The source object to create the CommitLog.
*/
constructor($$source = {}) {
if (!("hash" in $$source)) {
/**
* @member
* @type {string}
*/
this["hash"] = "";
}
if (!("shortHash" in $$source)) {
/**
* @member
* @type {string}
*/
this["shortHash"] = "";
}
if (!("author" in $$source)) {
/**
* @member
* @type {string}
*/
this["author"] = "";
}
if (!("email" in $$source)) {
/**
* @member
* @type {string}
*/
this["email"] = "";
}
if (!("timestamp" in $$source)) {
/**
* @member
* @type {number}
*/
this["timestamp"] = 0;
}
if (!("message" in $$source)) {
/**
* @member
* @type {string}
*/
this["message"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new CommitLog instance from a string or object.
* @param {any} [$$source = {}]
* @returns {CommitLog}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new CommitLog(/** @type {Partial<CommitLog>} */($$parsedSource));
}
}
/**
* FileInfo 文件信息
*/
export class FileInfo {
/**
* Creates a new FileInfo instance.
* @param {Partial<FileInfo>} [$$source = {}] - The source object to create the FileInfo.
*/
constructor($$source = {}) {
if (!("status" in $$source)) {
/**
* @member
* @type {string}
*/
this["status"] = "";
}
if (!("statusText" in $$source)) {
/**
* @member
* @type {string}
*/
this["statusText"] = "";
}
if (!("filePath" in $$source)) {
/**
* @member
* @type {string}
*/
this["filePath"] = "";
}
if (!("staged" in $$source)) {
/**
* @member
* @type {boolean}
*/
this["staged"] = false;
}
Object.assign(this, $$source);
}
/**
* Creates a new FileInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {FileInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new FileInfo(/** @type {Partial<FileInfo>} */($$parsedSource));
}
}
/**
* PlatformInfo 平台信息
*/
export class PlatformInfo {
/**
* Creates a new PlatformInfo instance.
* @param {Partial<PlatformInfo>} [$$source = {}] - The source object to create the PlatformInfo.
*/
constructor($$source = {}) {
if (!("name" in $$source)) {
/**
* @member
* @type {string}
*/
this["name"] = "";
}
if (!("baseUrl" in $$source)) {
/**
* @member
* @type {string}
*/
this["baseUrl"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new PlatformInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {PlatformInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new PlatformInfo(/** @type {Partial<PlatformInfo>} */($$parsedSource));
}
}
/**
* ProjectStatus 项目状态信息
*/
export class ProjectStatus {
/**
* Creates a new ProjectStatus instance.
* @param {Partial<ProjectStatus>} [$$source = {}] - The source object to create the ProjectStatus.
*/
constructor($$source = {}) {
if (!("branch" in $$source)) {
/**
* @member
* @type {string}
*/
this["branch"] = "";
}
if (!("remoteUrl" in $$source)) {
/**
* @member
* @type {string}
*/
this["remoteUrl"] = "";
}
if (!("changedFiles" in $$source)) {
/**
* @member
* @type {FileInfo[]}
*/
this["changedFiles"] = [];
}
Object.assign(this, $$source);
}
/**
* Creates a new ProjectStatus instance from a string or object.
* @param {any} [$$source = {}]
* @returns {ProjectStatus}
*/
static createFrom($$source = {}) {
const $$createField2_0 = $$createType1;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("changedFiles" in $$parsedSource) {
$$parsedSource["changedFiles"] = $$createField2_0($$parsedSource["changedFiles"]);
}
return new ProjectStatus(/** @type {Partial<ProjectStatus>} */($$parsedSource));
}
}
/**
* TreeNode 前端侧边栏树节点
*/
export class TreeNode {
/**
* Creates a new TreeNode instance.
* @param {Partial<TreeNode>} [$$source = {}] - The source object to create the TreeNode.
*/
constructor($$source = {}) {
if (!("key" in $$source)) {
/**
* @member
* @type {string}
*/
this["key"] = "";
}
if (!("label" in $$source)) {
/**
* @member
* @type {string}
*/
this["label"] = "";
}
if (!("type" in $$source)) {
/**
* platform, user, project
* @member
* @type {string}
*/
this["type"] = "";
}
if (/** @type {any} */(false)) {
/**
* @member
* @type {string | undefined}
*/
this["path"] = undefined;
}
if (/** @type {any} */(false)) {
/**
* @member
* @type {TreeNode[] | undefined}
*/
this["children"] = undefined;
}
Object.assign(this, $$source);
}
/**
* Creates a new TreeNode instance from a string or object.
* @param {any} [$$source = {}]
* @returns {TreeNode}
*/
static createFrom($$source = {}) {
const $$createField4_0 = $$createType3;
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
if ("children" in $$parsedSource) {
$$parsedSource["children"] = $$createField4_0($$parsedSource["children"]);
}
return new TreeNode(/** @type {Partial<TreeNode>} */($$parsedSource));
}
}
/**
* UserInfo 用户信息
*/
export class UserInfo {
/**
* Creates a new UserInfo instance.
* @param {Partial<UserInfo>} [$$source = {}] - The source object to create the UserInfo.
*/
constructor($$source = {}) {
if (!("username" in $$source)) {
/**
* @member
* @type {string}
*/
this["username"] = "";
}
if (!("token" in $$source)) {
/**
* @member
* @type {string}
*/
this["token"] = "";
}
Object.assign(this, $$source);
}
/**
* Creates a new UserInfo instance from a string or object.
* @param {any} [$$source = {}]
* @returns {UserInfo}
*/
static createFrom($$source = {}) {
let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
return new UserInfo(/** @type {Partial<UserInfo>} */($$parsedSource));
}
}
// Private type creation functions
const $$createType0 = FileInfo.createFrom;
const $$createType1 = $Create.Array($$createType0);
const $$createType2 = TreeNode.createFrom;
const $$createType3 = $Create.Array($$createType2);