Commit graph

6 commits

Author SHA1 Message Date
Christian Klotz
9171697c0d
feat(mcp,coding-agent): publish a JSON schema for mcp.json (#12706)
Publishes a JSON schema for `mcp.json` at
`https://pi.dev/schemas/mcp.schema.json`, like the existing
models/settings/keybindings/theme schemas. Closes #12563.

## What

**pi-mcp** (owner of the shared `mcpServers` shape):
- New `./config-schema` export: the shared fields as a JSON Schema built
with pi-schema, following the pi-ai compat/model-schema pattern.
Field-level constraints (loopback `callbackUrl`, non-blank `clientName`,
port bounds, URL patterns, `protocol`) live here, next to the validator
they mirror.
- `McpStdioServerConfig`, `McpHttpServerConfig`, and `McpOAuthConfig`
now derive from the schema (`Static`), so schema and types cannot drift.
`McpHttpServerConfig.type` now includes `"streamable-http"`, which the
validator always accepted. The validator itself is unchanged, and the
root export does not load pi-schema (type-only imports).

**coding-agent**:
- `src/core/mcp-config-schema.ts` composes pi's fields (`exposure`,
`toolExposure`, `auth`, `autoEnableCodemode`, project override entries)
on top of pi-mcp's property maps, re-annotated with pi's behavior, and
`generate-schemas.ts` emits the committed `schemas/mcp.schema.json`.
- Entries, oauth, and the document root are closed objects: the loader
deliberately keeps unknown fields, so a mistyped key (`exposur`,
`mcpSevers`) changes behavior silently today; the schema flags it in the
editor.
- Docs: `$schema` line in `docs/mcp.md`, plus a section for the
previously undocumented `auth` field (separate commit).

## Intentional schema/runtime differences

Documented in the `mcp-config-schema.ts` header and asserted in the
tests: cross-field rules stay prose (override/`auth` file scoping, cimd
restrictions, port agreement), URL schemes must be lowercase, and
entries mixing `url` with `command` are flagged although the runtime
picks HTTP.

## Tests

- `packages/mcp/test/config-schema.test.ts`: schema/validator agreement
for the shared fields.
- `packages/coding-agent/test/config-schemas.test.ts`: fifth artifact
pinned, representative documents, a runtime-validator agreement test
(accept and reject lists plus the documented asymmetries), and a
compile-time key-parity guard against the runtime config types.
- `npm run check` clean; pi-mcp suite 199/199; coding-agent
config-schemas/documentation/references pass.

This PR is AI-generated.
2026-12-01 15:59:26 +00:00
Christian Klotz
8efd314fa3
docs(ai,coding-agent): generate models.json reference from schemas (#11038)
Some checks failed
CI / build-check-test (push) Waiting to run
CI / mcp-conformance (push) Waiting to run
Environments / daemons (push) Has been cancelled
Environments / tests (macos-latest) (push) Has been cancelled
Environments / tests (ubuntu-24.04-arm) (push) Has been cancelled
Environments / tests (ubuntu-latest) (push) Has been cancelled
Environments / tests (windows-11-arm) (push) Has been cancelled
Environments / tests (windows-latest) (push) Has been cancelled
Environments / check (push) Has been cancelled
Environments / release-daemons (darwin-arm64, macos-latest) (push) Has been cancelled
Environments / release-daemons (darwin-x64, macos-latest) (push) Has been cancelled
Environments / release-daemons (linux-arm64, ubuntu-24.04-arm) (push) Has been cancelled
Environments / release-daemons (linux-x64, ubuntu-latest) (push) Has been cancelled
Environments / release-daemons (windows-arm64, windows-11-arm) (push) Has been cancelled
Environments / release-daemons (windows-x64, windows-latest) (push) Has been cancelled
* docs(ai,coding-agent): generate models.json reference from schemas

Add npm run generate:references, which renders docs/models-configuration.md
from the models.json TypeBox schemas, and describe provider and model fields
in those schemas. Overrides get their own descriptions without defaults, and
compat sections cover the Responses API aliases.

closes #10790

* Modify changelog

* docs(ai,coding-agent): use shared thinkingLevelMap and promptCache schemas

Replace the per-use schema helpers with fixed schemas whose descriptions
hold for both models and modelOverrides entries.
2026-10-16 21:53:00 +01:00
Christian Klotz
96abe9a5ad
feat(coding-agent): use pi.dev configuration schemas (#10751)
* feat(coding-agent): use pi.dev configuration schemas

* refactor(coding-agent): separate schema URL from output path

* docs(coding-agent): document published schema URLs
2026-10-11 14:48:42 +01:00
Christian Klotz
7f9e1198f2
feat(coding-agent): publish configuration schemas (#9880)
* feat(coding-agent): publish configuration schemas

* fix(coding-agent): preserve config schema metadata

* fix(coding-agent): align schemas with public contracts

* fix(ai): place compatibility schema with providers

* fix(ai,coding-agent): align configuration schema contracts

* fix(ai): reuse session affinity schema

* docs(coding-agent): document strict theme validation

* fix(ai,coding-agent): align runtime and generated schemas

* fix(ai,coding-agent): centralize configuration schema contracts

* fix(ai,coding-agent): preserve schema validation contracts

* fix(coding-agent): validate keybinding schema grammar

* fix(ai,coding-agent): refine configuration schemas

* fix(ai,tui,coding-agent): align schemas with runtime behavior

* fix(tui): normalize shifted symbol keybindings

* fix(ai): preserve compatibility auto-detection
2026-10-08 10:01:17 +02:00
Mario Zechner
7af1919d31 fix: use portable shebang in shell scripts
Change #!/bin/bash to #!/usr/bin/env bash for better portability
on systems like NixOS where /bin/bash doesn't exist.

Fixes #910
2026-01-22 21:44:39 +01:00
Mario Zechner
fa946c68fc Add session migration script for #320 2025-12-26 03:15:46 +01:00