Skip to content

Slice 2: config package + jotsmith config show #2

Closed

Description

@MaxAnderson95

What to build

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.

Path resolution precedence (highest wins): --config flag → JOTSMITH_CONFIG env → ${XDG_CONFIG_HOME:-$HOME/.config}/jotsmith/config.json.

Acceptance criteria

  • 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

Blocked by

Originally created in OpenCode session ID: ses_17ca8efd8ffexLcFSysAMDVNBQ

Activity

  1. added
    ready-for-agent
    on Jun 1, 2026
  2. MaxAnderson95 commented on Jun 1, 2026

    @MaxAnderson95
    OwnerAuthor

    Implemented and merged in #14.

    Originally created in OpenCode session ID: ses_17c986ef9ffeHc0S3r1wQcmLDT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ready-for-agent

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions