integration

package
v0.4.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2025 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	SetupPythonRepo = func(t *testing.T, repoDir string) {
		writeFile(t, repoDir, "main.py", "def main():\n    print('Hello World')\n\nif __name__ == '__main__':\n    main()\n")
		writeFile(t, repoDir, "requirements.txt", "requests==2.31.0\nnumpy==1.24.0\n")
		writeFile(t, repoDir, ".gitignore", "__pycache__/\n*.pyc\n.env\nvenv/\n")
		gitCommit(t, repoDir, "Initial Python project")
	}

	SetupPythonRepoNoGitignore = func(t *testing.T, repoDir string) {
		writeFile(t, repoDir, "main.py", "def main():\n    print('Hello World')\n\nif __name__ == '__main__':\n    main()\n")
		writeFile(t, repoDir, "requirements.txt", "requests==2.31.0\nnumpy==1.24.0\n")
		gitCommit(t, repoDir, "Initial Python project")
	}

	SetupNodeRepo = func(t *testing.T, repoDir string) {
		packageJSON := `{
  "name": "test-project",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "node index.js",
    "test": "jest"
  },
  "dependencies": {
    "express": "^4.18.0"
  }
}`
		writeFile(t, repoDir, "package.json", packageJSON)
		writeFile(t, repoDir, "index.js", "console.log('Hello from Node.js');\n")
		writeFile(t, repoDir, ".gitignore", "node_modules/\n.env\n")
		gitCommit(t, repoDir, "Initial Node project")
	}

	SetupEmptyRepo = func(t *testing.T, repoDir string) {
		writeFile(t, repoDir, "README.md", "# Test Project\n")
		gitCommit(t, repoDir, "Initial commit")
	}
)

Common repository setups

Functions

func WithRepository

func WithRepository(t *testing.T, name string, setup RepositorySetup, fn func(t *testing.T, repo *repository.Repository, user *UserActions))

WithRepository runs a test function with an isolated repository and UserActions

Types

type RepositorySetup

type RepositorySetup func(t *testing.T, repoDir string)

RepositorySetup is a function that prepares a test repository

type UserActions

type UserActions struct {
	// contains filtered or unexported fields
}

UserActions provides test helpers that mirror MCP tool behavior exactly These represent what a user would experience when using the MCP tools

func NewUserActions

func NewUserActions(t *testing.T, repo *repository.Repository, dag *dagger.Client) *UserActions

func (*UserActions) CheckoutBranchInSourceRepo added in v0.4.2

func (u *UserActions) CheckoutBranchInSourceRepo(branchName string)

CheckoutBranchInSourceRepo checks out an existing branch in the source repo

func (*UserActions) CorruptWorktree

func (u *UserActions) CorruptWorktree(envID string)

CorruptWorktree simulates worktree corruption for recovery testing

func (*UserActions) CreateBranchInSourceRepo added in v0.4.2

func (u *UserActions) CreateBranchInSourceRepo(branchName string)

CreateBranchInSourceRepo creates and checks out a new branch in the source repo

func (*UserActions) CreateEnvironment

func (u *UserActions) CreateEnvironment(title, explanation string) *environment.Environment

CreateEnvironment mirrors environment_create MCP tool behavior

func (*UserActions) FileDelete

func (u *UserActions) FileDelete(envID, targetFile, explanation string)

FileDelete mirrors environment_file_delete MCP tool behavior

func (*UserActions) FileRead

func (u *UserActions) FileRead(envID, targetFile string) string

FileRead mirrors environment_file_read MCP tool behavior (read-only, no update)

func (*UserActions) FileReadExpectError

func (u *UserActions) FileReadExpectError(envID, targetFile string)

FileReadExpectError is for testing expected failures

func (*UserActions) FileWrite

func (u *UserActions) FileWrite(envID, targetFile, contents, explanation string)

FileWrite mirrors environment_file_write MCP tool behavior

func (*UserActions) GetEnvironment

func (u *UserActions) GetEnvironment(envID string) *environment.Environment

GetEnvironment retrieves an environment by ID - mirrors how MCP tools work Each MCP tool call starts fresh by getting the environment from the repository

func (*UserActions) GitCommand

func (u *UserActions) GitCommand(args ...string) string

GitCommand runs a git command in the source repository

func (*UserActions) ReadWorktreeFile

func (u *UserActions) ReadWorktreeFile(envID, path string) string

ReadWorktreeFile reads directly from an environment's worktree

func (*UserActions) RunCommand

func (u *UserActions) RunCommand(envID, command, explanation string) string

RunCommand mirrors environment_run_cmd MCP tool behavior

func (*UserActions) UpdateEnvironment

func (u *UserActions) UpdateEnvironment(envID, title, explanation string, config *environment.EnvironmentConfig)

UpdateEnvironment mirrors environment_update MCP tool behavior

func (*UserActions) WithDirectAccess

func (u *UserActions) WithDirectAccess(repoDir, configDir string) *UserActions

WithDirectAccess adds direct filesystem access for edge case testing

func (*UserActions) WorktreePath added in v0.2.0

func (u *UserActions) WorktreePath(envID string) string

WorktreePath returns the worktree path for an environment, handling errors

func (*UserActions) WriteFileInSourceRepo added in v0.4.2

func (u *UserActions) WriteFileInSourceRepo(path, content, commitMessage string)

WriteFileInSourceRepo writes a file to the source repo and commits it

func (*UserActions) WriteSourceFile

func (u *UserActions) WriteSourceFile(path, content string)

WriteSourceFile writes directly to the source repository

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL