Skip to content

Commit f40e804

Browse files
fix: gofmt formatting, lint script for Vite/React UI, CI readiness
- gofmt: fixed formatting in blocks/registry.go, server/blocks_api.go, stacks/stacks.go - lint.sh: updated UI check for Vite/React output (assets/ + index.html) instead of old styles.css/app.jsx - All checks pass: gofmt clean, go vet clean, UI embedded, 36 tests passing
1 parent 725fd37 commit f40e804

4 files changed

Lines changed: 34 additions & 42 deletions

File tree

‎pkg/blocks/registry.go‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -337,13 +337,13 @@ func (r *Registry) ResolvePackRefs(pack *PackBlock) error {
337337

338338
// PublicView is the Studio/API catalog payload.
339339
type PublicView struct {
340-
Blocks []CatalogEntry `json:"blocks"`
341-
Packs []map[string]any `json:"packs"`
342-
Pipelines []map[string]any `json:"pipelines"`
343-
Agents []map[string]any `json:"agents"`
344-
Quality []map[string]any `json:"quality"`
345-
ActivePack string `json:"active_pack,omitempty"`
346-
ActivePipeline string `json:"active_pipeline,omitempty"`
340+
Blocks []CatalogEntry `json:"blocks"`
341+
Packs []map[string]any `json:"packs"`
342+
Pipelines []map[string]any `json:"pipelines"`
343+
Agents []map[string]any `json:"agents"`
344+
Quality []map[string]any `json:"quality"`
345+
ActivePack string `json:"active_pack,omitempty"`
346+
ActivePipeline string `json:"active_pipeline,omitempty"`
347347
}
348348

349349
// View builds the discovery API response.
@@ -360,7 +360,7 @@ func (r *Registry) View(activePack, activePipeline string) PublicView {
360360
"version": p.Version, "author": p.Author, "language": p.Language,
361361
"tags": p.Tags, "icon": p.Icon, "source": p.Source, "path": p.Path,
362362
"spec": p.Spec, "builtin": p.Source == SourceBuiltin,
363-
"active": activePack != "" && activePack == p.ID,
363+
"active": activePack != "" && activePack == p.ID,
364364
"shareable": p.Shareable != nil && *p.Shareable,
365365
})
366366
}
@@ -370,8 +370,8 @@ func (r *Registry) View(activePack, activePipeline string) PublicView {
370370
"id": p.ID, "name": p.Name, "description": p.Description,
371371
"version": p.Version, "author": p.Author, "language": p.Language,
372372
"tags": p.Tags, "icon": p.Icon, "source": p.Source, "path": p.Path,
373-
"builtin": p.Source == SourceBuiltin,
374-
"active": activePipeline != "" && activePipeline == p.ID,
373+
"builtin": p.Source == SourceBuiltin,
374+
"active": activePipeline != "" && activePipeline == p.ID,
375375
"shareable": p.Shareable != nil && *p.Shareable,
376376
})
377377
}
@@ -382,7 +382,7 @@ func (r *Registry) View(activePack, activePipeline string) PublicView {
382382
"version": a.Version, "author": a.Author, "language": a.Language,
383383
"tags": a.Tags, "icon": a.Icon, "source": a.Source, "path": a.Path,
384384
"builtin": a.Source == SourceBuiltin,
385-
"spec": a.Spec, "shareable": a.Shareable != nil && *a.Shareable,
385+
"spec": a.Spec, "shareable": a.Shareable != nil && *a.Shareable,
386386
})
387387
}
388388
for _, id := range sortedKeys(r.Quality) {
@@ -392,7 +392,7 @@ func (r *Registry) View(activePack, activePipeline string) PublicView {
392392
"version": q.Version, "author": q.Author, "language": q.Language,
393393
"tags": q.Tags, "icon": q.Icon, "source": q.Source, "path": q.Path,
394394
"builtin": q.Source == SourceBuiltin,
395-
"spec": q.Spec, "shareable": q.Shareable != nil && *q.Shareable,
395+
"spec": q.Spec, "shareable": q.Shareable != nil && *q.Shareable,
396396
})
397397
}
398398
return v

‎pkg/server/blocks_api.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,9 @@ func (s *Server) handleApplyPack(w http.ResponseWriter, r *http.Request) {
105105
return
106106
}
107107
writeJSON(w, map[string]any{
108-
"ok": true,
109-
"result": res,
110-
"config": s.h.Config.Public(),
108+
"ok": true,
109+
"result": res,
110+
"config": s.h.Config.Public(),
111111
"catalog": reg.View(s.h.Config.ActivePack, s.h.Config.ActivePipeline),
112112
})
113113
}

‎pkg/stacks/stacks.go‎

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,17 @@ type AgentDefault struct {
2727

2828
// Stack is a named preset: global LLM defaults + optional role defaults + UI meta.
2929
type Stack struct {
30-
ID string `json:"id"`
31-
Label string `json:"label"`
32-
Description string `json:"description,omitempty"`
33-
Icon string `json:"icon,omitempty"`
34-
Color string `json:"color,omitempty"`
35-
EnvKey string `json:"env_key,omitempty"`
36-
Path string `json:"path,omitempty"`
37-
Provider string `json:"provider"`
38-
Endpoint string `json:"endpoint"`
39-
Model string `json:"model"`
40-
Backend string `json:"backend,omitempty"`
30+
ID string `json:"id"`
31+
Label string `json:"label"`
32+
Description string `json:"description,omitempty"`
33+
Icon string `json:"icon,omitempty"`
34+
Color string `json:"color,omitempty"`
35+
EnvKey string `json:"env_key,omitempty"`
36+
Path string `json:"path,omitempty"`
37+
Provider string `json:"provider"`
38+
Endpoint string `json:"endpoint"`
39+
Model string `json:"model"`
40+
Backend string `json:"backend,omitempty"`
4141
// Agents is optional per-role LLM pins.
4242
Agents map[string]AgentDefault `json:"agents,omitempty"`
4343
// Pack optionally applies a language/domain building-block pack when the stack is applied.

‎scripts/lint.sh‎

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,19 @@ echo "==> go vet"
1818
go vet ./...
1919

2020
echo "==> ui-check"
21-
# Validate embedded UI files
22-
if [[ ! -f cmd/slmcode/ui/styles.css ]]; then
23-
echo "ERROR: cmd/slmcode/ui/styles.css missing"
24-
exit 1
25-
fi
26-
if [[ ! -f cmd/slmcode/ui/app.jsx ]]; then
27-
echo "ERROR: cmd/slmcode/ui/app.jsx missing"
28-
exit 1
29-
fi
21+
# Validate embedded Vite/React UI files
3022
if [[ ! -f cmd/slmcode/ui/index.html ]]; then
31-
echo "ERROR: cmd/slmcode/ui/index.html missing"
23+
echo "ERROR: cmd/slmcode/ui/index.html missing — run: make ui-react"
3224
exit 1
3325
fi
34-
35-
# CSS validation
36-
if ! grep -q 'data-theme' cmd/slmcode/ui/styles.css; then
37-
echo "ERROR: styles.css missing data-theme selector"
26+
if [[ ! -d cmd/slmcode/ui/assets ]]; then
27+
echo "ERROR: cmd/slmcode/ui/assets missing — run: make ui-react"
3828
exit 1
3929
fi
40-
if ! grep -q 'slmcode-theme' cmd/slmcode/ui/app.jsx; then
41-
echo "ERROR: app.jsx missing slmcode-theme reference"
30+
31+
# Validate index.html references SLMCode Studio
32+
if ! grep -q 'SLMCode Studio' cmd/slmcode/ui/index.html; then
33+
echo "ERROR: index.html missing SLMCode Studio reference"
4234
exit 1
4335
fi
4436

0 commit comments

Comments
 (0)