Commit 2263927
committed
feat(functions push): add --manifest path for non-SDK function types
The runner-based push path can only ship function types the Braintrust
SDK exposes builders for: tools, scorers, prompts, parameters. Topics-
pipeline types (facet, classifier) and inline-quickjs preprocessors
have no SDK builder, so AI-agent workflows that author lenses cannot
push them through `bt`.
`--manifest <path>` accepts a JSON file with three shapes — the
`/insert-functions` wire body `{"functions": [...]}`, a bare entry
array, or a single entry object. The body bypasses the SDK runner
and is posted directly to `/insert-functions` (the same endpoint
`bt topics config enable` uses to create classifier functions).
Reuses the runner path's preflight machinery: `parse_project_selector`
+ `add_selector_requirement` for project classification,
`validate_direct_project_ids` for direct-id verification,
`resolve_named_projects` (honors `--create-missing-projects`) +
`resolve_default_project_id` for project resolution, and
`validate_duplicate_slugs` for cross-specifier collision detection.
A pre-resolution dedup pass canonicalizes Fallback to its default
project name so duplicate slugs never trigger fresh-project creation
on the server.
Failure paths emit a manifest-aware `PushSummary` with `total_files: 1`
and `source_file: <manifest-path>` so JSON consumers see the right
context. Two-step parse distinguishes `ManifestInvalidJson` from
`ManifestSchemaInvalid`. Spinner is suppressed in `--json` mode to
keep stderr clean.
Mutually exclusive only with `--file` and the positional file paths
(the genuinely ambiguous overlap). Runner-specific options
(`--runner`, `--language`, etc.) are silently ignored on this path
so env-backed defaults don't block the command.
Closes #149.1 parent fd5aed7 commit 2263927
6 files changed
Lines changed: 974 additions & 13 deletions
File tree
- src/functions
- tests
- functions-fixtures
- push-help-env-vars
- push-help-flags
- push-manifest-conflicts-with-files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
273 | 282 | | |
274 | 283 | | |
275 | 284 | | |
| |||
687 | 696 | | |
688 | 697 | | |
689 | 698 | | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
690 | 728 | | |
691 | 729 | | |
692 | 730 | | |
| |||
0 commit comments