0
Fork 0
mirror of https://github.com/mastra-ai/mastra.git synced 2026-11-17 08:44:46 +00:00
mastra/packages/server/scripts
Eric Pinzur b2e0e40b57
feat(cli): align score and feedback API commands (#30089)
Closes [OBS-794](https://linear.app/kepler-crm/issue/OBS-794).

Adds `feedback create`, `list`, `get`, `replace`, and `review-status`,
plus `aggregate`, `breakdown`, `timeseries`, and `percentiles` for both
scores and feedback. Creates generate missing IDs and timestamps once
and preserve them across bounded HTTP retries and credential fallback.
Replacements require the original identity and timestamp; review-status
updates preserve missing-record errors. Context-mode omission and
feedback author fields are passed through without inferring values.

List output preserves pagination and delta cursors, and write output
retains the server's success and identity data. Score/feedback schemas
are generated from the server routes and bundled for `--schema` without
requiring a target schema endpoint. Most of the diff is that generated
file. Includes help examples, CLI reference docs, and a minor `mastra`
changeset.

Validation: 221 CLI API tests, including 57 real-HTTP cases; 20 repeated
timeout/credential-fallback runs; CLI typecheck; type-aware
lint/precommit checks; docs check with Vale and the CI Vale
configuration. Validated all 14 write/analytics help examples against
the current server body schemas. Missing-anchor retries, transient
failures, credential fallback, older success-only responses, unsupported
endpoints, and API-prefix/auth headers are covered.

The full `turbo build --filter mastra` stopped in the unchanged
`@mastra/playground-ui` declaration step (`tsc found type errors`, with
no underlying diagnostic emitted) before building the CLI. Local checks
used Node 23.11.0, which is outside the repository's requested engine
range. Live Platform writes and package publication/deployment were not
tested.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## ELI5

This PR adds commands to create, review, list, and analyze scores and
feedback. It also makes retries safer by preserving the same IDs,
timestamps, and request data.

## Changes

- Added feedback `create`, `list`, `get`, `replace`, and `review-status`
commands.
- Added `aggregate`, `breakdown`, `timeseries`, and `percentiles` for
scores and feedback.
- Added validation for write inputs and feedback replacement identity.
- Added bounded retries for transient failures and credential fallback.
- Preserved pagination cursors, response identity data, and feedback
fields.
- Bundled generated score and feedback schemas for offline `--schema`
output.
- Added unsupported-endpoint errors for HTTP 405 and 501 responses.
- Updated documentation, help examples, and the `mastra` changeset.
- Added HTTP-backed tests for commands, validation, retries, responses,
and schemas.

## Validation

- The author reports 221 CLI API tests, including 57 real-HTTP cases.
- The author reports passing typecheck, lint, precommit, Vale, and
documentation checks.
- The build stopped in the unchanged `@mastra/playground-ui` declaration
step before the CLI build.
- Local checks used Node 23.11.0, outside the repository’s requested
engine range.
- Live Platform writes and package publication or deployment were not
tested.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
History 2026-11-11 19:53:52 +01:00
..
check-permissions.ts feat(server): read-only Knowledge routes and client methods so Studio can browse a Knowledge instance (#29069) 2026-10-30 23:38:07 -07:00
generate-api-cli-route-metadata.ts feat(cli): align score and feedback API commands (#30089) 2026-11-11 19:53:52 +01:00
generate-permissions.ts feat: auth core, server RBAC, and adapter permission enforcement (#13163) 2026-03-03 22:49:10 +01:00
generate-route-types.ts feat(server): read-only Knowledge routes and client methods so Studio can browse a Knowledge instance (#29069) 2026-10-30 23:38:07 -07:00
permission-generator.ts feat(server): read-only Knowledge routes and client methods so Studio can browse a Knowledge instance (#29069) 2026-10-30 23:38:07 -07:00