scaffold

package
v0.1.0-beta.10 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package scaffold renders the starter files `gridctl agent init` drops into a fresh project. The TS flavor (default) writes SKILL.md + skill.ts + agent.json — runnable through `gridctl agent dev` with no further setup. The prompt-only flavor writes just SKILL.md so authors can hand-edit a body that surfaces to upstream MCP clients as a prompt or tool description. The Go flavor writes SKILL.md + skill.go + skill_test.go — a typed Go skill the operator builds with `gridctl agent build` (Phase 4) and the gateway loads as a plugin at start (Phase 5).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HelloSkillGo

func HelloSkillGo(name string) string

HelloSkillGo returns the body of the scaffolded skill.go as bytes the regression suite can run through `go build` verbatim. Same parity guarantee HelloSkillTS provides for the TS path: a future change to the scaffold immediately re-tests compile compatibility, no parallel copy of the source to drift out of sync.

func HelloSkillGoTest

func HelloSkillGoTest(name string) string

HelloSkillGoTest returns the body of the scaffolded skill_test.go for the same regression-channel reason as HelloSkillGo. The test is part of the scaffold output, so the compile-check pass needs it on disk alongside skill.go.

func HelloSkillTS

func HelloSkillTS(name string) string

HelloSkillTS returns the body of the scaffolded skill.ts as bytes the regression suite can run through the sandbox verbatim. Exporting the helper means a future change to the scaffold immediately re-tests runtime compatibility — there's no parallel copy of the source to drift out of sync.

Types

type Options

type Options struct {
	SkillName string
	Force     bool
	Language  string
}

Options controls the scaffolded files. SkillName seeds the SKILL.md frontmatter and the hello-world's identifier; an empty value defaults to "hello-ts". Force=false (the default) means existing files are left in place. Language picks the flavor: "" or "ts" → TypeScript skill (existing behavior, default); "prompt" → SKILL.md only (no handler sibling); "go" → typed Go skill (SKILL.md + skill.go + skill_test.go). Any other value is rejected.

type Result

type Result struct {
	// Created lists files that did not exist before scaffolding.
	Created []string

	// Skipped lists files that already existed and were left
	// untouched. Scaffold never overwrites — the operator is
	// expected to re-run `agent init` only in a clean directory.
	Skipped []string
}

Result describes what Scaffold wrote to disk. Useful for tests and the CLI output.

func Scaffold

func Scaffold(root string, opts Options) (Result, error)

Scaffold writes the starter files for the requested flavor into root. The root directory is created if missing. Pre-existing files with identical bytes are silently skipped so re-running `agent init` is idempotent; non-identical files are skipped unless Force=true. Returns an error for unsupported Language values before any file is written.

Jump to

Keyboard shortcuts

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