Object ArtifactScaffolds
-
- All Implemented Interfaces:
public class ArtifactScaffoldsScaffold templates for Browser4's four core programming artifact types.
Each function returns template text that an agent can use as a starting point for creating: Browser4 plugins, skills, browser JS scripts, and simple shell scripts.
Zero dependencies — pure string generation.
-
-
Field Summary
Fields Modifier and Type Field Description private final List<String>TYPESpublic final static ArtifactScaffoldsINSTANCE
-
Method Summary
Modifier and Type Method Description final Map<String, String>scaffold(String type, Map<String, String> params)Generate scaffold by artifact type. final Map<String, String>pluginScaffold(String pluginName, String domain, String basePackage, String toolMethod, String toolDescription, String pdkVersion)Generate a complete Browser4 plugin scaffold. final StringskillScaffold(String name, String description, List<String> triggers, List<String> tools)Generate a SKILL. final StringjsScaffold(String name, String purpose)Generate a browser JS script scaffold. final StringscriptScaffold(String name, String scriptType, String shell)Generate a simple build/deploy/run script. final StringtoClassName(String name)Convert kebab-case or snake_case to PascalCase. final StringtoCamelCase(String name)Convert kebab-case or PascalCase to camelCase. final List<String>getTYPES()Supported artifact types. -
-
Method Detail
-
scaffold
final Map<String, String> scaffold(String type, Map<String, String> params)
Generate scaffold by artifact type. Returns a map of file-path to content (for multi-file types like plugin) or a single-entry map with key "_content".
-
pluginScaffold
final Map<String, String> pluginScaffold(String pluginName, String domain, String basePackage, String toolMethod, String toolDescription, String pdkVersion)
Generate a complete Browser4 plugin scaffold.
Browser4-targeted optimizations beyond a plain Kotlin skeleton:
the generated tool runs browser-side JS via WebDriver.evaluateValue (the browser-first plugin form, mirroring browser4-seo's extract-meta.js)
a Service layer that loads the JS resource from the classpath
a build.ps1 that builds, verifies the JAR structure (manifest + auto-config imports + classes) and deploys via REST or copy
- Parameters:
pluginName- kebab-case plugin name (e.g.domain- tool domain (e.g.basePackage- Kotlin base package (e.g., "ai.platon.pulsar.toolMethod- first tool method name (e.g.toolDescription- human-readable description of the toolpdkVersion- the browser4-pdk parent version to use (required — the caller supplies the current project version, e.g.- Returns:
map of relative file paths to file content
-
skillScaffold
final String skillScaffold(String name, String description, List<String> triggers, List<String> tools)
Generate a SKILL.md scaffold matching the real SkillDefinitionLoader frontmatter contract:
name(must equal the directory name, kebab-case),description(1..1024 chars), optionalallowed-tools(space-separated).- Parameters:
name- kebab-case skill name — must match the directory the SKILL.description- 1..triggers- trigger phrases rendered into the body's "When to Use" sectiontools- tool names (e.g.
-
jsScaffold
final String jsScaffold(String name, String purpose)
Generate a browser JS script scaffold.
- Parameters:
purpose- one of: "extract" (DOM data extraction), "inject" (DOM modification), "interact" (page interaction)
-
scriptScaffold
final String scriptScaffold(String name, String scriptType, String shell)
Generate a simple build/deploy/run script.
- Parameters:
scriptType- "build", "deploy", or "run"shell- "ps1" or "bash"
-
toClassName
final String toClassName(String name)
Convert kebab-case or snake_case to PascalCase. "browser4-seo" -> "Browser4Seo"
-
toCamelCase
final String toCamelCase(String name)
Convert kebab-case or PascalCase to camelCase. "browser4-seo" -> "browser4Seo"
-
-
-
-