Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/validate-schema-create-expert-v2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"perstack": patch
"@perstack/perstack-toml": patch
---

feat: add `perstack validate` and `perstack schema` CLI commands, rewrite create-expert v2.0.0
26 changes: 26 additions & 0 deletions apps/perstack/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import {
getPerstackConfig,
getPerstackConfigOrDefault,
loadLockfile,
printPerstackSchema,
validatePerstackConfigFile,
} from "@perstack/perstack-toml"
import {
applicationsListHandler,
Expand Down Expand Up @@ -202,6 +204,30 @@ program
await installHandler({ configPath, perstackConfig, envPath: options.envPath })
})

// Validation and schema commands
program
.command("validate")
.description("Validate a perstack.toml file against the schema")
.argument("<path>", "Path to perstack.toml file to validate")
.action(async (pathArg: string) => {
const result = await validatePerstackConfigFile(pathArg)
if (result.valid) {
console.log("Valid")
} else {
for (const error of result.errors) {
console.error(error)
}
process.exit(1)
}
})

program
.command("schema")
.description("Print the perstack.toml schema reference")
.action(() => {
console.log(printPerstackSchema())
})

// Expert management commands
function getParentOptions(cmd: InstanceType<typeof Command>) {
const parent = cmd.parent?.opts() as { apiKey?: string; baseUrl?: string } | undefined
Expand Down
9 changes: 5 additions & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading