Skip to content

feat: add declarative Outfit files for provider config - #3

Merged
outofcoffee merged 3 commits into
mainfrom
feat/outfit-file
Jun 23, 2026
Merged

feat: add declarative Outfit files for provider config#3
outofcoffee merged 3 commits into
mainfrom
feat/outfit-file

Conversation

@outofcoffee

@outofcoffee outofcoffee commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Add an Outfit file: a flat, Dockerfile-style way to capture one opencode provider selection and apply it with a single command.

Summary

  • Add the Outfit file format — PROVIDER / FAMILY / MODEL / CONTEXT / BASEURL instructions, one provider per file. Keywords are case-insensitive (UPPERCASE canonical), with # comments inline or full-line.
  • CONTEXT and BASEURL map to the --context and --base-url flags (with URL / BASE-URL / BASE_URL aliases), so an Outfit can express everything oc-config add can.
  • Add oc-config apply [path] to apply an Outfit, defaulting to ./Outfit so a bare oc-config apply works. It reuses the existing add pipeline via a shared applySelection, so config merges behave identically.
  • Add oc-config export [-p name] to reconstruct an Outfit from the current config, naming a FAMILY when the configured models match one and otherwise the specific MODEL.
  • Document the format in docs/outfit-file.md (end-user oriented) and move the llama.cpp guides under examples/, each now a directory with a README and a ready-to-apply Outfit.
  • Cover the new code with tests for family matching, keyword parsing, and the export/apply edge cases; total coverage rises from 87.7% to 90.3%.

Implementation details

  • An Outfit is deliberately a single-provider file with no indentation — it maps one-to-one onto an oc-config add, which kept the parser small and the apply path a thin wrapper over existing logic.
  • export is a best-effort inverse of writeConfig: loadConfigState reads back each provider's model keys, options.baseURL, and per-model limit.context; matchFamily collapses a known model set to its family name. It records a BASEURL only when it overrides the catalogue default, and a CONTEXT only when the exported models agree on a single value, so it never invents or guesses data.
  • Rebased onto the recently merged --base-url (feat: allow API base URL override via flag or env var #1) and --context (feat: add --context flag to set model context window #2) work; the Outfit keywords reuse those same selection fields and the example guides now set a matching context window in-file.

outofcoffee and others added 2 commits June 23, 2026 07:51
Add an Outfit file: a flat, Dockerfile-style description of a single
opencode provider selection (PROVIDER/FAMILY/MODEL), applied in one
command. Keywords are case-insensitive with UPPERCASE canonical, and
`#` comments are supported inline and full-line.

- `oc-config apply [path]` applies an Outfit, defaulting to ./Outfit;
  it shares the existing add pipeline via applySelection.
- `oc-config export [-p name]` reconstructs an Outfit from the current
  config, naming a FAMILY when the configured models match one.
- Document the format in docs/outfit-file.md and move the llama.cpp
  guides under examples/, each with a ready-to-apply Outfit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add tests for the reverse family lookup (`matchFamily`) and the
`export`/`apply` branches: model-only fallback when no family matches,
keeping both FAMILY and a non-default MODEL, multi-provider selection
(error / -p / unknown -p), empty config, and apply error paths.
Raises total coverage from 87.7% to 89.9%.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@outofcoffee outofcoffee added documentation Improvements or additions to documentation enhancement New feature or request labels Jun 23, 2026
Extend the Outfit syntax with two optional instructions that map to the
existing `--context` and `--base-url` flags:

- CONTEXT <size> sets the model's context window (128k, 1m, 200000).
- BASEURL <url> overrides the provider API base URL; URL, BASE-URL, and
  BASE_URL are accepted as aliases.

`apply` threads both through the shared add pipeline. `export` recovers
them too: it records a BASEURL only when it overrides the catalogue
default, and a CONTEXT only when the exported models agree on one value,
so it never invents data. The llama.cpp examples now set a matching
CONTEXT in-file instead of a follow-up add.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@outofcoffee
outofcoffee merged commit 673ba55 into main Jun 23, 2026
1 check passed
@outofcoffee
outofcoffee deleted the feat/outfit-file branch June 23, 2026 13:54
@outofcoffee
outofcoffee restored the feat/outfit-file branch June 23, 2026 14:08
@outofcoffee
outofcoffee deleted the feat/outfit-file branch June 23, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant