Skip to content

Commit 1a6e46d

Browse files
committed
amp: fix cue loading and import
1 parent 32a4d78 commit 1a6e46d

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ all:
366366

367367
## Modules
368368

369+
`WHEN ADDING OR EDITING NEW MODULE, ALWAYS ADD OR MODIFY ITS CUE SCHEMA`
370+
369371
### ping
370372

371373
A trivial test module to verify SSH connectivity. Returns "pong" on success.

cmd/controller/main.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,11 @@ func main() {
142142
if invPath == "" && cfg.Inventory != "" {
143143
invPath = cfg.Inventory
144144
if !filepath.IsAbs(invPath) {
145-
invPath = filepath.Join(filepath.Dir(*configPath), invPath)
145+
baseDir := filepath.Dir(*configPath)
146+
if info, err := os.Stat(*configPath); err == nil && info.IsDir() {
147+
baseDir = *configPath
148+
}
149+
invPath = filepath.Join(baseDir, invPath)
146150
}
147151
}
148152

internal/cueconfig/loader.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ func schemaOverlay(baseDir string) map[string]load.Source {
172172
if moduleRoot == "" {
173173
moduleRoot = baseDir
174174
}
175+
if absRoot, err := filepath.Abs(moduleRoot); err == nil {
176+
moduleRoot = absRoot
177+
}
175178
modulePath := "dibra.dev"
176179

177180
for _, entry := range entries {

0 commit comments

Comments
 (0)