• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kshard / thinker / 13422165794

19 Feb 2025 08:54PM UTC coverage: 67.766%. First build
13422165794

push

github

web-flow
craft the agent architecture (#1)

185 of 273 new or added lines in 15 files covered. (67.77%)

185 of 273 relevant lines covered (67.77%)

0.73 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

67.86
/command/bash.go
1
//
2
// Copyright (C) 2025 Dmitry Kolesnikov
3
//
4
// This file may be modified and distributed under the terms
5
// of the MIT license.  See the LICENSE file for details.
6
// https://github.com/kshard/thinker
7
//
8

9
package command
10

11
import (
12
        "bytes"
13
        "fmt"
14
        "os/exec"
15

16
        "github.com/kshard/chatter"
17
        "github.com/kshard/thinker"
18
)
19

20
// A unique name for bash (the shell)
21
const BASH = "bash"
22

23
// Create new bash command, defining the os variant and working dir
24
func Bash(os, dir string) thinker.Cmd {
1✔
25
        return thinker.Cmd{
1✔
26
                Cmd:    BASH,
1✔
27
                Short:  fmt.Sprintf("executes shell command, strictly adhere shell command syntaxt to %s", os),
1✔
28
                Syntax: "bash <command>",
1✔
29
                Run:    bash(os, dir),
1✔
30
        }
1✔
31
}
1✔
32

33
func bash(os string, dir string) func(chatter.Reply) (float64, thinker.CmdOut, error) {
1✔
34
        return func(command chatter.Reply) (float64, thinker.CmdOut, error) {
2✔
35
                cmd := exec.Command("bash", "-c", command.Text)
1✔
36
                var stdout bytes.Buffer
1✔
37
                var stderr bytes.Buffer
1✔
38
                cmd.Dir = dir
1✔
39
                cmd.Stdout = &stdout
1✔
40
                cmd.Stderr = &stderr
1✔
41

1✔
42
                if err := cmd.Run(); err != nil {
1✔
NEW
43
                        err = thinker.Feedback(
×
NEW
44
                                fmt.Sprintf("The TOOL:%s has failed, improve the response based on feedback:", BASH),
×
NEW
45

×
NEW
46
                                fmt.Sprintf("Strictly adhere shell command syntaxt to %s.", os),
×
NEW
47
                                "Execution of the tool is failed with the error: "+err.Error(),
×
NEW
48
                                "The error output is "+stderr.String(),
×
NEW
49
                        )
×
NEW
50
                        return 0.05, thinker.CmdOut{Cmd: BASH}, err
×
NEW
51
                }
×
52

53
                return 1.0, thinker.CmdOut{Cmd: BASH, Output: stdout.String()}, nil
1✔
54
        }
55
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc