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 { PluginReporter } from "../plugin";
 8import { CallRes } from "./call";
 9import { Commit } from "./commit";
10import { Exec, ExecStatus } from "./exec";
11import { ForgeConf } from "./forgeconf";
12
13export type exportFuncCallback = (
14  args: Map<string, string>,
15) => Map<string, string>;
16
17export interface Server {
18  addPluginOption(option: PluginReporter): void;
19  forgeConf(): ForgeConf;
20  worktree(): FS;
21  webcontent(): FS;
22  cache(): FS;
23  commitAllIfNeeded(message: string): void;
24  diffWithParent(
25    hash: string,
26    oldFilepath: string,
27    newFilepath: string,
28  ): string;
29  log(message: string): void;
30  logError(message: string, err: string): void;
31  merge(from: string, to: string): void;
32  commits(from: string, to: string): Array<Commit>;
33  exec(exec: Exec): ExecStatus;
34  report(level: string, content: Array<string>): void;
35  canCallFunc(plugin: string, name: string, args: Map<string, string>): bool;
36  exportFunc(name: string, callback: exportFuncCallback): void;
37  callFunc(plugin: string, name: string, args: Map<string, string>): CallRes;
38  httpClient(header: Map<string, Array<string>>): HttpClient;
39}