Object CodingWorkspace
-
- All Implemented Interfaces:
public class CodingWorkspaceCentral resolution of the coding workspace for Browser4's self-coding capability (the
coding_*tools and the CLIcodecommand family).The workspace root defaults to the backend JVM working directory (
user.dir), which is the runtime bundle directory when the server is launched by the CLI daemon — usually NOT where the user's code lives. Point it at a real repository with:-Dbrowser4.agent.workspace=<path> (JVM system property) BROWSER4_SERVER_OPTS=-Dbrowser4.agent.workspace=<path> ... (CLI daemon env var)When no explicit workspace is configured and the JVM working directory (or any of its parents) sits inside a Browser4 source checkout — a directory containing both
ROOT.mdandpom.xml, the same marker the CLI daemon uses — the repository root is used automatically. This makes thecoding_*tools (and thebrowser4 codeCLI family) operate on the user's code instead of the runtime bundle directory, so repo-relative paths likeVERSION,browser4-plugins/..., and Maven module paths resolve correctly during self-development.Related switches:
browser4.agent.allowExternalAccess=true— permit absolute paths outside the workspace root (off by default).browser4.agent.allowDestructive=false— deny rm/del/mv/cp/kill style operations (on by default).
-
-
Field Summary
Fields Modifier and Type Field Description private final PathworkspaceRootprivate final BooleanallowExternalAccessprivate final BooleanallowDestructivepublic final static CodingWorkspaceINSTANCE
-
Method Summary
Modifier and Type Method Description final PathfindRepoRootFrom(Path start)Walk up from start looking for a Browser4 repository root — a directory containing both ROOT.mdandpom.xml(the same marker the CLI daemon'sfind_browser4_rootuses).final PathgetWorkspaceRoot()The workspace root for all coding file operations. final BooleangetAllowExternalAccess()Whether absolute paths outside the workspace root are permitted. final BooleangetAllowDestructive()Whether destructive file operations (delete/move/copy) are permitted. -
-
Method Detail
-
findRepoRootFrom
final Path findRepoRootFrom(Path start)
Walk up from start looking for a Browser4 repository root — a directory containing both
ROOT.mdandpom.xml(the same marker the CLI daemon'sfind_browser4_rootuses). Returnsnullwhen no repository root is found (e.g. a globally installed runtime).
-
getWorkspaceRoot
final Path getWorkspaceRoot()
The workspace root for all coding file operations.
Computed on every access (not cached) so tests and runtime reconfiguration can switch the property.
-
getAllowExternalAccess
final Boolean getAllowExternalAccess()
Whether absolute paths outside the workspace root are permitted.
-
getAllowDestructive
final Boolean getAllowDestructive()
Whether destructive file operations (delete/move/copy) are permitted.
-
-
-
-