Pinocchio Companion: Migrating CLI Verbs to the Geppetto Bootstrap Path

Pinocchio-specific companion to the generic Geppetto CLI bootstrap migration tutorial.

Sections

Terminology & Glossary
📖 Documentation
Navigation
54 sectionsv0.1
📄 Pinocchio Companion: Migrating CLI Verbs to the Geppetto Bootstrap Path — glaze help cli-profile-bootstrap-migration
cli-profile-bootstrap-migration

Pinocchio Companion: Migrating CLI Verbs to the Geppetto Bootstrap Path

Pinocchio-specific companion to the generic Geppetto CLI bootstrap migration tutorial.

Tutorialpinocchiocliglazedprofilesconfigmigrationtutorialpinocchiojsconfig-fileprofileprofile-registriesprint-parsed-fields+1

The generic migration guide now lives in Geppetto at geppetto/pkg/doc/tutorials/09-migrating-cli-commands-to-glazed-bootstrap-profile-resolution.md. Read that first.

Conceptual Companion

If you are new to the settings lifecycle, read pinocchio/pkg/doc/topics/pinocchio-profile-resolution-and-runtime-switching.md alongside this tutorial.

That companion topic explains:

  • hidden base settings

  • stripped parsed-values base settings

  • BaseInferenceSettings vs FinalInferenceSettings

  • profile resolution without contaminating the baseline

  • ai-client

It also means cross-profile client settings such as ai-client.* are part of the same shared baseline surface when the verb mounts the full Geppetto sections.

This companion page covers only the Pinocchio-specific deltas you still need when the target command lives in the Pinocchio repo.

What Is Pinocchio-Specific

Pinocchio should now contribute only application wiring:

  • its bootstrap config wrapper, profilebootstrap.BootstrapConfig()
  • its config-file mapper, profilebootstrap.MapPinocchioConfigFile(...)
  • its convenience wrappers like profilebootstrap.ResolveCLIEngineSettings(...)
  • any Pinocchio runtime details, such as the JS runtime default settings path

The generic bootstrap and inference-debug behavior is Geppetto-owned.

Step 1: Use the Pinocchio Bootstrap Config

When a Pinocchio command needs to call Geppetto bootstrap helpers directly, pass:

  • profilebootstrap.BootstrapConfig()

That wraps the Pinocchio app name, env prefix, config-file mapper, and shared section builders without re-exporting any debug helper behavior.

Step 2: Keep the Pinocchio Config Mapper in the Middleware Chain

Pinocchio config files contain top-level keys like repositories, so the middleware chain still needs:

  • profilebootstrap.MapPinocchioConfigFile(...)

If you omit that mapper, config parsing can fail or silently drift.

Step 3: Resolve Final Settings Through the Pinocchio Wrapper

In Pinocchio commands, the simplest path is still:

resolved, err := profilebootstrap.ResolveCLIEngineSettings(ctx, parsed)
if err != nil {
	return err
}
if resolved.Close != nil {
	defer resolved.Close()
}

That keeps the command code concise while still using the Geppetto-owned bootstrap system under the hood.

Step 4: Use the Geppetto Debug Helper Directly

Pinocchio should no longer define its own debug helper path. The command should mount:

  • geppettobootstrap.NewInferenceDebugSection()

and should execute:

  • geppettobootstrap.HandleInferenceDebugOutput(...)

The current debug surface is one flag:

  • --print-inference-settings

That output now includes both settings and sources, with sensitive values masked as ***.

Step 5: Preserve the JS Runtime Defaults Rule

The Pinocchio JS command still has one subtle runtime rule that matters:

  • pass the resolved final inference settings into the JS runtime as defaults

That prevents later JS-created engines from dropping config-derived values like API keys or base URLs.

Validation Checklist

Run these after migrating a Pinocchio verb:

  1. go run ./cmd/pinocchio <verb> --help --long-help
  2. go run ./cmd/pinocchio <verb> --print-parsed-fields
  3. go run ./cmd/pinocchio <verb> --print-inference-settings
  4. Confirm the debug output includes both settings: and sources:
  5. go test ./cmd/pinocchio/... -count=1
  6. go test ./pkg/cmds/profilebootstrap -count=1

Troubleshooting

ProblemCauseSolution
Config parsing chokes on repositoriesThe command skipped the Pinocchio config-file mapperUse profilebootstrap.MapPinocchioConfigFile(...)
The command still has --print-inference-settings-sources docs or flagsThe migration copied older Pinocchio patternsReplace them with geppettobootstrap.NewInferenceDebugSection() and the single --print-inference-settings path
JS-created engines miss API keys or base URLsThe runtime used raw profile data instead of merged defaultsPass resolved.FinalInferenceSettings into the JS runtime as default settings

See Also