You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement the internal/config package and the jotsmith config show command. Every later subcommand depends on a loaded, validated config, so this slice nails down the file format, path-resolution precedence, env-var contract, and error surface.
internal/config defines a Config struct matching the PRD §5.3 schema: version, subscription_id, storage_account, key_vault, key_name, issuer, jwks_path, discovery_path
Load(path) reads, JSON-unmarshals, and validates required fields; returns distinct typed errors for missing file, invalid JSON, and missing/invalid required field
Validation error messages name the offending field
version is required and validated (only 1 is accepted in this slice)
issuer validation: parses as URL, has scheme + host, no trailing slash; default-corrected if a trailing slash is present and a debug log is emitted
jotsmith config show prints the loaded config JSON pretty-printed to stdout
jotsmith config show --path prints the resolved config file path to stdout
Config-load errors exit with code 2 and render to stderr
--no-color is respected on stderr error rendering
Unit tests cover: XDG fallback when env unset, env override of XDG, flag override of env, missing file, invalid JSON, missing required field, trailing-slash issuer correction
What to build
Implement the
internal/configpackage and thejotsmith config showcommand. Every later subcommand depends on a loaded, validated config, so this slice nails down the file format, path-resolution precedence, env-var contract, and error surface.Path resolution precedence (highest wins):
--configflag →JOTSMITH_CONFIGenv →${XDG_CONFIG_HOME:-$HOME/.config}/jotsmith/config.json.Acceptance criteria
internal/configdefines aConfigstruct matching the PRD §5.3 schema:version,subscription_id,storage_account,key_vault,key_name,issuer,jwks_path,discovery_pathLoad(path)reads, JSON-unmarshals, and validates required fields; returns distinct typed errors for missing file, invalid JSON, and missing/invalid required fieldversionis required and validated (only1is accepted in this slice)issuervalidation: parses as URL, has scheme + host, no trailing slash; default-corrected if a trailing slash is present and a debug log is emittedjotsmith config showprints the loaded config JSON pretty-printed to stdoutjotsmith config show --pathprints the resolved config file path to stdout--no-coloris respected on stderr error renderingBlocked by
Originally created in OpenCode session ID: ses_17ca8efd8ffexLcFSysAMDVNBQ