Documentation
¶
Overview ¶
Package pluginapi implements the paired capability surface Workstream B exposes to both JavaScript and Go plugins: resolving/reading files against the project root and node_modules, and writing static assets into the project root. Every function anchors paths to the project root and rejects traversal.
The JavaScript capability host functions (internal/plugin) and the public Go SDK (pluginsdk) both delegate here so the security guards live in one place.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Resolve ¶
Resolve turns a plugin file specifier into an absolute path.
- Absolute paths are cleaned and must live under root.
- Explicit relative paths ("./", "../") resolve against root and must stay inside it.
- Bare specifiers resolve through node_modules (walking up from root) — including subpaths like "pkg/styles/x.css" and "@scope/pkg/src/y" — and otherwise fall back to a root-relative file.
The resolved path must exist. Traversal outside root is rejected.
func WithinRoot ¶
WithinRoot reports whether path p is the project root itself or lives inside it. Both paths are cleaned first; the result is case-sensitive, matching the underlying filesystem semantics.
func WriteFileToRoot ¶
WriteFileToRoot writes content to rel, interpreted relative to the project root (e.g. "public/logo.svg"), creating parent directories as needed. A path that escapes root is rejected.
Types ¶
This section is empty.