GitRoot
Craft your forge, Build your project, Grow your community freely
1// SPDX-FileCopyrightText: 2025 Romain Maneschi <romain@gitroot.dev>
2//
3// SPDX-License-Identifier: MIT
4
5import { FS } from "../fs";
6import { HttpClient } from "../httpclient";
7import { CallRes } from "./call";
8import { Commit } from "./commit";
9import { Exec, ExecStatus } from "./exec";
10import { ForgeConf } from "./forgeconf";
11
12export type exportFuncCallback = (
13 args: Map<string, string>,
14) => Map<string, string>;
15
16export interface Server {
17 forgeConf(): ForgeConf;
18 worktree(): FS;
19 webcontent(): FS;
20 cache(): FS;
21 commitAllIfNeeded(message: string): void;
22 diffWithParent(
23 hash: string,
24 oldFilepath: string,
25 newFilepath: string,
26 ): string;
27 log(message: string): void;
28 logError(message: string, err: string): void;
29 merge(from: string, to: string): void;
30 commits(from: string, to: string): Array<Commit>;
31 exec(exec: Exec): ExecStatus;
32 report(level: string, content: Array<string>): void;
33 canCallFunc(plugin: string, name: string, args: Map<string, string>): bool;
34 exportFunc(name: string, callback: exportFuncCallback): void;
35 callFunc(plugin: string, name: string, args: Map<string, string>): CallRes;
36 httpClient(header: Map<string, Array<string>>): HttpClient;
37}