MCPcopy Create free account
hub / github.com/PerpetualSoftware/pad / projectBootstrapCollection

Function projectBootstrapCollection

internal/server/handlers_bootstrap.go:107–124  ·  view source on GitHub ↗

projectBootstrapCollection converts a models.Collection into the slim bootstrap projection. The `schema` field is emitted as a nested JSON object when the stored string is valid JSON; an empty or malformed schema is omitted (omitempty + nil RawMessage) so the response never carries garbage that woul

(c models.Collection)

Source from the content-addressed store, hash-verified

105// that match the auto-fill rule carry no information the agent can't
106// reconstruct).
107func projectBootstrapCollection(c models.Collection) BootstrapCollection {
108 out := BootstrapCollection{
109 Slug: c.Slug,
110 Name: c.Name,
111 Prefix: c.Prefix,
112 Icon: c.Icon,
113 Description: c.Description,
114 SortOrder: c.SortOrder,
115 IsDefault: c.IsDefault,
116 IsSystem: c.IsSystem,
117 ItemCount: c.ItemCount,
118 ActiveItemCount: c.ActiveItemCount,
119 }
120 if s := strings.TrimSpace(c.Schema); s != "" && json.Valid([]byte(s)) {
121 out.Schema = trimRedundantSchemaLabels([]byte(s))
122 }
123 return out
124}
125
126// bootstrapSchema is the bootstrap-side schema shape, parallel to
127// models.CollectionSchema. Used only by trimRedundantSchemaLabels to

Callers 1

BuildAgentBootstrapMethod · 0.85

Calls 1

Tested by

no test coverage detected