Skip to content

Detect the constructor from the project files - #22

Merged
lnsp merged 1 commit into
masterfrom
cli-detect-constructor
Nov 20, 2026
Merged

lnsp merged 1 commit into
masterfrom
cli-detect-constructor

Conversation

@lnsp

@lnsp lnsp commented Nov 20, 2026

Copy link
Copy Markdown
Member

valar service init no longer requires --type. Without it, the constructor is detected from the current directory; the first match wins:

File Constructor
go.mod go
package.json node
requirements.txt or pyproject.toml python
index.html static
Dockerfile docker

The choice is printed to stderr (detected constructor: go (go.mod)) and written to .valar.yml. valar build push detects it the same way, from the pushed folder, when .valar.yml names no constructor; it does so before uploading anything. Without any of the files, the command fails with exit code 2 (invalid) and lists the constructors to pass with --type.

service init now checks for an existing .valar.yml before detecting, so a refused init prints no detection note.

Tests cover each layout, the precedence between markers, a directory named like a marker, and the error.

'valar service init' no longer requires --type. Without it, the constructor
is picked from the first of these files in the current directory: go.mod
(go), package.json (node), requirements.txt or pyproject.toml (python),
index.html (static), Dockerfile (docker). The choice is printed to stderr
and written to .valar.yml. 'valar build push' detects it the same way when
.valar.yml names no constructor. Without any of the files, the command
fails with exit code 2 and lists the constructors to pass with --type.
@lnsp
lnsp merged commit 5f6273a into master Nov 20, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant