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
2 changes: 1 addition & 1 deletion packages/coding-agent/schema/config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1571,7 +1571,7 @@
"const": "tinyfish"
}
],
"description": "Web search backend. `auto` (default) walks the chain; a backend id pins one; `off` keeps the tool but refuses calls. The runtime treats an unrecognized value as `auto`, so a misspelling silently disables the pin instead of failing."
"description": "Web search backend. `auto` (default) walks the chain; a backend id pins one; `off` keeps the tool but refuses calls. The runtime treats an unrecognized value as `auto`, so a misspelling silently disables the pin instead of failing; `step config check` flags it."
}
},
"additionalProperties": false,
Expand Down
3 changes: 2 additions & 1 deletion packages/coding-agent/src/cli/args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,8 @@ ${chalk.bold("Configuration:")}
~/.stepcode/models.json Custom providers and models
.stepcode/config.toml Project overrides, loaded when the project is trusted
${APP_NAME} config show Print the stored config.toml, models.json, and paths
${APP_NAME} config schema Print the JSON Schema an editor completes against`
${APP_NAME} config schema Print the JSON Schema an editor completes against
${APP_NAME} config check Report keys and values this build would ignore`
: "";
const extensionFlagsText =
extensionFlags && extensionFlags.length > 0
Expand Down
5 changes: 3 additions & 2 deletions packages/coding-agent/src/package-manager-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ project-local modes.
Settings themselves (models, compaction, permissions, search, MCP servers) live
in the same config.toml. \`config show\` prints the stored global and project
documents with credentials redacted, \`config schema\` prints the JSON Schema an
editor completes and validates against, and \`config init\` writes a template
plus that schema beside the global file.
editor completes and validates against, \`config check\` reports keys and values
this build would ignore, and \`config init\` writes a template plus that schema
beside the global file.

Options:
-l, --local Edit project overrides (${CONFIG_DIR_NAME}/config.toml)
Expand Down
56 changes: 56 additions & 0 deletions packages/coding-agent/src/step/command-compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { existsSync, readFileSync } from "node:fs";
import { mkdir, readFile, writeFile } from "node:fs/promises";
import { basename, dirname, extname, join, resolve } from "node:path";
import { checkStepConfigFiles, describePath } from "./config-check.ts";
import {
CONFIG_SCHEMA_FILE_NAME,
MODELS_SCHEMA_FILE_NAME,
Expand Down Expand Up @@ -361,6 +362,51 @@ export async function runStepConfigCommand(argv: readonly string[], io: StepConf
return;
}

if (subcommand === "check") {
const result = checkStepConfigFiles({
globalSettings: paths.globalSettings,
projectSettings: paths.projectSettings,
models: paths.globalModels,
});

if (argv.includes("--json")) {
stdout.write(
`${JSON.stringify(
{
ok: result.problems.length === 0,
checkedFiles: result.checkedFiles,
notes: result.notes,
problems: result.problems,
},
null,
2,
)}\n`,
);
} else if (result.problems.length === 0) {
stdout.write(`Configuration is valid: ${result.checkedFiles.join(", ") || "(no files yet)"}\n`);
for (const note of result.notes) stdout.write(`note: ${note}\n`);
} else {
for (const problem of result.problems) {
const where = problem.path ? `${problem.file}:${describePath(problem.path)}` : problem.file;
stdout.write(`${where}: ${problem.message}\n`);
}
for (const note of result.notes) stdout.write(`note: ${note}\n`);
}
// An unknown key means this binary ignores it, which is a real problem for
// the file's author but not for someone reading a config written by a newer
// release. `--allow-unknown` downgrades those to a note.
const blocking = argv.includes("--allow-unknown")
? result.problems.filter((problem) => problem.kind !== "unknown")
: result.problems;
if (blocking.length > 0) {
const count = blocking.length;
throw new Error(
`${count} configuration ${count === 1 ? "problem" : "problems"} found. Run "step config schema" for the full key list.`,
);
}
return;
}

if (subcommand === "show") {
const json = argv.includes("--json");
const readJson = async (path: string): Promise<unknown> => {
Expand Down Expand Up @@ -534,6 +580,16 @@ function stepConfigUsage(subcommand: string): string {
"Usage: step config init [--scope user|workspace] [--path <file>] [--force]",
" Write a Step config template. Defaults to the user scope; --force overwrites an existing file.",
].join("\n");
case "check":
return [
"Usage: step config check [--json] [--allow-unknown]",
" Validate the global and project config.toml plus models.json against the",
" schema this build ships. An unknown key or a rejected value is reported",
" and the exit code is 1.",
" --allow-unknown Do not fail on a key this build does not read. Use it in",
" CI for a config shared with a newer release; the key is",
" still reported.",
].join("\n");
case "schema":
return [
"Usage: step config schema [config|models] [--out <file>]",
Expand Down
Loading