Skip to content

Fix/additional polishing - #25

Merged
bartrosa merged 11 commits into
mainfrom
fix/additional-polishing
May 25, 2026
Merged

bartrosa merged 11 commits into
mainfrom
fix/additional-polishing

Conversation

@bartrosa

Copy link
Copy Markdown
Owner

Summary

Polishes the monorepo for local MCP/LLM dogfooding and adds corpus drafting to pickled-diff. Introduces a one-shot setup script, documents cache/budget/model behaviour, records ADRs, and aligns bdd/schema/diff MCP CLIs with build_default_client (requires pickled-core bootstrap from feat/update-pickled-core).

Changes

Local development onboarding

  • scripts/setup_local_dev.py — stdlib script that:
    • Writes pickled.config.yaml (provider, model, API key env)
    • Merges pickled-spec MCP entry into Cursor config (project or global)
    • Optionally runs scripts/smoke_mcp_stdio.py
    • Supports dry-run / force / backup of existing files
  • pickled.config.yaml — generated template for local dogfood (not committed secrets).

Documentation and ADRs

  • docs/mcp.md — cache/budget/model section, env overrides, umbrella tool reference table (rules_*, data_*, diff_*, iac_*, etc.).
  • docs/decisions/0002-cache-and-budget-in-pickled-config.md — cache and budget in YAML.
  • docs/decisions/0003-cache-budget-and-model-resolution.md — model resolution and build_default_client wiring.

pickled-diff: corpus drafting

  • CorpusDrafter — expands seed {"name", "payload"} examples to a target corpus size (JSON output, ---RATIONALE--- split).
  • Post-validation: JSON parse, item count, required keys.
  • CLI pickled-diff draft-corpus — --seeds, --target-size, optional --notes, -o / --output.
  • MCP draft_corpus_from_examples — wired when LLM is configured; stub otherwise.
  • README: MCP table, drafting section, check-all note.

MCP / CLI consistency (bdd, schema, diff)

  • Replace hand-rolled importlib + build_client with build_default_client / pickled_core.mcp.llm_client (build_llm_client, optional_llm_client).
  • pickled-bdd cli.py and mcp_cli.py — same bootstrap pattern.
  • pickled-schema mcp_cli.py — optional LLM for umbrella mount.

Repo hygiene

  • .gitignore — .pickled-cache/
  • pyproject.toml / uv.lock — dev deps pickled-core[all-providers] and pickled-core[mcp] for tests and smoke runs.

Test plan

uv sync
uv run pytest -q packages/pickled-diff/tests/test_drafter.py \
                 packages/pickled-diff/tests/test_cli_draft.py \
                 packages/pickled-diff/tests/test_mcp_tools.py

# Local onboarding (dry-run)
uv run python scripts/setup_local_dev.py --dry-run

# MCP smoke
uv sync --extra mcp
uv run python scripts/smoke_mcp_stdio.py

# Corpus draft with test factory
export PICKLED_DIFF_LLM_FACTORY=pickled_bdd.testing:build_fake_llm
uv run pickled-diff draft-corpus \
  --seeds packages/pickled-diff/tests/fixtures/seed_corpus.json \
  --target-size 5

bartrosa added 11 commits May 25, 2026 19:01
- Introduced `setup_local_dev.py` to streamline onboarding for local development.
- The script generates a `pickled.config.yaml`, merges MCP server entries into Cursor config, and optionally runs a smoke test.
- Enhances the development experience by automating configuration tasks and ensuring necessary dependencies are in place.
- Removed the manual handling of the `PICKLED_BDD_LLM_FACTORY` environment variable in favor of a streamlined `build_default_client` function.
- Updated `_build_llm_client` in both `cli.py` and `mcp_cli.py` to enhance clarity and reduce complexity in LLM client initialization.
- Improved error handling by maintaining the existing `ConfigError` management, ensuring robust client setup.
- Added a new `draft-corpus` command to the CLI for expanding seed examples into a larger differential corpus.
- Introduced `CorpusDrafter` class to handle the drafting process, utilizing an LLM client for generating corpus items.
- Enhanced `register_with_fastmcp` to integrate the drafting functionality, allowing for LLM-driven corpus generation within the MCP framework.
- Improved error handling and output management for the drafting process, ensuring robust user feedback and experience.
- Introduced a new JSON fixture file `seed_corpus.json` containing sample payloads for testing the corpus drafting functionality.
- The fixture includes examples for an empty payload, an ASCII word, and a Unicode string, enhancing test coverage for various input scenarios.
- Introduced new test files for the CLI draft-corpus command and the CorpusDrafter class, ensuring robust testing of the corpus drafting functionality.
- Implemented tests for various scenarios, including successful drafting, handling warnings for invalid input, and managing exceptions, enhancing overall test coverage and reliability.
- These additions support ongoing development and validation of the pickled-diff CLI and drafting functionalities.
…uctions

- Expanded the README to include detailed descriptions of the `verify_against_oracle` and `draft_corpus_from_examples` MCP tools.
- Added a new section with usage instructions for the `draft-corpus` command, enhancing user guidance for corpus drafting.
- Improved clarity on input handling for seed examples and notes, ensuring better understanding of the command's functionality.
- Introduced `pickled.config.yaml` to store configuration for the anthropic provider, including the default model and API key environment variable.
- This addition supports the local development environment by providing necessary settings for the anthropic integration.
- Updated the `_build_llm_client` function to utilize `build_default_client` for improved clarity and reduced complexity.
- Removed the manual handling of the `PICKLED_SCHEMA_LLM_FACTORY` environment variable, enhancing the client creation process.
- Maintained existing error handling for configuration issues, ensuring robust client setup.
- Added `.pickled-cache/` to the .gitignore file to prevent caching files from being tracked.
- Retained existing entry for `.cursor/` to ensure proper exclusion of cursor-related files.
- Added `pickled-core` with extras `all-providers` and `mcp` to both `pyproject.toml` and `uv.lock` files.
- This update ensures the inclusion of necessary features and providers for enhanced functionality.
- Updated `mcp.md` to include details on LLM-backed tools in `pickled-rules`, `pickled-data`, and `pickled-diff`, highlighting the integration of cache and budget settings.
- Added a new section on response caching, budget caps, and model resolution, providing examples of configuration in `pickled.config.yaml`.
- Introduced two new decision documents outlining the rationale for implementing cache and budget features, ensuring clarity on their usage and benefits.
@bartrosa
bartrosa merged commit f412873 into main May 25, 2026
0 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant