feat: HTTP server for exporting Arborix bundles

Introduces a read-only HTTP server (WAI/Warp) backed by the content
store, exposing three bundle-export endpoints:

- GET /bundle/name/:name   — export by stored term name
- GET /bundle/hash/:hash   — export by full Merkle hash
- GET /terms               — plain-text listing (debug)

Also adds `tricu server` (aka `--serve`) CLI mode, move `resolveExportTarget` /
 `namesForHash` / `looksLikeHash` out of `Main.hs` into `ContentStore.hs`,
and cleans up unused exports and imports across `FileEval.hs` and `Wire.hs`.
This commit is contained in:
2026-05-06 14:09:56 -05:00
parent 0cd849447f
commit a36ff638a9
9 changed files with 279 additions and 60 deletions

View File

@@ -3,7 +3,6 @@ module FileEval
, evaluateFile
, evaluateFileWithContext
, evaluateFileResult
, evaluateFile
, compileFile
) where
@@ -19,9 +18,8 @@ import Data.List (partition)
import Data.Maybe (fromMaybe, mapMaybe)
import System.Environment (setEnv)
import System.FilePath (takeDirectory, normalise, (</>))
import System.IO (hPutStrLn, stderr)
import System.Exit (die)
import Database.SQLite.Simple (Connection, close)
import Database.SQLite.Simple (close)
import qualified Data.ByteString.Lazy as BL
import qualified Data.Map as Map
@@ -110,9 +108,6 @@ makeRelativeTo f i =
let d = takeDirectory f
in normalise $ d </> i
nsDefinitions :: String -> [TricuAST] -> [TricuAST]
nsDefinitions moduleName = map (nsDefinition moduleName)
nsDefinition :: String -> TricuAST -> TricuAST
nsDefinition "" def = def
nsDefinition moduleName (SDef name args body)