Workspace Files and Git Functions

Campfire workspace functions operate on the currently open folder workspace. They are specific to Campfire's folder-first experience.

Use these functions when CodeBot needs to understand the workspace root, list workspace contents, create a plain file in a folder workspace, or use Git through Campfire's workspace Git manager.

Workspace Info

  • getCurrentWorkspaceInfo returns information about the currently open Campfire workspace.
  • listWorkspaceFolder lists files and folders inside the current workspace. folderPath can be omitted for the workspace root, or passed as an absolute path inside the workspace or a workspace-relative path. The result separates files and folders, supports optional recursive traversal, and caps result counts.

Use getCurrentWorkspaceInfo before assuming where the workspace lives or what state Campfire has already discovered. Use listWorkspaceFolder for folder-style discovery instead of shelling out to ls when CodeBot only needs the workspace contents.

Workspace File Creation

  • createFileInWorkspaceFolder creates a new text file, preferably inside the current workspace. filePath can be absolute or workspace-relative, and code is the full file contents.

Use this for folder workspaces that are not project-based. It creates a local text file but does not add the file to an IDE project. If the target path points outside the current workspace, Campfire asks the user for approval before writing there.

Git

  • initGitRepository initializes Git in the current workspace. It requires an explicit initial branchName, runs Git initialization through Campfire, and adds Campfire's local CodeBot cache, approvals, and workspace settings files to .gitignore.
  • runGitCommand runs Git arguments in the current workspace through Campfire's Git manager. It accepts Git arguments such as status -sb or log --oneline -5, not arbitrary shell commands.

Use initGitRepository only after the user agrees to add Git to a workspace that does not already have a repository.

Use runGitCommand for Git-specific operations in an existing workspace repository. The command is routed through the Git manager, requires approval, reloads source control state after commands that may change the workspace, and is tagged as version-control work.

When To Use Which Tool

Use listWorkspaceFolder for workspace discovery.

Use createFileInWorkspaceFolder for new standalone files in folder workspaces.

Use initGitRepository when Campfire should turn the current folder into a Git repository.

Use runGitCommand when the user asks for a Git operation and the workspace already has Git.

Use the shared file-editing functions for existing-file reads and edits. Use the shared terminal function only when the task is not a Git-manager operation.