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