<commit_before>package main

import (
	"github.com/bobziuchkovski/writ"
	"github.com/jkomoros/boardgame/boardgame-util/lib/build"
	"os"
	"os/exec"
)

type Serve struct {
	baseSubCommand
}

func (s *Serve) Run(p writ.Path, positional []string) {

	base := s.Base().(*BoardgameUtil)

	config := base.GetConfig()
	mode := config.Dev

	//TODO: this should be in a Base helper to get a new temp directory that
	//base will take care of kiling.

	dir := base.NewTempDir("temp_serve_")

	//TODO: allow specifying a different storage type

	apiPath, err := build.Api(dir, mode.GamesList, build.StorageBolt)

	if err != nil {
		errAndQuit("Couldn't create api: " + err.Error())
	}

	//cmd will be run as though it's in this directory, which is where
	//config.json is.
	cmd := exec.Command(apiPath)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout

	err = cmd.Run()<commit_msg>Remove a completed TODO<commit_after>package main

import (
	"github.com/bobziuchkovski/writ"
	"github.com/jkomoros/boardgame/boardgame-util/lib/build"
	"os"
	"os/exec"
)

type Serve struct {
	baseSubCommand
}

func (s *Serve) Run(p writ.Path, positional []string) {

	base := s.Base().(*BoardgameUtil)

	config := base.GetConfig()
	mode := config.Dev

	dir := base.NewTempDir("temp_serve_")

	//TODO: allow specifying a different storage type

	apiPath, err := build.Api(dir, mode.GamesList, build.StorageBolt)

	if err != nil {
		errAndQuit("Couldn't create api: " + err.Error())
	}

	//cmd will be run as though it's in this directory, which is where
	//config.json is.
	cmd := exec.Command(apiPath)
	cmd.Stderr = os.Stderr
	cmd.Stdout = os.Stdout

	err = cmd.Run()
{'fraction_non_alphanumeric': 0.1382262996941896, 'fraction_numerical': 0.0, 'mean_word_length': 3.825958702064897, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2731512', 'n_tokens_mistral': 622, 'n_tokens_neox': 590, 'n_words': 159}