# mcp/COMPATIBILITY - CLI version requirements for this MCP server
# Usage: source "${SCRIPT_DIR}/COMPATIBILITY"

CLI_MIN_VERSION="1.13.0"
CLI_MAX_VERSION="1.13.0"

# MCP 1.22.0 requires CLI 1.13.0 for:
# - `list export --filter` without scope flag now exits 2 (breaking). MCP agents
#   must add --all / --max-results / --first-page-only to unscoped filter calls.
# - `list export --company-id ID` / `--person-id ID`: entity-scoped exports for
#   dedup-check workflows (see data-model guide "Duplicate checks" section).
# - `list export --first-page-only`: explicit opt-in required alongside --filter.
# - JSON envelope: `meta.truncated` (bool) and `meta.truncationReason` (string)
#   for machine-readable truncation signal. Absent when not truncated.
# - `_entry_to_filter_dict` now includes `entityName` / `entityType` /
#   `entityId` / `listEntryId` — filters on row-level keys match correctly
#   instead of silently returning zero.

# MCP 1.21.0 requires CLI 1.12.0 for:
# - `company ls` / `person ls` --filter raises unsupported_filter (V2 API limitation)
# - `query` rejects `where` on companies/persons/opportunities
# - `company create` / `person create` refuse duplicates by default (exit 6, error_type=duplicate_exists)
# - `--allow-duplicate` flag on create; error payload includes existing id + isGlobal (companies)
#
# MCP 1.19.0 requires CLI 1.7.0 for:
# - `field history-bulk` command: Batch field change history (pipeline analysis skill)
# - `--list` alias on `field ls` and `field history-bulk`
#
# MCP 1.17.1 requires CLI 1.0.3 for:
# - Query include: Incremental progress emission during N+1 operations (prevents MCP timeout)
#
# MCP 1.17.0 requires CLI 1.0.0 for:
# - `config update-check --background`: Non-blocking background update check
# - Required by MCP startup update notifications (env.sh)
#
# MCP 1.16.2 requires CLI 0.16.1 for:
# - Version alignment release (documentation updates)
#
# MCP 1.14.0 requires CLI 0.15.0 for:
# - `files read` commands: Read file content inline with chunking support (base64)
# - Works in Claude Desktop/Cowork where presigned URLs are blocked
#
# MCP 1.13.0 requires CLI 0.14.0 for:
# - `get-file-url` tool: New MCP tool for file content access via presigned URLs
# - `files ls` commands: New commands to list files attached to entities
# - `files download --file-id`: Single-file download support
# - `file-url` command: Get presigned download URLs (powers get-file-url tool)
#
# MCP 1.12.0 requires CLI 0.13.0 for:
# - `list get` JSON output: `listSize` now accurate (V1 API) instead of often 0 (V2 API bug)
# - Dry-run estimates: `estimatedEntries` in query/export dry-runs now accurate
# - `AffinityList.list_size` removed from SDK; CLI explicitly adds listSize via get_size()
#
# MCP 1.11.0 requires CLI 0.12.0 for:
# - Query tool: `--cursor` option for resumable pagination on truncated responses
# - Query tool: O(1 streaming resumption via stored API cursor
# - Query tool: Full-fetch disk cache resumption for orderBy/aggregate queries
#
# MCP 1.10.0 requires CLI 0.11.0 for:
# - Query engine: `entityName` correctly computed for Person list entries (was null)
# - Formatters: Person entities with type="external"/"internal" now display names correctly
#
# MCP 1.8.8 requires CLI 0.9.11 for:
# - `query` tool: Default format changed to TOON (requires CLI TOON envelope support)
# - `query` tool: Include inline expansion with --include-style flag
# - `query` tool: Format-aware truncation with --max-output-bytes
# - `query` tool: interactionDates expansion support
#
# MCP 1.8.7 required CLI 0.9.9 for:
# - `query` tool: Advanced relationship filtering (all_, none_, exists_, _count)
# - `query` tool: Pre-include step for fetching relationship data before filtering
# - `query` tool: Relationship key renamed from "people" to "persons" in JSON output
# - CLI commands: --expand option uses "persons" instead of "people"
#
# MCP 1.8.3 requires CLI 0.9.8 for:
# - `query` tool: Fixed fetch-before-filter/sort/aggregate (correct top N, accurate counts)
#
# MCP 1.8.2 requires CLI 0.9.6 for:
# - `query` tool: listEntryId, entityId, entityName, entityType aliases on listEntries
# - `query` tool: null values included in projection when explicitly selected
# - `query` tool: fields key always present on listEntries (defaults to {})
#
# MCP 1.8.0 requires CLI 0.9.2 for:
# - `interaction ls` JSON output: .data is now direct array (was .data.interactions)
# - `interaction ls` JSON output: metadata moved to .meta.summary (was .data.metadata)
# - `note ls` JSON output: .data is now direct array (was .data.notes)
# - Standardized ResultSummary footer rendering
#
# MCP 1.7.0 requires CLI 0.8.0 for:
# - `entry field` unified command (replaces set-field, set-fields, unset-field)
# - Standardized date filter parameters (--after/--before)
# - `interaction ls` auto-chunking: --cursor/--all removed
# - `interaction ls` multi-type support: --type is repeatable, --type all supported
# - `interaction ls` date range defaults to all-time when --days/--after omitted
# - `interaction ls` output: modifiers.type → modifiers.types (always array)
# - `interaction ls` output: metadata.chunksProcessed → metadata.typeStats[type].chunksProcessed
#
# MCP 1.0.0 requires CLI features introduced in 0.6.0:
# - JSON output format with .data wrapper
# - --session-cache flag
# - --readonly flag
# - config check-key --json command
# - version --output json command

# Progress forwarding requires CLI >= 0.6.10 (NDJSON progress on stderr)
# MCP tools gracefully degrade when progress not supported
PROGRESS_MIN_VERSION="0.6.10"
